1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #19309 from calixteman/make_unique_id_draw_layer

[Editor] Set a unique id for each element in the draw layer
This commit is contained in:
calixteman 2025-01-08 21:56:52 +01:00 committed by GitHub
commit f1166f480f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 75 additions and 6 deletions

View file

@ -24,12 +24,12 @@ import { shadow } from "../shared/util.js";
class DrawLayer {
#parent = null;
#id = 0;
#mapping = new Map();
#toUpdate = new Map();
static #id = 0;
constructor({ pageIndex }) {
this.pageIndex = pageIndex;
}
@ -96,7 +96,7 @@ class DrawLayer {
}
draw(properties, isPathUpdatable = false, hasClip = false) {
const id = this.#id++;
const id = DrawLayer.#id++;
const root = this.#createSVG();
const defs = DrawLayer._svgFactory.createElement("defs");
@ -129,7 +129,7 @@ class DrawLayer {
// it composes with its parent with mix-blend-mode: multiply.
// But the outline has a different mix-blend-mode, so we need to draw it in
// its own SVG.
const id = this.#id++;
const id = DrawLayer.#id++;
const root = this.#createSVG();
const defs = DrawLayer._svgFactory.createElement("defs");
root.append(defs);