mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[Editor] Remove the outline which is inside the free highlight shape
When an highlight is self-intersecting, the outline was drawn inside. In order to remove it, we use a svg mask to exclude the shape inside when drawing the outlines. That leads to change the outline 1px,white-2px,blue-1px,white to a 2px,white-2px,blue: the part of the stroke which is inside the shape is removed because of the mask.
This commit is contained in:
parent
4ec43488ff
commit
b88c6f9c39
2 changed files with 68 additions and 14 deletions
|
@ -56,22 +56,52 @@
|
|||
fill-rule: evenodd;
|
||||
fill: none;
|
||||
|
||||
&.hovered {
|
||||
stroke: var(--hover-outline-color);
|
||||
stroke-width: var(--outline-width);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
.mainOutline {
|
||||
stroke: var(--outline-around-color);
|
||||
stroke-width: calc(
|
||||
var(--outline-width) + 2 * var(--outline-around-width)
|
||||
);
|
||||
&:not(.free) {
|
||||
&.hovered:not(.selected) {
|
||||
stroke: var(--hover-outline-color);
|
||||
stroke-width: var(--outline-width);
|
||||
}
|
||||
|
||||
.secondaryOutline {
|
||||
stroke: var(--outline-color);
|
||||
stroke-width: var(--outline-width);
|
||||
&.selected {
|
||||
.mainOutline {
|
||||
stroke: var(--outline-around-color);
|
||||
stroke-width: calc(
|
||||
var(--outline-width) + 2 * var(--outline-around-width)
|
||||
);
|
||||
}
|
||||
|
||||
.secondaryOutline {
|
||||
stroke: var(--outline-color);
|
||||
stroke-width: var(--outline-width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.free {
|
||||
/*
|
||||
When drawing the outline we use a mask in order to remove the parts
|
||||
that are inside the shape. Unfortunately, this removes the part of the
|
||||
outline that is inside the shape. To "fix" this we increase the width
|
||||
to have what we want to be visible outside the shape.
|
||||
This is not a perfect solution, but it works well enough.
|
||||
*/
|
||||
&.hovered:not(.selected) {
|
||||
stroke: var(--hover-outline-color);
|
||||
stroke-width: calc(2 * var(--outline-width));
|
||||
}
|
||||
|
||||
&.selected {
|
||||
.mainOutline {
|
||||
stroke: var(--outline-around-color);
|
||||
stroke-width: calc(
|
||||
2 * (var(--outline-width) + var(--outline-around-width))
|
||||
);
|
||||
}
|
||||
|
||||
.secondaryOutline {
|
||||
stroke: var(--outline-color);
|
||||
stroke-width: calc(2 * var(--outline-width));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue