spacebar
This commit is contained in:
@@ -32,6 +32,7 @@ const useDocumentDrag = () => {
|
||||
containerRef,
|
||||
onDocumentOpen,
|
||||
onInspectDocument,
|
||||
onDocumentStackSelect,
|
||||
selectedDocumentIds,
|
||||
markLayoutDirty,
|
||||
} = useDesktopContext();
|
||||
@@ -286,6 +287,7 @@ const useDocumentDrag = () => {
|
||||
.map((value) => (value != null ? String(value) : null))
|
||||
.filter(Boolean)
|
||||
: null;
|
||||
const stackSelectionAppliedInitial = Boolean(options?.stackSelectionApplied);
|
||||
|
||||
let selectionIds = Array.isArray(selectedDocumentIds)
|
||||
? selectedDocumentIds.map((id) => String(id))
|
||||
@@ -416,6 +418,8 @@ const useDocumentDrag = () => {
|
||||
? performance.now()
|
||||
: Date.now();
|
||||
|
||||
const hasStackSource = Array.isArray(stackDocIdsOption) && stackDocIdsOption.length > 1;
|
||||
|
||||
dragStateRef.current = {
|
||||
docId,
|
||||
docKey,
|
||||
@@ -444,9 +448,11 @@ const useDocumentDrag = () => {
|
||||
containerRectTop: containerTop,
|
||||
isGroup: isGroupDrag,
|
||||
groupDocIds,
|
||||
groupItems,
|
||||
groupElevated: !isGroupDrag,
|
||||
};
|
||||
groupItems,
|
||||
groupElevated: !isGroupDrag,
|
||||
stackDocIds: hasStackSource ? stackDocIdsOption : null,
|
||||
stackSelectionApplied: stackSelectionAppliedInitial || !hasStackSource,
|
||||
};
|
||||
|
||||
setDraggingId(docId);
|
||||
|
||||
@@ -524,6 +530,17 @@ const useDocumentDrag = () => {
|
||||
return;
|
||||
}
|
||||
state.moved = true;
|
||||
if (
|
||||
state.isGroup
|
||||
&& !state.stackSelectionApplied
|
||||
&& Array.isArray(state.stackDocIds)
|
||||
&& state.stackDocIds.length > 1
|
||||
) {
|
||||
if (typeof onDocumentStackSelect === 'function') {
|
||||
onDocumentStackSelect(state.stackDocIds);
|
||||
}
|
||||
state.stackSelectionApplied = true;
|
||||
}
|
||||
if (!state.groupElevated) {
|
||||
const layout = layoutRef.current;
|
||||
const sortedGroup = state.groupDocIds
|
||||
@@ -811,6 +828,7 @@ const useDocumentDrag = () => {
|
||||
applyTransform,
|
||||
recalcVisibleDocIds,
|
||||
debugDrag,
|
||||
onDocumentStackSelect,
|
||||
],
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user