desktop view
This commit is contained in:
@@ -75,7 +75,6 @@ const useDocumentDrag = () => {
|
||||
layoutRef.current.set(docId, { ...entry, centerX, centerY });
|
||||
}
|
||||
|
||||
bringToFront(docId);
|
||||
const capturedTarget = event.currentTarget instanceof HTMLElement ? event.currentTarget : null;
|
||||
if (capturedTarget && typeof capturedTarget.setPointerCapture === 'function') {
|
||||
try {
|
||||
@@ -100,6 +99,7 @@ const useDocumentDrag = () => {
|
||||
dragScale: 1,
|
||||
baseScale: normalizedBaseScale,
|
||||
capturedTarget,
|
||||
raised: false,
|
||||
};
|
||||
setDraggingId(docId);
|
||||
},
|
||||
@@ -175,6 +175,11 @@ const useDocumentDrag = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!state.raised) {
|
||||
bringToFront(state.docId);
|
||||
state.raised = true;
|
||||
}
|
||||
|
||||
const updated = { ...entry, centerX: clampedCenterX, centerY: clampedCenterY };
|
||||
layoutRef.current.set(state.docId, updated);
|
||||
|
||||
@@ -210,24 +215,26 @@ const useDocumentDrag = () => {
|
||||
(event) => {
|
||||
const state = dragStateRef.current;
|
||||
if (state && state.pointerId === event.pointerId) {
|
||||
const moved = Boolean(state.moved);
|
||||
const docId = state.docId;
|
||||
const shouldOpen = !moved && event.detail >= 2;
|
||||
finishDrag(event.pointerId);
|
||||
if (shouldOpen) {
|
||||
const originInfo = {
|
||||
rotation: state.rotation || 0,
|
||||
scale: state.baseScale || 1,
|
||||
width: state.width,
|
||||
height: state.height,
|
||||
};
|
||||
openOverlayForDoc(docId, originInfo);
|
||||
if (state.moved) {
|
||||
finishDrag(event.pointerId);
|
||||
return;
|
||||
}
|
||||
|
||||
const docId = state.docId;
|
||||
bringToFront(docId);
|
||||
const originInfo = {
|
||||
rotation: state.rotation || 0,
|
||||
scale: state.baseScale || 1,
|
||||
width: state.width,
|
||||
height: state.height,
|
||||
};
|
||||
finishDrag(event.pointerId);
|
||||
openOverlayForDoc(docId, originInfo);
|
||||
return;
|
||||
}
|
||||
finishDrag(event.pointerId);
|
||||
},
|
||||
[finishDrag, openOverlayForDoc],
|
||||
[bringToFront, finishDrag, openOverlayForDoc],
|
||||
);
|
||||
|
||||
const handlePointerCancel = useCallback(
|
||||
|
||||
Reference in New Issue
Block a user