File tree Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Expand file tree Collapse file tree 2 files changed +48
-2
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,7 @@ define([
372
372
if ( OptionComponent ) {
373
373
let taskState = menuState . taskState ;
374
374
let blockState = menuState . blockState ;
375
+ let tmpState = menuState . tmpState ;
375
376
let state = {
376
377
...taskState ,
377
378
config : menuConfig
@@ -386,9 +387,14 @@ define([
386
387
parentBlock = newBlock ; // set parent block of created block
387
388
} else {
388
389
if ( prevBlock != null && ! newBlock . isGroup ) {
389
- newBlock . setDepth ( prevBlock . getChildDepth ( ) ) ;
390
+ let newDepth = prevBlock . getChildDepth ( ) ;
391
+ if ( tmpState && tmpState . relativeDepth ) {
392
+ newDepth = parentBlock . getChildDepth ( ) + tmpState . relativeDepth ;
393
+ }
394
+ newBlock . setDepth ( newDepth ) ;
390
395
}
391
396
}
397
+ vpLog . display ( VP_LOG_TYPE . DEVELOP , 'new block ' + position + ' with depth ' + newBlock . depth ) ;
392
398
prevBlock = newBlock ;
393
399
} else {
394
400
// add to task list
@@ -485,10 +491,42 @@ define([
485
491
}
486
492
]
487
493
break ;
494
+ case 'lgCtrl_try' :
495
+ childBlocks = [
496
+ {
497
+ menuId : 'lgCtrl_pass' ,
498
+ menuState : {
499
+ blockState : {
500
+ isGroup : false
501
+ }
502
+ }
503
+ } ,
504
+ {
505
+ menuId : 'lgCtrl_except' ,
506
+ menuState : {
507
+ blockState : {
508
+ isGroup : false
509
+ } ,
510
+ tmpState : {
511
+ relativeDepth : - 1
512
+ }
513
+ }
514
+ } ,
515
+ {
516
+ menuId : 'lgCtrl_pass' ,
517
+ menuState : {
518
+ blockState : {
519
+ isGroup : false
520
+ }
521
+ }
522
+ }
523
+
524
+ ] ;
525
+ break ;
526
+ break ;
488
527
case 'lgCtrl_for' :
489
528
case 'lgCtrl_while' :
490
529
case 'lgCtrl_if' :
491
- case 'lgCtrl_try' :
492
530
case 'lgCtrl_elif' :
493
531
case 'lgCtrl_except' :
494
532
case 'lgCtrl_else' :
Original file line number Diff line number Diff line change @@ -768,6 +768,10 @@ define([
768
768
if ( elseBlock . length > 0 ) {
769
769
this . removeBlock ( elseBlock [ 0 ] ) ;
770
770
}
771
+ // focus it
772
+ setTimeout ( function ( ) {
773
+ block . focusItem ( ) ;
774
+ } , 100 ) ;
771
775
}
772
776
}
773
777
@@ -800,6 +804,10 @@ define([
800
804
if ( finallyBlock ) {
801
805
this . removeBlock ( finallyBlock ) ;
802
806
}
807
+ // focus it
808
+ setTimeout ( function ( ) {
809
+ block . focusItem ( ) ;
810
+ } , 100 ) ;
803
811
}
804
812
}
805
813
You can’t perform that action at this time.
0 commit comments