From 8c5c33902be681233b5092dd7bd3267c80d57e7a Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Thu, 5 Mar 2020 13:26:10 -0800 Subject: [PATCH] Flash on render (#3721) * Flash a block when it's renderered in debug mode --- core/block_svg.js | 3 +- core/renderers/common/constants.js | 56 ++++++++++++++++++++++++++++++ core/renderers/common/debugger.js | 22 +++++++++++- tests/playground.html | 12 +++++++ 4 files changed, 91 insertions(+), 2 deletions(-) diff --git a/core/block_svg.js b/core/block_svg.js index fe9815d6b..911712058 100644 --- a/core/block_svg.js +++ b/core/block_svg.js @@ -1645,7 +1645,8 @@ Blockly.BlockSvg.prototype.getRootBlock = function() { Blockly.BlockSvg.prototype.render = function(opt_bubble) { Blockly.utils.dom.startTextWidthCache(); this.rendered = true; - (/** @type {!Blockly.WorkspaceSvg} */ (this.workspace)).getRenderer().render(this); + (/** @type {!Blockly.WorkspaceSvg} */ (this.workspace)) + .getRenderer().render(this); // No matter how we rendered, connection locations should now be correct. this.updateConnectionLocations_(); if (opt_bubble !== false) { diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index 727b601fd..be6e8a50e 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -18,6 +18,8 @@ goog.require('Blockly.utils.dom'); goog.require('Blockly.utils.svgPaths'); goog.require('Blockly.utils.userAgent'); +goog.requireType('Blockly.blockRendering.Debug'); + /** * An object that provides constants for rendering blocks. @@ -440,6 +442,20 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.disabledPattern_ = null; + /** + * The ID of the debug filter, or the empty string if no pattern is set. + * @type {string} + * @package + */ + this.debugFilterId = ''; + + /** + * The element to use for a debug highlight, or null if not set. + * @type {SVGElement} + * @private + */ + this.debugFilter_ = null; + /** * The