Merge pull request #3426 from rachel-fenichel/highlight_for_replacement

Move highlightForReplacement into the path object as well.
This commit is contained in:
Rachel Fenichel
2019-11-11 16:32:49 -08:00
committed by GitHub
3 changed files with 22 additions and 7 deletions

View File

@@ -1756,11 +1756,5 @@ Blockly.BlockSvg.prototype.getHeightWidth = function() {
* @package
*/
Blockly.BlockSvg.prototype.highlightForReplacement = function(add) {
if (add) {
Blockly.utils.dom.addClass(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
} else {
Blockly.utils.dom.removeClass(/** @type {!Element} */ (this.svgGroup_),
'blocklyReplaceable');
}
this.pathObject.updateReplacementHighlight(add);
};

View File

@@ -111,3 +111,12 @@ Blockly.blockRendering.IPathObject.prototype.updateInsertionMarker;
* @package
*/
Blockly.blockRendering.IPathObject.prototype.updateMovable;
/**
* Add or remove styling that shows that if the dragging block is dropped, this
* block will be replaced. If a shadow block, it will disappear. Otherwise it
* will bump.
* @param {boolean} enable True if styling should be added.
* @package
*/
Blockly.blockRendering.IPathObject.prototype.updateReplacementHighlight;

View File

@@ -221,3 +221,15 @@ Blockly.blockRendering.PathObject.prototype.updateMovable = function(enable) {
this.setClass_('blocklyDraggable', enable);
};
/**
* Add or remove styling that shows that if the dragging block is dropped, this
* block will be replaced. If a shadow block, it will disappear. Otherwise it
* will bump.
* @param {boolean} enable True if styling should be added.
* @package
*/
Blockly.blockRendering.PathObject.prototype.updateReplacementHighlight =
function(enable) {
/* eslint-disable indent */
this.setClass_('blocklyReplaceable', enable);
}; /* eslint-enable indent */