@@ -32,6 +32,40 @@ export class MultiselectDraggable {
3232    this . dragSelection  =  dragSelectionWeakMap . get ( workspace ) ; 
3333  } 
3434
35+   canBeFocused ( )  { 
36+     return  true ; 
37+   } 
38+ 
39+   /** See IFocusableNode.getFocusableElement. */ 
40+   getFocusableElement ( )  { 
41+     return  this ; 
42+   } 
43+ 
44+   /** See IFocusableNode.getFocusableTree. */ 
45+   getFocusableTree ( )  { 
46+     return  this . workspace ; 
47+   } 
48+ 
49+   /** See IFocusableNode.onNodeFocus. */ 
50+   onNodeFocus ( )  { 
51+     // for (const id of this.dragSelection) { 
52+     //   const block = this.workspace.getBlockById(id); 
53+     //   if (block) { 
54+     //     block.addSelect(); 
55+     //   } 
56+     // } 
57+   } 
58+ 
59+   /** See IFocusableNode.onNodeBlur. */ 
60+   onNodeBlur ( )  { 
61+     // for (const id of this.dragSelection) { 
62+     //   const block = this.workspace.getBlockById(id); 
63+     //   if (block) { 
64+     //     block.removeSelect(); 
65+     //   } 
66+     // } 
67+   } 
68+ 
3569  /** 
3670   * Clears everything in the subDraggables 
3771   * map of the MultiselectDraggable object. 
@@ -71,14 +105,14 @@ export class MultiselectDraggable {
71105
72106  // This is the feature where we added a pointer down event listener. 
73107  // This was added to mitigate the issue of setStart[draggable] overwriting 
74-   // the call that passes the multidraggable to Blockly.common.SetSelected (). 
108+   // the call that passes the multidraggable to Blockly.getFocusManager().updateFocusedNode (). 
75109  // This should be updated/fixed when a more flexible gesture handling 
76110  // system is implemented. 
77111  // TODO: Look into these after gestures have been updated 
78112  /** 
79113   * Adds a pointer down event listener to a subdraggable to mitigate issue 
80114   * of setStart[draggable] overwriting the call that passes the 
81-    * multidraggable to Blockly.common.SetSelected (). 
115+    * multidraggable to Blockly.getFocusManager().updateFocusedNode (). 
82116   * @param  {Blockly.IDraggable } subDraggable A draggable object that will 
83117   * have an event listener added to 
84118   * @private  
@@ -101,7 +135,7 @@ export class MultiselectDraggable {
101135  /** 
102136   * Removes a pointer down event listener from a subdraggable to 
103137   * mitigate issue of setStart[draggable] overwriting the call that 
104-    *  passes the multidraggable to Blockly.common.SetSelected (). 
138+    *  passes the multidraggable to Blockly.getFocusManager().updateFocusedNode (). 
105139   * @param  {Blockly.IDraggable } subDraggable A draggable object 
106140   * that will have an event listener removed from 
107141   * @private  
@@ -122,13 +156,16 @@ export class MultiselectDraggable {
122156  /** 
123157   * The handler for the pointer down event that mitigates 
124158   * the issue of setStart[draggable] overwriting the call that 
125-    * passes the multidraggable to Blockly.common.SetSelected (). 
159+    * passes the multidraggable to Blockly.getFocusManager().updateFocusedNode (). 
126160   * @param  {PointerEvent } event A pointer down event 
127161   * @private  
128162   */ 
129163  pointerDownEventHandler_ ( event )  { 
130164    if  ( ! inMultipleSelectionModeWeakMap . get ( this . workspace ) )  { 
131-       Blockly . common . setSelected ( this ) ; 
165+       Blockly . getFocusManager ( ) . updateFocusedNode ( this ) ; 
166+       const  gesture  =  this . workspace . getGesture ( event ) ; 
167+       if  ( gesture ) 
168+         gesture . startBlock  =  this ; 
132169    } 
133170  } 
134171
@@ -266,12 +303,7 @@ export class MultiselectDraggable {
266303    // This needs to be worked on to see if we can make the 
267304    // highlighting of the subdraggables in real time. 
268305    for  ( const  draggable  of  this . subDraggables )  { 
269-       if  ( draggable [ 0 ]  instanceof  Blockly . BlockSvg  && 
270-           ! draggable [ 0 ] . isShadow ( ) )  { 
271-         draggable [ 0 ] . select ( ) ; 
272-       }  else  { 
273-         draggable [ 0 ] . select ( ) ; 
274-       } 
306+       draggable [ 0 ] . select ( ) ; 
275307    } 
276308  } 
277309
0 commit comments