fix:shortcut for changing hand and cursor mode by Rjshakya · Pull Request #5131 · simstudioai/sim · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/utils/commands-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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={() => {
Expand All @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Both className strings have stray whitespace — the first has a trailing space and the second has both a leading and trailing space. These are harmless but inconsistent with the surrounding code style.

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>
Expand Down