mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[Editor] Draw a line instead of a Bezier curve when an Ink has only one point
Fixes #17418.
This commit is contained in:
parent
2ca20dea43
commit
e9946fa22a
3 changed files with 60 additions and 8 deletions
|
@ -4397,14 +4397,20 @@ class InkAnnotation extends MarkupAnnotation {
|
|||
buffer.push(
|
||||
`${numberToString(bezier[0])} ${numberToString(bezier[1])} m`
|
||||
);
|
||||
for (let i = 2, ii = bezier.length; i < ii; i += 6) {
|
||||
const curve = bezier
|
||||
.slice(i, i + 6)
|
||||
.map(numberToString)
|
||||
.join(" ");
|
||||
buffer.push(`${curve} c`);
|
||||
if (bezier.length === 2) {
|
||||
buffer.push(
|
||||
`${numberToString(bezier[0])} ${numberToString(bezier[1])} l S`
|
||||
);
|
||||
} else {
|
||||
for (let i = 2, ii = bezier.length; i < ii; i += 6) {
|
||||
const curve = bezier
|
||||
.slice(i, i + 6)
|
||||
.map(numberToString)
|
||||
.join(" ");
|
||||
buffer.push(`${curve} c`);
|
||||
}
|
||||
buffer.push("S");
|
||||
}
|
||||
buffer.push("S");
|
||||
appearanceBuffer.push(buffer.join("\n"));
|
||||
}
|
||||
const appearance = appearanceBuffer.join("\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue