mirror of
https://github.com/google/blockly.git
synced 2026-01-11 10:57:07 +01:00
refactor: Add addClass and removeClass methods to blockSvg (#8337)
* refactor: Add `addClass` and `removeClass` methods to blockSvg * fix: lint * fix: jsdoc
This commit is contained in:
@@ -671,6 +671,24 @@ export class BlockSvg
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS class to the SVG group of this block.
|
||||
*
|
||||
* @param className
|
||||
*/
|
||||
addClass(className: string) {
|
||||
dom.addClass(this.svgGroup_, className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a CSS class from the SVG group of this block.
|
||||
*
|
||||
* @param className
|
||||
*/
|
||||
removeClass(className: string) {
|
||||
dom.removeClass(this.svgGroup_, className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively adds or removes the dragging class to this node and its
|
||||
* children.
|
||||
@@ -683,10 +701,10 @@ export class BlockSvg
|
||||
if (adding) {
|
||||
this.translation = '';
|
||||
common.draggingConnections.push(...this.getConnections_(true));
|
||||
dom.addClass(this.svgGroup_, 'blocklyDragging');
|
||||
this.addClass('blocklyDragging');
|
||||
} else {
|
||||
common.draggingConnections.length = 0;
|
||||
dom.removeClass(this.svgGroup_, 'blocklyDragging');
|
||||
this.removeClass('blocklyDragging');
|
||||
}
|
||||
// Recurse through all blocks attached under this one.
|
||||
for (let i = 0; i < this.childBlocks_.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user