맥 os 전략편집기 지표 드래그 문제해결

This commit is contained in:
Macbook
2026-06-15 09:39:19 +09:00
parent dbad00aa0f
commit a3aca639c1
13 changed files with 309 additions and 209 deletions
+33
View File
@@ -44,6 +44,39 @@ export interface BindWindowDragOptions {
useCapture?: boolean;
}
/**
* document capture 단계 pointer 추적 (스크롤 패널 내부 드래그 — WKWebView 대응)
*/
export function bindDocumentPointerDrag(
pointerId: number,
onMove: (xy: ClientXY) => void,
onEnd: (xy: ClientXY) => void,
): () => void {
const cap: AddEventListenerOptions = { capture: true, passive: false };
const move = (ev: Event) => {
if (!(ev instanceof PointerEvent) || ev.pointerId !== pointerId) return;
if (ev.cancelable) ev.preventDefault();
onMove({ x: ev.clientX, y: ev.clientY });
};
const end = (ev: Event) => {
if (!(ev instanceof PointerEvent) || ev.pointerId !== pointerId) return;
if (ev.cancelable) ev.preventDefault();
onEnd({ x: ev.clientX, y: ev.clientY });
};
document.addEventListener('pointermove', move, cap);
document.addEventListener('pointerup', end, cap);
document.addEventListener('pointercancel', end, cap);
return () => {
document.removeEventListener('pointermove', move, cap);
document.removeEventListener('pointerup', end, cap);
document.removeEventListener('pointercancel', end, cap);
};
}
/**
* 드래그 시작 후 window 에 move/end 리스너 등록.
* pointer + mouse + touch 모두 수신 (구형 브라우저·iOS 대응).