Browse Source

fix: shortcut conflicts

Konstantinos Kaloutas 3 years ago
parent
commit
bd19e05490

+ 2 - 2
tldraw/apps/tldraw-logseq/src/components/ZoomMenu/ZoomMenu.tsx

@@ -23,7 +23,7 @@ export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
           Zoom to fit
           <div className="tl-menu-right-slot">
             <span className="keyboard-shortcut">
-              <code>1</code>
+              <code>⇧</code> <code>1</code>
             </span>
           </div>
         </DropdownMenuPrimitive.Item>
@@ -35,7 +35,7 @@ export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
           Zoom to selection
           <div className="tl-menu-right-slot">
             <span className="keyboard-shortcut">
-              <code>⇧</code> <code>1</code>
+              <code>{MOD_KEY}</code> <code>⇧</code> <code>1</code>
             </span>
           </div>
         </DropdownMenuPrimitive.Item>

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/BoxTool.tsx

@@ -4,6 +4,6 @@ import { BoxShape, type Shape } from '../shapes'
 
 export class BoxTool extends TLBoxTool<BoxShape, Shape, TLReactEventMap> {
   static id = 'box'
-  static shortcut = ['r']
+  static shortcut = ['8']
   Shape = BoxShape
 }

+ 0 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/DotTool.tsx

@@ -4,6 +4,5 @@ import { DotShape, type Shape } from '../shapes'
 
 export class DotTool extends TLDotTool<DotShape, Shape, TLReactEventMap> {
   static id = 'dot'
-  static shortcut = ['t']
   Shape = DotShape
 }

+ 0 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/EllipseTool.tsx

@@ -4,6 +4,5 @@ import { EllipseShape, type Shape } from '../shapes'
 
 export class EllipseTool extends TLBoxTool<EllipseShape, Shape, TLReactEventMap> {
   static id = 'ellipse'
-  static shortcut = ['o']
   Shape = EllipseShape
 }

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/EraseTool.tsx

@@ -4,5 +4,5 @@ import type { Shape } from '../shapes'
 
 export class NuEraseTool extends TLEraseTool<Shape, TLReactEventMap> {
   static id = 'erase'
-  static shortcut = ['e']
+  static shortcut = ['5']
 }

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/HighlighterTool.tsx

@@ -4,7 +4,7 @@ import { HighlighterShape, type Shape } from '../shapes'
 
 export class HighlighterTool extends TLDrawTool<HighlighterShape, Shape, TLReactEventMap> {
   static id = 'highlighter'
-  static shortcut = ['m']
+  static shortcut = ['4']
   Shape = HighlighterShape
   simplify = true
   simplifyTolerance = 0.618

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/LineTool.tsx

@@ -6,6 +6,6 @@ import { LineShape, type Shape } from '../shapes'
 export class LineTool extends TLLineTool<LineShape, Shape, TLReactEventMap> {
   static id = 'line'
   // not sure why "c" is not working in Logseq?
-  static shortcut = ['c', 'x']
+  static shortcut = ['6']
   Shape = LineShape
 }

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/LogseqPortalTool/LogseqPortalTool.tsx

@@ -9,7 +9,7 @@ export class LogseqPortalTool extends TLTool<
   TLApp<Shape, TLReactEventMap>
 > {
   static id = 'logseq-portal'
-  static shortcut = ['l']
+  static shortcut = ['9']
   static states = [IdleState, CreatingState]
   static initial = 'idle'
 

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/PencilTool.tsx

@@ -4,7 +4,7 @@ import { PencilShape, type Shape } from '../shapes'
 
 export class PencilTool extends TLDrawTool<PencilShape, Shape, TLReactEventMap> {
   static id = 'pencil'
-  static shortcut = ['d', 'p']
+  static shortcut = ['3']
   Shape = PencilShape
   simplify = false
 }

+ 0 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/PolygonTool.tsx

@@ -4,6 +4,5 @@ import { PolygonShape, type Shape } from '../shapes'
 
 export class PolygonTool extends TLBoxTool<PolygonShape, Shape, TLReactEventMap> {
   static id = 'polygon'
-  static shortcut = ['g']
   Shape = PolygonShape
 }

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/TextTool.tsx

@@ -4,6 +4,6 @@ import { TextShape, type Shape } from '../shapes'
 
 export class TextTool extends TLTextTool<TextShape, Shape, TLReactEventMap> {
   static id = 'text'
-  static shortcut = ['t']
+  static shortcut = ['7']
   Shape = TextShape
 }

+ 0 - 1
tldraw/apps/tldraw-logseq/src/lib/tools/YouTubeTool.tsx

@@ -4,7 +4,6 @@ import { YouTubeShape, type Shape } from '../shapes'
 
 export class YouTubeTool extends TLBoxTool<YouTubeShape, Shape, TLReactEventMap> {
   static id = 'youtube'
-  static shortcut = ['y']
   Shape = YouTubeShape
 }
 

+ 3 - 3
tldraw/packages/core/src/lib/TLApp/TLApp.ts

@@ -98,11 +98,11 @@ export class TLApp<
         fn: () => this.api.resetZoom(),
       },
       {
-        keys: '1',
+        keys: 'shift+1',
         fn: () => this.api.zoomToFit(),
       },
       {
-        keys: 'shift+1',
+        keys: 'mod+shift+1',
         fn: () => this.api.zoomToSelection(),
       },
       {
@@ -920,7 +920,7 @@ export class TLApp<
   }
 
   readonly onWheel: TLEvents<S, K>['wheel'] = (info, e) => {
-    if (e.ctrlKey || this.isIn('select.contextMenu')) {
+    if (e.ctrlKey || e.metaKey || this.isIn('select.contextMenu')) {
       return
     }
 

+ 1 - 1
tldraw/packages/core/src/lib/tools/TLMoveTool/TLMoveTool.ts

@@ -10,7 +10,7 @@ export class TLMoveTool<
   R extends TLApp<S, K> = TLApp<S, K>
 > extends TLTool<S, K, R> {
   static id = 'move'
-  static shortcut = ['h']
+  static shortcut = ['2']
 
   static states = [IdleState, IdleHoldState, PanningState, PinchingState]
 

+ 1 - 1
tldraw/packages/core/src/lib/tools/TLSelectTool/TLSelectTool.tsx

@@ -33,7 +33,7 @@ export class TLSelectTool<
 
   static initial = 'idle'
 
-  static shortcut = ['v']
+  static shortcut = ['1']
 
   static states = [
     IdleState,