Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Commit

Permalink
update: annotation display
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu committed Jul 16, 2022
1 parent 509ed92 commit cd59826
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions addon/chrome/content/previewPDF.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@
// Render annotations
for (const annot of annotations) {
_ctx = canvas.getContext("2d");
_ctx.globalAlpha = 0.5;
_ctx.globalAlpha = 1;
_ctx.fillStyle = annot.color;
_ctx.strokeStyle = annot.color;
_ctx.lineWidth = annot.position.width
? annotations.position.width
: 2;
_ctx.lineCap = "round";
_ctx.lineJoin = "round";
if (annot.type === "highlight") {
// Rectangle
// Set alpha to keep the text visible
_ctx.globalAlpha = 0.5;
for (rect of annot.position.rects) {
_ctx.fillRect(
rect[0] * totalScale,
Expand Down Expand Up @@ -145,9 +152,6 @@
}
} else if (annot.type === "ink") {
// Lines
_ctx.lineWidth = annot.position.width;
_ctx.lineCap = "round";
_ctx.lineJoin = "round";
for (path of annot.position.paths) {
_ctx.beginPath();
_ctx.moveTo(
Expand Down

0 comments on commit cd59826

Please sign in to comment.