@@ -55,14 +55,22 @@ export class WorkspaceMovement {
5555 callback : ( workspace ) => this . moveWSCursor ( workspace , 0 , - 1 ) ,
5656 keyCodes : [ createSerializedKey ( KeyCodes . W , [ KeyCodes . SHIFT ] ) ] ,
5757 } ,
58-
58+
5959 /** Move the cursor on the workspace down. */
6060 {
6161 name : Constants . SHORTCUT_NAMES . MOVE_WS_CURSOR_DOWN ,
6262 preconditionFn : ( workspace ) => this . canCurrentlyEdit ( workspace ) ,
6363 callback : ( workspace ) => this . moveWSCursor ( workspace , 0 , 1 ) ,
6464 keyCodes : [ createSerializedKey ( KeyCodes . S , [ KeyCodes . SHIFT ] ) ] ,
6565 } ,
66+
67+ /** Move the cursor to the workspace. */
68+ {
69+ name : Constants . SHORTCUT_NAMES . CREATE_WS_CURSOR ,
70+ preconditionFn : ( workspace ) => this . canCurrentlyEdit ( workspace ) ,
71+ callback : ( workspace ) => this . createWSCursor ( workspace ) ,
72+ keyCodes : [ KeyCodes . W ] ,
73+ } ,
6674 ] ;
6775
6876 /**
@@ -114,4 +122,22 @@ export class WorkspaceMovement {
114122 ) ;
115123 return true ;
116124 }
125+
126+ /**
127+ * Moves the cursor to the workspace near the origin.
128+ *
129+ * @param workspace The workspace the cursor is on.
130+ */
131+ createWSCursor ( workspace : WorkspaceSvg ) {
132+ const workspaceNode = ASTNode . createWorkspaceNode (
133+ workspace ,
134+ new BlocklyUtils . Coordinate ( 10 , 10 ) ,
135+ ) ;
136+ const cursor = workspace . getCursor ( ) ;
137+
138+ if ( ! cursor || ! workspaceNode ) return false ;
139+
140+ cursor . setCurNode ( workspaceNode ) ;
141+ return true ;
142+ }
117143}
0 commit comments