앱 수정
This commit is contained in:
@@ -55,6 +55,7 @@ let pendingMove: { x: number; y: number } | null = null;
|
||||
let unbindGesture: (() => void) | null = null;
|
||||
let lastDragClientXY: { x: number; y: number } | null = null;
|
||||
let htmlPaletteDragActive = false;
|
||||
let lastHtmlDragClientXY: { x: number; y: number } | null = null;
|
||||
|
||||
function installHtmlPaletteDragGlobals() {
|
||||
if (typeof window === 'undefined') return;
|
||||
@@ -64,12 +65,23 @@ function installHtmlPaletteDragGlobals() {
|
||||
|
||||
window.addEventListener('dragover', (e) => {
|
||||
if (!htmlPaletteDragActive) return;
|
||||
if (e.clientX !== 0 || e.clientY !== 0) {
|
||||
lastHtmlDragClientXY = { x: e.clientX, y: e.clientY };
|
||||
}
|
||||
e.preventDefault();
|
||||
if (e.dataTransfer) e.dataTransfer.dropEffect = 'copy';
|
||||
}, { passive: false });
|
||||
|
||||
window.addEventListener('drag', (e) => {
|
||||
if (!htmlPaletteDragActive) return;
|
||||
if (e.clientX !== 0 || e.clientY !== 0) {
|
||||
lastHtmlDragClientXY = { x: e.clientX, y: e.clientY };
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('dragend', () => {
|
||||
htmlPaletteDragActive = false;
|
||||
lastHtmlDragClientXY = null;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -328,10 +340,16 @@ export function handlePaletteTouchStart(
|
||||
|
||||
export function markPaletteHtmlDragStart(): void {
|
||||
htmlPaletteDragActive = true;
|
||||
lastHtmlDragClientXY = null;
|
||||
}
|
||||
|
||||
export function markPaletteHtmlDragEnd(): void {
|
||||
htmlPaletteDragActive = false;
|
||||
lastHtmlDragClientXY = null;
|
||||
}
|
||||
|
||||
export function getLastHtmlPaletteDragClientXY(): { x: number; y: number } | null {
|
||||
return lastHtmlDragClientXY;
|
||||
}
|
||||
|
||||
export function isPaletteHtmlDragActive(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user