From c4a25eb3c432b0e8a9a18aae42839d163a177c48 Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 29 Mar 2022 11:47:50 -0700 Subject: [PATCH] fix: revert "Delete events should animate when played (#5919)" (#6031) * Revert "Delete events should animate when played (#5919)" This reverts commit bce4c5e2c61b3d3e8bbb99694af18f99dbfc4d50. * fix: lint in screenshot --- core/block.js | 3 +-- core/events/events_block_create.js | 10 +--------- core/events/events_block_delete.js | 10 +--------- tests/mocha/event_test.js | 4 ---- tests/playgrounds/screenshot.js | 2 +- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/core/block.js b/core/block.js index 7d367e7b397..ce8f274b69a 100644 --- a/core/block.js +++ b/core/block.js @@ -386,10 +386,9 @@ class Block { * @param {boolean} healStack If true, then try to heal any gap by connecting * the next statement with the previous statement. Otherwise, dispose of * all children of this block. - * @param {boolean=} _animate If true, show a disposal animation and sound. * @suppress {checkTypes} */ - dispose(healStack, _animate) { + dispose(healStack) { if (!this.workspace) { // Already deleted. return; diff --git a/core/events/events_block_create.js b/core/events/events_block_create.js index c632d1b7df6..6d3a033686b 100644 --- a/core/events/events_block_create.js +++ b/core/events/events_block_create.js @@ -54,12 +54,6 @@ class BlockCreate extends BlockBase { this.xml = Xml.blockToDomWithXY(opt_block); this.ids = eventUtils.getDescendantIds(opt_block); - /** - * Play UI effects (sound and animation)? - * @type {boolean} - */ - this.ui = true; - /** * JSON representation of the block that was just created. * @type {!blocks.State} @@ -77,7 +71,6 @@ class BlockCreate extends BlockBase { json['xml'] = Xml.domToText(this.xml); json['ids'] = this.ids; json['json'] = this.json; - json['ui'] = this.ui; if (!this.recordUndo) { json['recordUndo'] = this.recordUndo; } @@ -93,7 +86,6 @@ class BlockCreate extends BlockBase { this.xml = Xml.textToDom(json['xml']); this.ids = json['ids']; this.json = /** @type {!blocks.State} */ (json['json']); - this.ui = !!json['ui']; if (json['recordUndo'] !== undefined) { this.recordUndo = json['recordUndo']; } @@ -112,7 +104,7 @@ class BlockCreate extends BlockBase { const id = this.ids[i]; const block = workspace.getBlockById(id); if (block) { - block.dispose(false, this.ui); + block.dispose(false); } else if (id === this.blockId) { // Only complain about root-level block. console.warn('Can\'t uncreate non-existent block: ' + id); diff --git a/core/events/events_block_delete.js b/core/events/events_block_delete.js index 26f8578c2de..10b96dd6948 100644 --- a/core/events/events_block_delete.js +++ b/core/events/events_block_delete.js @@ -63,12 +63,6 @@ class BlockDelete extends BlockBase { */ this.wasShadow = opt_block.isShadow(); - /** - * Play UI effects (sound and animation)? - * @type {boolean} - */ - this.ui = true; - /** * JSON representation of the block that was just deleted. * @type {!blocks.State} @@ -87,7 +81,6 @@ class BlockDelete extends BlockBase { json['ids'] = this.ids; json['wasShadow'] = this.wasShadow; json['oldJson'] = this.oldJson; - json['ui'] = this.ui; if (!this.recordUndo) { json['recordUndo'] = this.recordUndo; } @@ -105,7 +98,6 @@ class BlockDelete extends BlockBase { this.wasShadow = json['wasShadow'] || this.oldXml.tagName.toLowerCase() === 'shadow'; this.oldJson = /** @type {!blocks.State} */ (json['oldJson']); - this.ui = !!json['ui']; if (json['recordUndo'] !== undefined) { this.recordUndo = json['recordUndo']; } @@ -122,7 +114,7 @@ class BlockDelete extends BlockBase { const id = this.ids[i]; const block = workspace.getBlockById(id); if (block) { - block.dispose(false, this.ui); + block.dispose(false); } else if (id === this.blockId) { // Only complain about root-level block. console.warn('Can\'t delete non-existent block: ' + id); diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index 2b57b8a980e..9ee53a68941 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -471,7 +471,6 @@ suite('Events', function() { 'x': 0, 'y': 0, }, - ui: true, }), }, { @@ -491,7 +490,6 @@ suite('Events', function() { 'x': 0, 'y': 0, }, - ui: true, recordUndo: false, }), }, @@ -513,7 +511,6 @@ suite('Events', function() { 'x': 0, 'y': 0, }, - ui: true, }), }, { @@ -534,7 +531,6 @@ suite('Events', function() { 'x': 0, 'y': 0, }, - ui: true, recordUndo: false, }), }, diff --git a/tests/playgrounds/screenshot.js b/tests/playgrounds/screenshot.js index 5842c9f3278..59d0594e280 100644 --- a/tests/playgrounds/screenshot.js +++ b/tests/playgrounds/screenshot.js @@ -105,4 +105,4 @@ function downloadScreenshot(workspace) { a.click(); a.parentNode.removeChild(a); }); -}; +}