More work on strokes

This commit is contained in:
Patrick Walton 2018-12-03 18:14:50 -08:00
parent 077a3dc806
commit 2cf3be651c
2 changed files with 20 additions and 1 deletions

View File

@ -92,6 +92,7 @@ export class Outline {
} }
stroke(radius: number): void { stroke(radius: number): void {
console.log("stroking, radius=", radius);
for (const suboutline of this.suboutlines) for (const suboutline of this.suboutlines)
suboutline.stroke(radius); suboutline.stroke(radius);
} }

View File

@ -573,8 +573,26 @@ class Scene {
if (strokeWidth != null) { if (strokeWidth != null) {
const outline = new Outline(path); const outline = new Outline(path);
outline.calculateNormals(); outline.calculateNormals();
outline.stroke(strokeWidth * GLOBAL_TRANSFORM.a); outline.stroke(strokeWidth * GLOBAL_TRANSFORM.a * 5.0);
const strokedPathString = outline.toSVGPathString(); const strokedPathString = outline.toSVGPathString();
/*
const newSVG = staticCast(document.createElementNS(SVG_NS, 'svg'), SVGElement);
newSVG.style.position = 'absolute';
newSVG.style.left = "0";
newSVG.style.top = "0";
newSVG.style.width = "2000px";
newSVG.style.height = "2000px";
const newPath = document.createElementNS(SVG_NS, 'path');
newPath.setAttribute('d', strokedPathString);
newPath.setAttribute('fill',
"rgba(" + color[0] + "," + color[1] + "," + color[2] + "," +
color[3] + ")");
newSVG.appendChild(newPath);
document.body.appendChild(newSVG);
*/
path = SVGPath(strokedPathString); path = SVGPath(strokedPathString);
} }