@@ -17,10 +17,7 @@ const KeyCodes = BlocklyUtils.KeyCodes;
1717 * Class for registering shortcuts for navigating the workspace with arrow keys.
1818 */
1919export class ArrowNavigation {
20- constructor (
21- private navigation : Navigation ,
22- private canCurrentlyNavigate : ( ws : WorkspaceSvg ) => boolean ,
23- ) { }
20+ constructor ( private navigation : Navigation ) { }
2421
2522 /**
2623 * Gives the cursor to the field to handle if the cursor is on a field.
@@ -56,7 +53,8 @@ export class ArrowNavigation {
5653 /** Go to the next location to the right. */
5754 right : {
5855 name : Constants . SHORTCUT_NAMES . RIGHT ,
59- preconditionFn : ( workspace ) => this . canCurrentlyNavigate ( workspace ) ,
56+ preconditionFn : ( workspace ) =>
57+ this . navigation . canCurrentlyNavigate ( workspace ) ,
6058 callback : ( workspace , e , shortcut ) => {
6159 const toolbox = workspace . getToolbox ( ) as Toolbox ;
6260 let isHandled = false ;
@@ -93,7 +91,8 @@ export class ArrowNavigation {
9391 /** Go to the next location to the left. */
9492 left : {
9593 name : Constants . SHORTCUT_NAMES . LEFT ,
96- preconditionFn : ( workspace ) => this . canCurrentlyNavigate ( workspace ) ,
94+ preconditionFn : ( workspace ) =>
95+ this . navigation . canCurrentlyNavigate ( workspace ) ,
9796 callback : ( workspace , e , shortcut ) => {
9897 const toolbox = workspace . getToolbox ( ) as Toolbox ;
9998 let isHandled = false ;
@@ -128,7 +127,8 @@ export class ArrowNavigation {
128127 /** Go down to the next location. */
129128 down : {
130129 name : Constants . SHORTCUT_NAMES . DOWN ,
131- preconditionFn : ( workspace ) => this . canCurrentlyNavigate ( workspace ) ,
130+ preconditionFn : ( workspace ) =>
131+ this . navigation . canCurrentlyNavigate ( workspace ) ,
132132 callback : ( workspace , e , shortcut ) => {
133133 const toolbox = workspace . getToolbox ( ) as Toolbox ;
134134 const flyout = workspace . getFlyout ( ) ;
@@ -169,7 +169,8 @@ export class ArrowNavigation {
169169 /** Go up to the previous location. */
170170 up : {
171171 name : Constants . SHORTCUT_NAMES . UP ,
172- preconditionFn : ( workspace ) => this . canCurrentlyNavigate ( workspace ) ,
172+ preconditionFn : ( workspace ) =>
173+ this . navigation . canCurrentlyNavigate ( workspace ) ,
173174 callback : ( workspace , e , shortcut ) => {
174175 const flyout = workspace . getFlyout ( ) ;
175176 const toolbox = workspace . getToolbox ( ) as Toolbox ;
0 commit comments