1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-02 14:49:16 +02:00

fix: update annotation not work when annotation is not rendered

This commit is contained in:
Victor Soares 2024-03-25 09:41:22 -03:00
parent 9119f09b90
commit 73ad6da5a5
2 changed files with 21 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@victorsoares96/epubjs", "name": "@victorsoares96/epubjs",
"version": "0.3.96", "version": "0.3.97",
"description": "Parse and Render Epubs", "description": "Parse and Render Epubs",
"main": "lib/index.js", "main": "lib/index.js",
"module": "src/index.js", "module": "src/index.js",

View file

@ -242,28 +242,42 @@ class Annotation {
if (!this.styles) this.styles = {}; if (!this.styles) this.styles = {};
if (styles?.stroke) { if (styles?.stroke) {
if (this.mark?.attributes?.stroke) {
this.mark.attributes.stroke = styles.stroke; this.mark.attributes.stroke = styles.stroke;
}
this.styles.stroke = styles.stroke; this.styles.stroke = styles.stroke;
} }
if (styles?.["stroke-opacity"]) { if (styles?.["stroke-opacity"]) {
if (this.mark?.attributes?.["stroke-opacity"]) {
this.mark.attributes["stroke-opacity"] = styles["stroke-opacity"]; this.mark.attributes["stroke-opacity"] = styles["stroke-opacity"];
}
this.styles["stroke-opacity"] = styles["stroke-opacity"]; this.styles["stroke-opacity"] = styles["stroke-opacity"];
} }
if (styles?.["stroke-width"]) { if (styles?.["stroke-width"]) {
if (this.mark?.attributes?.["stroke-width"]) {
this.mark.attributes["stroke-width"] = styles["stroke-width"]; this.mark.attributes["stroke-width"] = styles["stroke-width"];
}
this.styles["stroke-width"] = styles["stroke-width"]; this.styles["stroke-width"] = styles["stroke-width"];
} }
if (styles?.fill) { if (styles?.fill) {
if (this.mark?.attributes?.fill) {
this.mark.attributes.fill = styles.fill; this.mark.attributes.fill = styles.fill;
this.mark.attributes.background = "red"; }
this.styles.fill = styles.fill; this.styles.fill = styles.fill;
} }
if (styles?.["fill-opacity"]) { if (styles?.["fill-opacity"]) {
if (this.mark?.attributes?.["fill-opacity"]) {
this.mark.attributes["fill-opacity"] = styles["fill-opacity"]; this.mark.attributes["fill-opacity"] = styles["fill-opacity"];
}
this.styles["fill-opacity"] = styles["fill-opacity"]; this.styles["fill-opacity"] = styles["fill-opacity"];
} }
} }