File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class KeyboardNavigation {
29
29
navigationController . setHasAutoNavigationEnabled ( true ) ;
30
30
navigationController . listShortcuts ( ) ;
31
31
32
+ this . setGlowTheme ( ) ;
32
33
installCursor ( workspace . getMarkerManager ( ) ) ;
33
34
34
35
// Ensure that only the root SVG group has a tab index.
@@ -41,4 +42,21 @@ export class KeyboardNavigation {
41
42
navigationController . setHasFocus ( false ) ;
42
43
} ) ;
43
44
}
45
+
46
+ /**
47
+ * Update the theme to match the selected glow colour to the cursor
48
+ * colour.
49
+ */
50
+ setGlowTheme ( ) {
51
+ const newTheme = Blockly . Theme . defineTheme ( 'zelosDerived' ,
52
+ {
53
+ name : 'zelosDerived' ,
54
+ base : Blockly . Themes . Zelos ,
55
+ componentStyles : {
56
+ selectedGlowColour : '#ffa200' ,
57
+ }
58
+ }
59
+ ) ;
60
+ this . workspace . setTheme ( newTheme ) ;
61
+ }
44
62
}
Original file line number Diff line number Diff line change @@ -409,6 +409,35 @@ export class LineCursor extends Marker {
409
409
}
410
410
return this . getRightMostChild ( newNode ) ;
411
411
}
412
+
413
+ /**
414
+ * Set the location of the marker and call the update method.
415
+ * Setting isStack to true will only work if the newLocation is the top most
416
+ * output or previous connection on a stack.
417
+ *
418
+ * Overrides drawing logic to call `setSelected` if the location is
419
+ * a block, for testing on October 28 2024.
420
+ *
421
+ * @param newNode The new location of the marker.
422
+ */
423
+ setCurNode ( newNode : ASTNode ) {
424
+ const oldNode = ( this as any ) . curNode ;
425
+ ( this as any ) . curNode = newNode ;
426
+ const drawer = ( this as any ) . drawer ;
427
+ if ( newNode ?. getType ( ) == ASTNode . types . BLOCK ) {
428
+ if ( drawer ) {
429
+ drawer . hide ( ) ;
430
+ }
431
+ const block = newNode . getLocation ( ) as Blockly . BlockSvg ;
432
+ Blockly . common . setSelected ( block ) ;
433
+ } else if ( drawer ) {
434
+ if ( oldNode ?. getType ( ) == ASTNode . types . BLOCK ) {
435
+ Blockly . common . setSelected ( null ) ;
436
+ }
437
+
438
+ drawer . draw ( oldNode , newNode ) ;
439
+ }
440
+ }
412
441
}
413
442
414
443
export const registrationName = 'LineCursor' ;
You can’t perform that action at this time.
0 commit comments