feat: enable panning by dragging on empty space with left mouse button

This commit is contained in:
Abhinav Kumar
2025-07-08 23:32:20 +05:30
parent c551424be9
commit ddb28a2eda
2 changed files with 16 additions and 1 deletions

View File

@@ -142,6 +142,15 @@ export const Cursor: ModeActions = {
items: [item],
isInitialMovement: true
});
} else {
// If no item is being dragged and the mouse has moved, switch to PAN mode
// Only do this if the drag started on empty space
if (uiState.mouse.mousedown) {
uiState.actions.setMode({
type: 'PAN',
showCursor: false
});
}
}
},
mousedown,

View File

@@ -27,7 +27,13 @@ export const Pan: ModeActions = {
setWindowCursor('grabbing');
},
mouseup: () => {
mouseup: ({ uiState }) => {
setWindowCursor('grab');
// Always revert to CURSOR mode after panning
uiState.actions.setMode({
type: 'CURSOR',
showCursor: true,
mousedownItem: null
});
}
};