diff --git a/CHANGES.md b/CHANGES.md index 8c5a7a4e..affbc078 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,9 @@ `captureTextNodes` with canvg (inheriting class had set `captureTextNodes` too late) - Fix: Avoid errors for tspan passed to `getGradient` +- i18n: picking stroke/fill paint and opacity +- Optimize: Avoid rewriting `points` attribute for free-hand path; + incorporates #176 (fixes #175) # 3.0.0-rc.1 diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 10bc4b3a..9dded75d 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2390,9 +2390,13 @@ const mouseMove = function (evt) { bSpline = getBsplinePoint(parameter); sumDistance += Math.sqrt((nextPos.x - bSpline.x) * (nextPos.x - bSpline.x) + (nextPos.y - bSpline.y) * (nextPos.y - bSpline.y)); if (sumDistance > THRESHOLD_DIST) { - dAttr += +bSpline.x + ',' + bSpline.y + ' '; - shape.setAttributeNS(null, 'points', dAttr); sumDistance -= THRESHOLD_DIST; + + // Faster than completely re-writing the points attribute. + const point = svgcontent.createSVGPoint(); + point.x = bSpline.x; + point.y = bSpline.y; + shape.points.appendItem(point); } } }