- Optimize: Avoid rewriting `points` attribute for free-hand path; incorporates #176 (fixes #175)

- Docs: Update CHANGES
master
Brett Zamir 2018-07-26 00:00:30 -07:00
parent 3008696314
commit e2d378cfe6
2 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,9 @@
`captureTextNodes` with canvg (inheriting class had set `captureTextNodes` with canvg (inheriting class had set
`captureTextNodes` too late) `captureTextNodes` too late)
- Fix: Avoid errors for tspan passed to `getGradient` - 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 # 3.0.0-rc.1

View File

@ -2390,9 +2390,13 @@ const mouseMove = function (evt) {
bSpline = getBsplinePoint(parameter); bSpline = getBsplinePoint(parameter);
sumDistance += Math.sqrt((nextPos.x - bSpline.x) * (nextPos.x - bSpline.x) + (nextPos.y - bSpline.y) * (nextPos.y - bSpline.y)); sumDistance += Math.sqrt((nextPos.x - bSpline.x) * (nextPos.x - bSpline.x) + (nextPos.y - bSpline.y) * (nextPos.y - bSpline.y));
if (sumDistance > THRESHOLD_DIST) { if (sumDistance > THRESHOLD_DIST) {
dAttr += +bSpline.x + ',' + bSpline.y + ' ';
shape.setAttributeNS(null, 'points', dAttr);
sumDistance -= THRESHOLD_DIST; 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);
} }
} }
} }