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

[Editor] Improve curve smoothing for Ink tool (bug 1789443)

- Remove the dependency on fit-curve;
- Improve the way to draw the current line in using a Path2D and
  in clearing only the last part of the curve instead of clearing
  all the canvas;
- Smooth the curve when drawing to avoid to have some changes after
  the drawing ends;
- Make the smoothing a bit less agressive.
This commit is contained in:
Calixte Denizet 2023-02-09 11:16:10 +01:00
parent 094fb3c783
commit d2b4ed3cea
10 changed files with 225 additions and 216 deletions

View file

@ -14,7 +14,6 @@
*/
import { CommandManager } from "../../src/display/editor/tools.js";
import { fitCurve } from "../../src/display/editor/ink.js";
describe("editor", function () {
describe("Command Manager", function () {
@ -91,29 +90,4 @@ describe("editor", function () {
manager.add({ ...makeDoUndo(5), mustExec: true });
expect(x).toEqual(11);
});
describe("fitCurve", function () {
it("should return a function", function () {
expect(typeof fitCurve).toEqual("function");
});
it("should compute an Array of bezier curves", function () {
const bezier = fitCurve(
[
[1, 2],
[4, 5],
],
30,
null
);
expect(bezier).toEqual([
[
[1, 2],
[2, 3],
[3, 4],
[4, 5],
],
]);
});
});
});

View file

@ -15,7 +15,6 @@
"pdfjs/": "../../src/",
"pdfjs-lib": "../../src/pdf.js",
"pdfjs-web/": "../../web/",
"pdfjs-fitCurve": "../../build/dev-fitCurve/fit_curve.js",
"pdfjs-test/": "../",
"web-annotation_editor_params": "../../web/annotation_editor_params.js",