Skip to content

Commit 9bfb1f2

Browse files
authored
debug, old stroke widths are broken
1 parent 14b29f2 commit 9bfb1f2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/helper/selectable-shapes.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const selectableShapes = [
322322
category: "blocks",
323323
strokeWidth: 6,
324324
path: "M 11.864 6.638 L 15.403 6.644 C 17.396 6.894 17.338 9.532 15.403 9.765 L 11.864 9.77 C 10.045 9.643 9.778 6.905 11.864 6.638 Z"
325-
},
325+
},
326326
{
327327
id: "codeblockBoolean",
328328
name: "Boolean Block",
@@ -337,16 +337,17 @@ const selectablePaths = Object.fromEntries(
337337
);
338338

339339
const generateShapeSVG = (shapeObj) => {
340-
if (shapeObj._cachedSVG) return shapeObj._cachedSVG;
340+
if (!window.test && shapeObj._cachedSVG) return shapeObj._cachedSVG;
341341

342342
const strokeColor = "#575e75";
343+
const strokeWidth = window.test ? window.test(shapeObj) ? 1;
343344
const path = new paper.Path(shapeObj.path);
344345
const bounds = path.getBounds();
345-
const viewbox = `${bounds.x} ${bounds.y} ${bounds.width} ${bounds.height}`;
346+
const viewbox = `${bounds.x - strokeWidth} ${bounds.y - strokeWidth} ${bounds.width + (strokeWidth * 2)} ${bounds.height + (strokeWidth * 2)}`;
346347
path.remove();
347348

348349
shapeObj._cachedSVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewbox}">`
349-
+ `<path d="${shapeObj.path}" stroke-width="${window.test ?? 1}" stroke="${strokeColor}" fill="none"/></svg>`;
350+
+ `<path d="${shapeObj.path}" stroke-width="${strokeWidth}" stroke="${strokeColor}" fill="none"/></svg>`;
350351
return shapeObj._cachedSVG;
351352
};
352353

0 commit comments

Comments
 (0)