Skip to content

Commit dbe3e70

Browse files
authored
fix(hotkey): assign t as hotkey to create text element (#192)
1 parent da73958 commit dbe3e70

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/drawnix/src/components/shape-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const SHAPES: ShapeProps[] = [
3737
},
3838
{
3939
icon: TriangleIcon,
40-
title: 'Triangle — T',
40+
title: 'Triangle',
4141
pointer: BasicShapes.triangle,
4242
},
4343
{

packages/drawnix/src/components/toolbar/creation-toolbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const BUTTONS: AppToolButtonProps[] = [
7979
{
8080
icon: TextIcon,
8181
pointer: BasicShapes.text,
82-
title: 'Text',
82+
title: 'Text — T',
8383
},
8484
{
8585
icon: FeltTipPenIcon,

packages/drawnix/src/plugins/with-hotkey.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,13 @@ export const buildDrawnixHotkeyPlugin = (
7070
const keyToPointer = {
7171
r: BasicShapes.rectangle,
7272
o: BasicShapes.ellipse,
73-
t: BasicShapes.triangle,
73+
t: BasicShapes.text,
7474
};
75-
setCreationMode(board, BoardCreationMode.drawing);
75+
if (keyToPointer[event.key] === BasicShapes.text) {
76+
setCreationMode(board, BoardCreationMode.dnd);
77+
} else {
78+
setCreationMode(board, BoardCreationMode.drawing);
79+
}
7680
BoardTransforms.updatePointerType(board, keyToPointer[event.key]);
7781
updateAppState({ pointer: keyToPointer[event.key] });
7882
}

0 commit comments

Comments
 (0)