From af84e6a40c4bc43f404dd9b6c0d670da7f015348 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Wed, 22 Jan 2020 11:07:45 -0800 Subject: [PATCH] Zelos rename highlightfilter (#3630) * Rename highlight filter to selected filter * Update comment --- core/renderers/zelos/constants.js | 36 ++++++++++++++--------------- core/renderers/zelos/path_object.js | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index f4ca8189d..460a86842 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -359,22 +359,22 @@ Blockly.zelos.ConstantProvider = function() { this.FIELD_CHECKBOX_DEFAULT_WIDTH = 6 * this.GRID_UNIT; /** - * The ID of the highlight glow filter, or the empty string if no filter is + * The ID of the selected glow filter, or the empty string if no filter is * set. * @type {string} * @package */ - this.highlightGlowFilterId = ''; + this.selectedGlowFilterId = ''; /** - * The element to use for a higlight glow, or null if not set. + * The element to use for a selected glow, or null if not set. * @type {SVGElement} * @private */ - this.highlightGlowFilter_ = null; + this.selectedGlowFilter_ = null; /** - * The ID of the highlight glow filter, or the empty string if no filter is + * The ID of the replacement glow filter, or the empty string if no filter is * set. * @type {string} * @package @@ -382,7 +382,7 @@ Blockly.zelos.ConstantProvider = function() { this.replacementGlowFilterId = ''; /** - * The element to use for a higlight glow, or null if not set. + * The element to use for a replacement glow, or null if not set. * @type {SVGElement} * @private */ @@ -408,8 +408,8 @@ Blockly.zelos.ConstantProvider.prototype.init = function() { */ Blockly.zelos.ConstantProvider.prototype.dispose = function() { Blockly.zelos.ConstantProvider.superClass_.dispose.call(this); - if (this.highlightGlowFilter_) { - Blockly.utils.dom.removeNode(this.highlightGlowFilter_); + if (this.selectedGlowFilter_) { + Blockly.utils.dom.removeNode(this.selectedGlowFilter_); } }; @@ -757,9 +757,9 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { var defs = Blockly.utils.dom.createSvgElement('defs', {}, svg); // Using a dilate distorts the block shape. // Instead use a gaussian blur, and then set all alpha to 1 with a transfer. - var highlightGlowFilter = Blockly.utils.dom.createSvgElement('filter', + var selectedGlowFilter = Blockly.utils.dom.createSvgElement('filter', { - 'id': 'blocklyHighlightGlowFilter' + this.randomIdentifier_, + 'id': 'blocklySelectedGlowFilter' + this.randomIdentifier_, 'height': '160%', 'width': '180%', y: '-30%', @@ -771,15 +771,15 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { 'in': 'SourceGraphic', 'stdDeviation': 0.5 // TODO: configure size in theme. }, - highlightGlowFilter); + selectedGlowFilter); // Set all gaussian blur pixels to 1 opacity before applying flood - var highlightComponentTransfer = Blockly.utils.dom.createSvgElement( - 'feComponentTransfer', {'result': 'outBlur'}, highlightGlowFilter); + var selectedComponentTransfer = Blockly.utils.dom.createSvgElement( + 'feComponentTransfer', {'result': 'outBlur'}, selectedGlowFilter); Blockly.utils.dom.createSvgElement('feFuncA', { 'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' }, - highlightComponentTransfer); + selectedComponentTransfer); // Color the highlight Blockly.utils.dom.createSvgElement('feFlood', { @@ -787,15 +787,15 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { 'flood-opacity': 1, 'result': 'outColor' }, - highlightGlowFilter); + selectedGlowFilter); Blockly.utils.dom.createSvgElement('feComposite', { 'in': 'outColor', 'in2': 'outBlur', 'operator': 'in', 'result': 'outGlow' }, - highlightGlowFilter); - this.highlightGlowFilterId = highlightGlowFilter.id; - this.highlightGlowFilter_ = highlightGlowFilter; + selectedGlowFilter); + this.selectedGlowFilterId = selectedGlowFilter.id; + this.selectedGlowFilter_ = selectedGlowFilter; // Using a dilate distorts the block shape. // Instead use a gaussian blur, and then set all alpha to 1 with a transfer. diff --git a/core/renderers/zelos/path_object.js b/core/renderers/zelos/path_object.js index 70ced53b9..c3b64a1bb 100644 --- a/core/renderers/zelos/path_object.js +++ b/core/renderers/zelos/path_object.js @@ -135,7 +135,7 @@ Blockly.zelos.PathObject.prototype.updateSelected = function(enable) { /** @type {!SVGElement} */ (this.svgPath.cloneNode(true)); this.svgPathSelected_.setAttribute('fill', 'none'); this.svgPathSelected_.setAttribute('filter', - 'url(#' + this.constants_.highlightGlowFilterId + ')'); + 'url(#' + this.constants_.selectedGlowFilterId + ')'); this.svgRoot.appendChild(this.svgPathSelected_); } } else {