From 3c8605d04b4ac0b9d43fe3c2f474018c670ae2d2 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 21 Feb 2024 11:55:10 +0100 Subject: [PATCH] feat: allow update `class` from instance --- src/rough-notation.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rough-notation.ts b/src/rough-notation.ts index 88dbc36..937ba0b 100644 --- a/src/rough-notation.ts +++ b/src/rough-notation.ts @@ -40,6 +40,16 @@ class RoughAnnotationImpl implements RoughAnnotation { } } + get class() { return this._config.class; } + set class(value) { + if (this._config.class !== value) { + this._config.class = value; + if (this._svg) { + this._svg.setAttribute('class', ['rough-annotation', this._config.class || ''].filter(Boolean).join(' ')); + } + } + } + get strokeWidth() { return this._config.strokeWidth; } set strokeWidth(value) { if (this._config.strokeWidth !== value) {