mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
feat: implement WorkspaceSvg class manipulation (#8473)
* Implement addClass and removeClass functions * feat: implement `WorkspaceSvg` class manipulation * Update core/workspace_svg.ts * Update core/workspace_svg.ts
This commit is contained in:
committed by
GitHub
parent
59fab944f4
commit
731fb40faa
@@ -2432,6 +2432,28 @@ export class WorkspaceSvg extends Workspace implements IASTNodeLocationSvg {
|
||||
// We could call scroll here, but that has extra checks we don't need to do.
|
||||
this.translate(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a CSS class to the workspace.
|
||||
*
|
||||
* @param className Name of class to add.
|
||||
*/
|
||||
addClass(className: string) {
|
||||
if (this.injectionDiv) {
|
||||
dom.addClass(this.injectionDiv, className);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a CSS class from the workspace.
|
||||
*
|
||||
* @param className Name of class to remove.
|
||||
*/
|
||||
removeClass(className: string) {
|
||||
if (this.injectionDiv) {
|
||||
dom.removeClass(this.injectionDiv, className);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user