chore: remove old render management system (#7308)

This commit is contained in:
Beka Westberg
2023-07-27 16:08:45 -07:00
committed by GitHub
parent 5151889f13
commit 7118dd3e4f
2 changed files with 17 additions and 50 deletions

View File

@@ -1549,44 +1549,14 @@ export class BlockSvg
* Immediately lays out and reflows a block based on its contents and
* settings.
*
* @param opt_bubble If false, just render this block.
* If true, also render block's parent, grandparent, etc. Defaults to true.
* @deprecated Renders are triggered automatically when the block is modified
* (e.g. fields are modified or inputs are added). Any calls to render()
* are no longer necessary. To be removed in v11.
*/
render(opt_bubble?: boolean) {
if (this.renderIsInProgress_) {
return; // Don't allow recursive renders.
}
this.renderIsInProgress_ = true;
try {
this.rendered = true;
dom.startTextWidthCache();
if (!this.isEnabled()) {
// Apply disabled styles if needed.
this.updateDisabled();
}
if (this.isCollapsed()) {
this.updateCollapsed_();
}
this.workspace.getRenderer().render(this);
this.updateConnectionAndIconLocations();
if (opt_bubble !== false) {
const parentBlock = this.getParent();
if (parentBlock) {
parentBlock.render(true);
} else {
// Top-most block. Fire an event to allow scrollbars to resize.
this.workspace.resizeContents();
}
}
dom.stopTextWidthCache();
this.updateMarkers_();
} finally {
this.renderIsInProgress_ = false;
}
render() {
deprecation.warn('Blockly.BlockSvg.prototype.render', 'v10', 'v11');
this.queueRender();
renderManagement.triggerQueuedRenders();
}
/**

View File

@@ -78,6 +78,7 @@ import * as Xml from './xml.js';
import {ZoomControls} from './zoom_controls.js';
import {ContextMenuOption} from './contextmenu_registry.js';
import * as renderManagement from './render_management.js';
import * as deprecation from './utils/deprecation.js';
/** Margin around the top/bottom/left/right after a zoomToFit call. */
const ZOOM_TO_FIT_MARGIN = 20;
@@ -1224,24 +1225,20 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
// Currently does not support toolboxes in mutators.
this.toolbox_.setVisible(isVisible);
}
if (isVisible) {
const blocks = this.getAllBlocks(false);
// Tell each block on the workspace to mark its fields as dirty.
for (let i = blocks.length - 1; i >= 0; i--) {
blocks[i].markDirty();
}
this.render();
if (this.toolbox_) {
this.toolbox_.position();
}
} else {
if (!isVisible) {
this.hideChaff(true);
}
}
/** Render all blocks in workspace. */
/**
* Render all blocks in workspace.
*
* @deprecated Renders are triggered automatically when the block is modified
* (e.g. fields are modified or inputs are added). Any calls to render()
* are no longer necessary. To be removed in v11.
*/
render() {
deprecation.warn('Blockly.WorkspaceSvg.prototype.render', 'v10', 'v11');
// Generate list of all blocks.
const blocks = this.getAllBlocks(false);
// Render each block.