Skip to content

Commit

Permalink
fix: revert "Delete events should animate when played (google#5919)" (g…
Browse files Browse the repository at this point in the history
…oogle#6031)

* Revert "Delete events should animate when played (google#5919)"

This reverts commit bce4c5e.

* fix: lint in screenshot
  • Loading branch information
BeksOmega authored Mar 29, 2022
1 parent 2cf8eb8 commit c4a25eb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 25 deletions.
3 changes: 1 addition & 2 deletions core/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 1 addition & 9 deletions core/events/events_block_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;
}
Expand All @@ -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'];
}
Expand All @@ -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);
Expand Down
10 changes: 1 addition & 9 deletions core/events/events_block_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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;
}
Expand All @@ -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'];
}
Expand All @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions tests/mocha/event_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
ui: true,
}),
},
{
Expand All @@ -491,7 +490,6 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
ui: true,
recordUndo: false,
}),
},
Expand All @@ -513,7 +511,6 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
ui: true,
}),
},
{
Expand All @@ -534,7 +531,6 @@ suite('Events', function() {
'x': 0,
'y': 0,
},
ui: true,
recordUndo: false,
}),
},
Expand Down
2 changes: 1 addition & 1 deletion tests/playgrounds/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ function downloadScreenshot(workspace) {
a.click();
a.parentNode.removeChild(a);
});
};
}

0 comments on commit c4a25eb

Please sign in to comment.