feat: support custom class

This commit is contained in:
Anthony Fu
2024-02-21 11:43:53 +01:00
parent a540447a45
commit 58375e6e3d
2 changed files with 3 additions and 1 deletions

View File

@@ -74,7 +74,7 @@ class RoughAnnotationImpl implements RoughAnnotation {
if (this._state === 'unattached' && this._e.parentElement) {
ensureKeyframes();
const svg = this._svg = document.createElementNS(SVG_NS, 'svg');
svg.setAttribute('class', 'rough-annotation');
svg.setAttribute('class', ['rough-annotation', this._config.class || ''].filter(Boolean).join(' '));
const style = svg.style;
style.position = 'absolute';
style.top = '0';

View File

@@ -24,6 +24,8 @@ export interface RoughAnnotationConfigBase {
padding?: RoughPadding; // defaults to 5px
iterations?: number; // defaults to 2
brackets?: BracketType | BracketType[]; // defaults to 'right'
// Additional class added to the annotation
class?: string
}
export interface RoughAnnotation extends RoughAnnotationConfigBase {