-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix:shortcut for changing hand and cursor mode #5131
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,8 @@ export type CommandId = | |||||||||||||||||||||||||||||||||||||||||
| | 'clear-terminal-console' | ||||||||||||||||||||||||||||||||||||||||||
| | 'focus-toolbar-search' | ||||||||||||||||||||||||||||||||||||||||||
| | 'fit-to-view' | ||||||||||||||||||||||||||||||||||||||||||
| | 'set-canvas-mode-pointer' | ||||||||||||||||||||||||||||||||||||||||||
| | 'set-canvas-mode-mover' | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
| * Static metadata for a global command. | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -92,6 +94,16 @@ export const COMMAND_DEFINITIONS: Record<CommandId, CommandDefinition> = { | |||||||||||||||||||||||||||||||||||||||||
| shortcut: 'Mod+Shift+F', | ||||||||||||||||||||||||||||||||||||||||||
| allowInEditable: false, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| 'set-canvas-mode-pointer': { | ||||||||||||||||||||||||||||||||||||||||||
| id: 'set-canvas-mode-pointer', | ||||||||||||||||||||||||||||||||||||||||||
| shortcut: 'P', | ||||||||||||||||||||||||||||||||||||||||||
| allowInEditable: false, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
| 'set-canvas-mode-mover': { | ||||||||||||||||||||||||||||||||||||||||||
| id: 'set-canvas-mode-mover', | ||||||||||||||||||||||||||||||||||||||||||
| shortcut: 'M', | ||||||||||||||||||||||||||||||||||||||||||
| allowInEditable: false, | ||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+97
to
+106
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -61,6 +61,14 @@ export const WorkflowControls = memo(function WorkflowControls() { | |||||||||||||||||||||||||||||
| id: 'fit-to-view', | ||||||||||||||||||||||||||||||
| handler: handleFitToView, | ||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||
| createCommand({ | ||||||||||||||||||||||||||||||
| id: 'set-canvas-mode-pointer', | ||||||||||||||||||||||||||||||
| handler: () => setMode('cursor'), | ||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||
| createCommand({ | ||||||||||||||||||||||||||||||
| id: 'set-canvas-mode-mover', | ||||||||||||||||||||||||||||||
| handler: () => setMode('hand'), | ||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const [contextMenu, setContextMenu] = useState<{ x: number; y: number } | null>(null) | ||||||||||||||||||||||||||||||
|
|
@@ -118,7 +126,11 @@ export const WorkflowControls = memo(function WorkflowControls() { | |||||||||||||||||||||||||||||
| </Button> | ||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||
| </PopoverTrigger> | ||||||||||||||||||||||||||||||
| <Tooltip.Content side='top'>{mode === 'hand' ? 'Mover' : 'Pointer'}</Tooltip.Content> | ||||||||||||||||||||||||||||||
| <Tooltip.Content side='top'> | ||||||||||||||||||||||||||||||
| <Tooltip.Shortcut keys={mode === 'hand' ? 'M' : 'P'}> | ||||||||||||||||||||||||||||||
| {mode === 'hand' ? 'Mover' : 'Pointer'} | ||||||||||||||||||||||||||||||
| </Tooltip.Shortcut> | ||||||||||||||||||||||||||||||
| </Tooltip.Content> | ||||||||||||||||||||||||||||||
| </Tooltip.Root> | ||||||||||||||||||||||||||||||
| <PopoverContent side='top' sideOffset={8} maxWidth={100} minWidth={100}> | ||||||||||||||||||||||||||||||
| <PopoverItem | ||||||||||||||||||||||||||||||
|
|
@@ -128,7 +140,10 @@ export const WorkflowControls = memo(function WorkflowControls() { | |||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||
| <Hand className='size-3' /> | ||||||||||||||||||||||||||||||
| <span>Mover</span> | ||||||||||||||||||||||||||||||
| <div className='flex items-center gap-2 '> | ||||||||||||||||||||||||||||||
| <span>Mover</span> | ||||||||||||||||||||||||||||||
| <span className='opacity-70'>M</span> | ||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||
| </PopoverItem> | ||||||||||||||||||||||||||||||
| <PopoverItem | ||||||||||||||||||||||||||||||
| onClick={() => { | ||||||||||||||||||||||||||||||
|
|
@@ -137,7 +152,10 @@ export const WorkflowControls = memo(function WorkflowControls() { | |||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||
| <Cursor className='size-3' /> | ||||||||||||||||||||||||||||||
| <span>Pointer</span> | ||||||||||||||||||||||||||||||
| <div className=' flex items-center gap-2 '> | ||||||||||||||||||||||||||||||
|
Comment on lines
143
to
+155
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||||||||
| <span>Pointer</span> | ||||||||||||||||||||||||||||||
| <span className='opacity-70'>P</span> | ||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||
| </PopoverItem> | ||||||||||||||||||||||||||||||
| </PopoverContent> | ||||||||||||||||||||||||||||||
| </Popover> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.