Skip to content

Commit d0d91f0

Browse files
author
minjk-bl
committed
Add else on/off to while block
1 parent 043bb77 commit d0d91f0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

js/MainFrame.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ define([
386386
if (parentBlock == null) {
387387
parentBlock = newBlock; // set parent block of created block
388388
} else {
389-
if (prevBlock != null && !newBlock.isGroup) {
389+
if (!(blockState && blockState.depth != undefined) && prevBlock != null && !newBlock.isGroup) {
390390
let newDepth = prevBlock.getChildDepth();
391391
if (tmpState && tmpState.relativeDepth) {
392392
newDepth = parentBlock.getChildDepth() + tmpState.relativeDepth;
@@ -523,7 +523,6 @@ define([
523523

524524
];
525525
break;
526-
break;
527526
case 'lgCtrl_for':
528527
case 'lgCtrl_while':
529528
case 'lgCtrl_if':

js/board/Block.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ define([
164164

165165
// template for block button
166166
let { elseFlag, finallyFlag } = this.state;
167-
if (taskId == 'lgCtrl_for') {
167+
if (taskId == 'lgCtrl_for' || taskId == 'lgCtrl_while') {
168168
page.appendLine('<div class="vp-block-button-group">');
169169
page.appendFormatLine('<div class="vp-block-button {0}" data-menu="{1}">{2}</div>', 'else', 'else', 'else ' + (elseFlag?'off':'on'));
170170
page.appendLine('</div>');

0 commit comments

Comments
 (0)