-
-
Notifications
You must be signed in to change notification settings - Fork 1k
add keyboard shortcuts for renaming layers #3641
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
base: master
Are you sure you want to change the base?
add keyboard shortcuts for renaming layers #3641
Conversation
|
Any update on this guys ! |
|
!build |
|
| return layers.some((layer) => layer.editingName); | ||
| } | ||
| async function navigateToLayer(currentListing: LayerListingInfo, direction: "next" | "previous" | "up" | "down") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's any reason to have four instead of two directions, when each pair are just synonyms of each other. Just name them "Up" and "Down", with the first letter capitalized because these are the JS equivalent of Rust's enum variants which are also PascalCase.
| function isAnyLayerBeingEdited(): boolean { | ||
| return layers.some((layer) => layer.editingName); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A one-liner function that's only used once is rather unnecessary compared to just calling that logic inline and describing what's going on in the comment above it.
| let targetIndex: number; | ||
| if (direction === "next" || direction === "down") { | ||
| targetIndex = currentIndex + 1; | ||
| if (targetIndex >= layers.length) return; // Don't wrap around at the end | ||
| } else { | ||
| // previous or up | ||
| targetIndex = currentIndex - 1; | ||
| if (targetIndex < 0) return; // Don't wrap around at the beginning | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move targetIndex declaration to a ternary statement and perform both returns, checking both conditions with a logical OR, on the following line. Full if/else blocks are too verbose here when this could all be made into two lines.
This PR adds the following shortcuts , although in my opinion since graphite has layers stacked vertically , there is no point in keeping both the tab , shft tab and the arrow keys option, since both of them does the same job
Screen.Recording.2026-01-15.at.6.07.27.PM.mov
Screen.Recording.2026-01-15.at.5.51.52.PM.mov
CLOSES #3636