mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[Editor] Simplify the draw layer code
and tweak a bit the highlight one (e.g. it's useless to have 64 bits floating point numbers when 32 bits ones are enough). It's a required step for the refactoring of the ink tool (in order to use the draw layer). It avoids to call several functions acting on the same SVG element.
This commit is contained in:
parent
07765e993e
commit
3c343acbb6
7 changed files with 322 additions and 234 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue