fix: implement T key for counter-clockwise rotation on selected nodes
The keyboard shortcuts dialog documents T as counter-clockwise rotation, and it works during placement/move mode, but was missing for already selected nodes. R (clockwise) worked in all contexts but T did not.
This commit is contained in:
@@ -114,6 +114,25 @@ export const useKeyboard = () => {
|
||||
sfxEmitter.emit('sfx:item-rotate') // Play a sound for feedback
|
||||
}
|
||||
}
|
||||
} else if (e.key === 't' || e.key === 'T') {
|
||||
// Rotate selected node counter-clockwise
|
||||
const selectedNodeIds = useViewer.getState().selection.selectedIds as AnyNodeId[]
|
||||
if (selectedNodeIds.length === 1) {
|
||||
const node = useScene.getState().nodes[selectedNodeIds[0]!]
|
||||
if (node && 'rotation' in node) {
|
||||
e.preventDefault()
|
||||
const ROTATION_STEP = Math.PI / 4
|
||||
|
||||
if (typeof node.rotation === 'number') {
|
||||
useScene.getState().updateNode(node.id, { rotation: node.rotation - ROTATION_STEP })
|
||||
} else if (Array.isArray(node.rotation)) {
|
||||
useScene.getState().updateNode(node.id, {
|
||||
rotation: [node.rotation[0], node.rotation[1] - ROTATION_STEP, node.rotation[2]],
|
||||
})
|
||||
}
|
||||
sfxEmitter.emit('sfx:item-rotate')
|
||||
}
|
||||
}
|
||||
} else if (e.key === 'Delete' || e.key === 'Backspace') {
|
||||
e.preventDefault()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user