1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #19085 from calixteman/simplify_drawer

[Editor] Simplify the draw layer code
This commit is contained in:
calixteman 2024-11-22 09:16:48 +01:00 committed by GitHub
commit 5133e6b666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 322 additions and 234 deletions

View file

@ -381,8 +381,40 @@ class Rasterize {
);
const drawLayer = new DrawLayer({ pageIndex: 0 });
drawLayer.setParent(div);
drawLayer.draw(outliner.getOutlines(), "orange", 0.4);
drawLayer.drawOutline(outlinerForOutline.getOutlines());
const outlines = outliner.getOutlines();
drawLayer.draw(
{
bbox: outlines.box,
root: {
viewBox: "0 0 1 1",
fill: "orange",
"fill-opacity": 0.4,
},
rootClass: {
highlight: true,
free: false,
},
path: {
d: outlines.toSVGPath(),
},
},
/* isPathUpdatable = */ false,
/* hasClip = */ true
);
const focusLine = outlinerForOutline.getOutlines();
drawLayer.drawOutline(
{
rootClass: {
highlightOutline: true,
free: false,
},
bbox: focusLine.box,
path: {
d: focusLine.toSVGPath(),
},
},
/* mustRemoveSelfIntersections = */ false
);
svg.append(foreignObject);