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

SVG: move setting the stroke properties to the stroke method

In general, we may not know the stroke properties when path construction
happens. Since we must know the properties when we apply the stroke, we
should set the properties at that point. Note that we already do that
for the color and opacity, but not yet for the other properties.
This commit is contained in:
Tim van der Meij 2017-06-25 22:28:46 +02:00
parent 859e3d4dce
commit f1a87bab10
No known key found for this signature in database
GPG key ID: 8C3FD2925A5F2762

View file

@ -882,16 +882,6 @@ SVGGraphics = (function SVGGraphicsClosure() {
}
}
current.path.setAttributeNS(null, 'd', d.join(' '));
current.path.setAttributeNS(null, 'stroke-miterlimit',
pf(current.miterLimit));
current.path.setAttributeNS(null, 'stroke-linecap', current.lineCap);
current.path.setAttributeNS(null, 'stroke-linejoin', current.lineJoin);
current.path.setAttributeNS(null, 'stroke-width',
pf(current.lineWidth) + 'px');
current.path.setAttributeNS(null, 'stroke-dasharray',
current.dashArray.map(pf).join(' '));
current.path.setAttributeNS(null, 'stroke-dashoffset',
pf(current.dashPhase) + 'px');
current.path.setAttributeNS(null, 'fill', 'none');
this._ensureTransformGroup().appendChild(current.path);
@ -1005,9 +995,21 @@ SVGGraphics = (function SVGGraphicsClosure() {
stroke: function SVGGraphics_stroke() {
var current = this.current;
current.element.setAttributeNS(null, 'stroke', current.strokeColor);
current.element.setAttributeNS(null, 'stroke-opacity',
current.strokeAlpha);
current.element.setAttributeNS(null, 'stroke-miterlimit',
pf(current.miterLimit));
current.element.setAttributeNS(null, 'stroke-linecap', current.lineCap);
current.element.setAttributeNS(null, 'stroke-linejoin', current.lineJoin);
current.element.setAttributeNS(null, 'stroke-width',
pf(current.lineWidth) + 'px');
current.element.setAttributeNS(null, 'stroke-dasharray',
current.dashArray.map(pf).join(' '));
current.element.setAttributeNS(null, 'stroke-dashoffset',
pf(current.dashPhase) + 'px');
current.element.setAttributeNS(null, 'fill', 'none');
},