Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select tool overhaul #295

Merged
merged 17 commits into from
Aug 31, 2024
Merged

Select tool overhaul #295

merged 17 commits into from
Aug 31, 2024

Conversation

Metachs
Copy link

@Metachs Metachs commented Aug 26, 2024

I had some time to kill and went in to fix a few issues with the select tool, but wound up doing a minor overhaul, and figured someone else might find it useful. Mostly UI and adding controls. Other than applying the final transform, the core functionality is mostly unchanged.

While none of the other tools were in need of as much attention as select, I've made similar updates to a few of them. If y'all aren't willing to accept these sorts of changes, let me know, and I won't bother cleaning them up.

Changes:

Reset State in the Ctrl+A shortcuts so that the current selection isn't lost when the shortcuts are used with a transformed selection. Previously, if you selected a region, moved it, then hit Ctrl+A, the transformed selection was lost. (Might want to apply instead, but resetting seems like the safest option.)

Fix History State Desynchronization when undo/redo is called while a selection is active. For example, previously, moving a selection, calling an undo that removes the active layer, then cancelling the transform with R-click, would place the restored image in an inaccessible layer.
To do this, added onundo/onredo callbacks to the commands object in commands.js (Only major change outside of select.js). These are called before undoing/redoing, and provide a function that can be called to cancel the undo/redo.
Selection state is now reset before all undo/redo commands. Performing an undo with a transformed selection resets the selection and cancels the undo, unless going back multiple steps. So undo effectively undoes the current transformation.

Refactored how Transformation is applied to make it easier to add shortcuts and additional functionality.

Fixed the broken "Delete" hotkey that completely broke history.

Added a toggle to always move to a new layer when transforming a selection. (file-plus icon)

Added "Layer" buttons to the Save Selection/Save Visible buttons that copy selected content to a new layer. Reworked their UI a bit to fit everything.

Added a new row of buttons

  • Isolate - Clears everything but the selection from the current layer.
  • Erase - Erases the current selection
  • Extract - Moves the current selection to a new layer.

Mouse Controls

  • Double Left Click - Select All (Ctrl+A)
  • Shift+Double Left Click - Select All Visible (Ctrl+Shift+A)
  • Double Right Click - Select Topmost Layer with visible content under pointer.
  • Shift+Double Right Click - Shifts down through layers with visible content under pointer. (Selects the next topmost if current has visible content under pointer.)

Keyboard Shortcuts

  • Enter - Apply Transform (Same as L-Click)
  • Shift+Enter - Extract - Apply Transform and Move the current selection to a new layer.
  • Shift+Delete - Isolate - Clears everything but the selection from the current layer.
  • Ctrl+Enter - Copy Selection to new layer, restore original
  • Ctrl+Shift+Enter - Copy Visible Selection to new layer

@zero01101
Copy link
Owner

whoa :o
enormous thanks for all the work!

@zero01101 zero01101 merged commit bf9e6d0 into zero01101:testing Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants