Improve layer positioning in graph upon reordering; improve history system; add selection history (#1945)

* Improve layer positioning

* Collapse space when deleting

* Improve moving layers in layer panel

* Improved transactions

* Selection history

* Code review

* Select previous selection when aborting

* Fix crash and artboard select

* Add mouse forward/back button selection history bindings

Code review

* Menu buttons

* Code review

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
adamgerhant
2024-09-01 02:34:18 -07:00
committed by GitHub
co-authored by Keavon Chambers
parent 432385343e
commit 9adc640f19
29 changed files with 806 additions and 443 deletions
+11 -3
View File
@@ -182,6 +182,12 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
}
function onPointerUp(e: PointerEvent) {
// Don't let the browser navigate back or forward when using the buttons on some mice
// TODO: This works in Chrome but not in Firefox
// TODO: Possible workaround: use the browser's history API to block navigation:
// TODO: <https://stackoverflow.com/questions/57102502/preventing-mouse-fourth-and-fifth-buttons-from-navigating-back-forward-in-browse>
if (e.button === 3 || e.button === 4) e.preventDefault();
if (!e.buttons) viewportPointerInteractionOngoing = false;
if (textToolInteractiveInputElement) return;
@@ -198,9 +204,11 @@ export function createInputManager(editor: Editor, dialog: DialogState, portfoli
// `e.buttons` is always 0 in the `mouseup` event, so we have to convert from `e.button` instead
let buttons = 1;
if (e.button === 0) buttons = 1; // LMB
if (e.button === 1) buttons = 4; // MMB
if (e.button === 2) buttons = 2; // RMB
if (e.button === 0) buttons = 1; // Left
if (e.button === 2) buttons = 2; // Right
if (e.button === 1) buttons = 4; // Middle
if (e.button === 3) buttons = 8; // Back
if (e.button === 4) buttons = 16; // Forward
const modifiers = makeKeyboardModifiersBitfield(e);
editor.handle.onDoubleClick(e.clientX, e.clientY, buttons, modifiers);