데스크탑 앱 전략편집기 수정

This commit is contained in:
Macbook
2026-06-14 22:39:00 +09:00
parent 76ffa5ac52
commit 21f5d16b6f
4 changed files with 134 additions and 47 deletions
+7 -2
View File
@@ -48,21 +48,26 @@ export interface BindWindowDragOptions {
*/
export function bindWindowDrag(
onMove: (xy: ClientXY, ev: Event) => void,
onEnd: () => void,
onEnd: (xy: ClientXY, ev: Event) => void,
options: BindWindowDragOptions = {},
): () => void {
const { preventTouchScroll = true } = options;
let lastXY: ClientXY = { x: 0, y: 0 };
const move = (ev: Event) => {
const xy = clientXYFromNative(ev);
if (!xy) return;
lastXY = xy;
if (preventTouchScroll && ev.cancelable && (ev instanceof TouchEvent || ev.type === 'touchmove')) {
ev.preventDefault();
}
onMove(xy, ev);
};
const end = () => onEnd();
const end = (ev: Event) => {
const xy = clientXYFromNative(ev) ?? lastXY;
onEnd(xy, ev);
};
window.addEventListener('pointermove', move);
window.addEventListener('pointerup', end);