File tree Expand file tree Collapse file tree 5 files changed +5
-9
lines changed Expand file tree Collapse file tree 5 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ export class EnterAction {
128128 */
129129 private insertFromFlyout ( workspace : WorkspaceSvg ) {
130130 workspace . setResizesEnabled ( false ) ;
131+ // Create a new event group or append to the existing group.
131132 const existingGroup = Events . getGroup ( ) ;
132133 if ( ! existingGroup ) {
133134 Events . setGroup ( true ) ;
Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ export class MoveActions {
199199 const curNode = workspace ?. getCursor ( ) ?. getCurNode ( ) ;
200200 let block = curNode ?. getSourceBlock ( ) ;
201201 if ( ! block ) return undefined ;
202- while ( block && block . isShadow ( ) ) {
202+ while ( block ? .isShadow ( ) ) {
203203 block = block . getParent ( ) ;
204204 if ( ! block ) {
205205 throw new Error (
Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ export class Mover {
206206 info . startLocation ,
207207 ) ;
208208
209- if ( target ) {
209+ if ( dragStrategy . isNewBlock && target ) {
210210 const newNode = ASTNode . createConnectionNode ( target ) ;
211211 if ( newNode ) workspace . getCursor ( ) ?. setCurNode ( newNode ) ;
212212 }
Original file line number Diff line number Diff line change 55 */
66
77import {
8- common ,
98 ASTNode ,
109 BlockSvg ,
1110 ConnectionType ,
@@ -52,8 +51,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
5251
5352 override startDrag ( e ?: PointerEvent ) {
5453 if ( ! this . cursor ) throw new Error ( 'precondition failure' ) ;
55- // Select and focus block.
56- common . setSelected ( this . block ) ;
5754 this . cursor . setCurNode ( ASTNode . createBlockNode ( this . block ) ) ;
5855 super . startDrag ( e ) ;
5956 // Set position of the dragging block, so that it doesn't pop
@@ -166,8 +163,6 @@ export class KeyboardDragStrategy extends dragging.BlockDragStrategy {
166163 draggingBlock : BlockSvg ,
167164 localConns : RenderedConnection [ ] ,
168165 ) : ConnectionCandidate | null {
169- // TODO: Handle the case where the cursor is null, or never return null
170- // from workspace.getCursor()
171166 if ( ! this . cursor ) throw new Error ( 'precondition failure' ) ;
172167
173168 // Helper function for traversal.
Original file line number Diff line number Diff line change @@ -770,8 +770,7 @@ export class Navigation {
770770 *
771771 * @param stationaryNode The first node to connect.
772772 * @param movingBlock The block we're moving.
773- * @returns True if the key was handled; false if something went
774- * wrong.
773+ * @returns True if the connection was successful, false otherwise.
775774 */
776775 tryToConnectBlock (
777776 stationaryNode : Blockly . ASTNode ,
@@ -784,6 +783,7 @@ export class Navigation {
784783 if ( ! destConnection ) return false ;
785784 return this . insertBlock ( movingBlock , destConnection ) ;
786785 }
786+
787787 /**
788788 * Disconnects the block from its parent and moves it to the position of the
789789 * workspace node.
You can’t perform that action at this time.
0 commit comments