From 526c75d5f50c7dd5e2f2a92a45dd71cede962fb4 Mon Sep 17 00:00:00 2001 From: sksum <55449862+sksum@users.noreply.github.com> Date: Mon, 17 Aug 2020 15:16:48 +0530 Subject: [PATCH] conditional re-initialization --- js/block.js | 3 ++- js/blocks.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/block.js b/js/block.js index 056a49d663..f9abbc6cea 100644 --- a/js/block.js +++ b/js/block.js @@ -7800,7 +7800,8 @@ function Block(protoblock, blocks, overrideName) { case "mode": case "timbre": lockInit = true; - this.blocks.reInitWidget(topBlock, 5000); + if (this.blocks.blockList[topBlock].protoblock.staticLabels[0] == widgetTitle[i].innerHTML) + this.blocks.reInitWidget(topBlock, 1500); break; } } diff --git a/js/blocks.js b/js/blocks.js index 74b5d3ec6d..03c823e2d3 100644 --- a/js/blocks.js +++ b/js/blocks.js @@ -1651,7 +1651,8 @@ function Blocks(activity) { case "temperament": case "timbre": lockInit = true; - this.reInitWidget(initialTopBlock, 1500); + if (this.blockList[initialTopBlock].protoblock.staticLabels[0] == widgetTitle[x].innerHTML) + this.reInitWidget(initialTopBlock, 1500); break; } } @@ -2160,10 +2161,12 @@ function Blocks(activity) { case "temperament": case "timbre": lockInit = true; - this.reInitWidget( - that.findTopBlock(thisBlock), - 1500 - ); + let _newTopBlock = that.findTopBlock(thisBlock); + if (this.blockList[_newTopBlock].protoblock.staticLabels[0] == widgetTitle[i].innerHTML) + this.reInitWidget( + _newTopBlock, + 1500 + ); break; } }