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:
Jeremiah Saunders
2024-08-13 13:14:05 -05:00
committed by GitHub
parent 59fab944f4
commit 731fb40faa

View File

@@ -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);
}
}
}
/**