데스크탑 앱 전략편집기 수정
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Tauri WebView 등 HTML5 drag-and-drop 미지원 환경용 팔레트 드래그 세션
|
||||
*/
|
||||
import { bindWindowDrag, type ClientXY } from './pointerDrag';
|
||||
import { bindWindowDrag, clientXYFromNative, type ClientXY } from './pointerDrag';
|
||||
import { isDesktop } from './platform';
|
||||
|
||||
export type PaletteDragPayload = Record<string, unknown> & {
|
||||
@@ -64,6 +64,7 @@ function emit(event: PaletteDragEvent) {
|
||||
function removeGhost() {
|
||||
ghostEl?.remove();
|
||||
ghostEl = null;
|
||||
document.querySelectorAll('.se-palette-drag-ghost').forEach(el => el.remove());
|
||||
}
|
||||
|
||||
function ensureGhost(label: string, x: number, y: number) {
|
||||
@@ -83,6 +84,7 @@ function moveGhost(x: number, y: number) {
|
||||
}
|
||||
|
||||
function finishDrag(phase: 'end' | 'cancel', xy: ClientXY) {
|
||||
if (!activePayload) return;
|
||||
const payload = activePayload;
|
||||
cleanupDrag();
|
||||
if (payload && phase === 'end') {
|
||||
@@ -118,6 +120,21 @@ function beginDrag(payload: PaletteDragPayload, label: string, xy: ClientXY) {
|
||||
(endXY) => finishDrag('end', endXY),
|
||||
{ preventTouchScroll: true },
|
||||
);
|
||||
|
||||
// Tauri WebView: bubble 단계 pointerup 누락 대비
|
||||
const captureEnd = (ev: Event) => {
|
||||
if (!activePayload) return;
|
||||
const xy = clientXYFromNative(ev);
|
||||
if (xy) finishDrag('end', xy);
|
||||
};
|
||||
window.addEventListener('pointerup', captureEnd, true);
|
||||
window.addEventListener('pointercancel', captureEnd, true);
|
||||
const prevUnbind = unbindMove;
|
||||
unbindMove = () => {
|
||||
window.removeEventListener('pointerup', captureEnd, true);
|
||||
window.removeEventListener('pointercancel', captureEnd, true);
|
||||
prevUnbind();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user