From 4a69c650ffbc3d819847824e89a2bc241b2765bf Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 8 Oct 2020 00:22:42 +0200 Subject: [PATCH] enabled "result pic" for command scripts containing a "report" block --- HISTORY.md | 6 +++++- snap.html | 4 ++-- src/blocks.js | 37 +++++++++++++++++++------------------ src/threads.js | 4 ++-- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 66b2fd21..dacedb71 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,6 +12,7 @@ * new "48 kHz" option in the "sampling rate" dropdown * made (hidden) "Blurred shadows" setting persistent, use to get rid of "red bar" artifacts on old laptops using Chrome * increased area / sensitivity for collapsing variadic input slots + * enabled "result pic" for command scripts containing a "report" block * **Notable Fixes:** * "append" block now shows up when searching for it * disable blurred shadows inside input slots if the hidden "blurred shadows" setting is turned off, use this setting on old laptops displaying "red bars" in Chrome @@ -19,6 +20,9 @@ * Greek, thanks, HM100! * German +### 2020-10-08 +* blocks: enabled "result pic" for command scripts containing a "report" block + ### 2020-10-07 * byob: added "settings" button to input slot dialog * symbols: added "gearPartial" icon @@ -26,7 +30,7 @@ * blocks: increased area / sensitivity for collapsing variadic input slots * blocks: tweaked expanding variadic inputs * blocks: reverted sensitivity tweaks for variadic inputs -* blocks: reintroduced a different approach for making it easier to collapse variadic inputs +* blocks, threads: reintroduced a different approach for making it easier to collapse variadic inputs ### 2020-10-06 * blocks: disable blurred shadows inside input slots if the hidden "blurred shadows" setting is turned off diff --git a/snap.html b/snap.html index 0f17b523..049ddbb8 100755 --- a/snap.html +++ b/snap.html @@ -8,8 +8,8 @@ - - + + diff --git a/src/blocks.js b/src/blocks.js index 3d43a0c4..b7f7587e 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2020-October-07'; +modules.blocks = '2020-October-08'; var SyntaxElementMorph; var BlockMorph; @@ -3072,7 +3072,8 @@ BlockMorph.prototype.userMenu = function () { }, 'save a picture\nof this script' ); - if (top instanceof ReporterBlockMorph) { + if (top instanceof ReporterBlockMorph || + top.allChildren().some((any) => any.selector === 'doReport')) { // +++ menu.addItem( "result pic...", () => top.exportResultPic(), @@ -3636,6 +3637,22 @@ BlockMorph.prototype.showHelp = function () { pic.src = ide.resourceURL('help', spec + '.png'); }; +// BlockMorph exporting picture with result bubble + +BlockMorph.prototype.exportResultPic = function () { + var top = this.topBlock(), + receiver = top.scriptTarget(), + stage; + if (top !== this) {return; } + if (receiver) { + stage = receiver.parentThatIsA(StageMorph); + if (stage) { + stage.threads.stopProcess(top); + stage.threads.startProcess(top, receiver, false, true); + } + } +}; + // BlockMorph code mapping /* @@ -6024,22 +6041,6 @@ ReporterBlockMorph.prototype.mouseClickLeft = function (pos) { } }; -// ReporterBlock exporting picture with result bubble - -ReporterBlockMorph.prototype.exportResultPic = function () { - var top = this.topBlock(), - receiver = top.scriptTarget(), - stage; - if (top !== this) {return; } - if (receiver) { - stage = receiver.parentThatIsA(StageMorph); - if (stage) { - stage.threads.stopProcess(top); - stage.threads.startProcess(top, receiver, false, true); - } - } -}; - // ReporterBlockMorph deleting ReporterBlockMorph.prototype.userDestroy = function () { diff --git a/src/threads.js b/src/threads.js index 2ee1a210..cf9561c9 100644 --- a/src/threads.js +++ b/src/threads.js @@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map, isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK, TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/ -modules.threads = '2020-October-05'; +modules.threads = '2020-October-08'; var ThreadManager; var Process; @@ -375,7 +375,7 @@ ThreadManager.prototype.removeTerminatedProcesses = function () { } } if (proc.topBlock instanceof ReporterBlockMorph || - proc.isShowingResult) { + proc.isShowingResult || proc.exportResult) { result = proc.homeContext.inputs[0]; if (proc.onComplete instanceof Function) { proc.onComplete(result);