mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
fix: improve performance of modifying block shape (#6884)
This commit is contained in:
@@ -1263,7 +1263,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
super.setPreviousStatement(newBoolean, opt_check);
|
||||
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
this.queueRender();
|
||||
this.bumpNeighbours();
|
||||
}
|
||||
}
|
||||
@@ -1280,7 +1280,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
super.setNextStatement(newBoolean, opt_check);
|
||||
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
this.queueRender();
|
||||
this.bumpNeighbours();
|
||||
}
|
||||
}
|
||||
@@ -1296,7 +1296,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
super.setOutput(newBoolean, opt_check);
|
||||
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
this.queueRender();
|
||||
this.bumpNeighbours();
|
||||
}
|
||||
}
|
||||
@@ -1310,7 +1310,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
super.setInputsInline(newBoolean);
|
||||
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
this.queueRender();
|
||||
this.bumpNeighbours();
|
||||
}
|
||||
}
|
||||
@@ -1346,7 +1346,7 @@ export class BlockSvg extends Block implements IASTNodeLocationSvg,
|
||||
super.moveNumberedInputBefore(inputIndex, refIndex);
|
||||
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
this.queueRender();
|
||||
// Moving an input will cause the block to change shape.
|
||||
this.bumpNeighbours();
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ export class Input {
|
||||
this.align = align;
|
||||
if (this.sourceBlock.rendered) {
|
||||
const sourceBlock = this.sourceBlock as BlockSvg;
|
||||
sourceBlock.render();
|
||||
sourceBlock.queueRender();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1114,6 +1114,7 @@ suite('Blocks', function() {
|
||||
const block = createRenderedBlock(this.workspace, 'empty_block');
|
||||
|
||||
block.setOutput(true);
|
||||
this.clock.runAll();
|
||||
|
||||
this.clock.runAll();
|
||||
chai.assert.equal(this.getOutputs().length, 1);
|
||||
@@ -1130,6 +1131,7 @@ suite('Blocks', function() {
|
||||
const block = createRenderedBlock(this.workspace, 'empty_block');
|
||||
|
||||
block.setPreviousStatement(true);
|
||||
this.clock.runAll();
|
||||
|
||||
this.clock.runAll();
|
||||
chai.assert.equal(this.getPrevious().length, 1);
|
||||
@@ -1138,6 +1140,7 @@ suite('Blocks', function() {
|
||||
const block = createRenderedBlock(this.workspace, 'empty_block');
|
||||
|
||||
block.setNextStatement(true);
|
||||
this.clock.runAll();
|
||||
|
||||
this.clock.runAll();
|
||||
chai.assert.equal(this.getNext().length, 1);
|
||||
|
||||
Reference in New Issue
Block a user