mirror of
https://github.com/PR0M3TH3AN/Artstr-Studio.git
synced 2026-10-27 08:40:39 +00:00
pen tool: live draft stroke width matches the panel value
The pen draft path was using a canvas-relative thickness (lineW * 2, derived from the canvas dimensions) for its preview stroke, so the ribbon you saw while drawing looked different from the path you got after committing. The committed path stores its stroke width in pixel-space (1 unit = 1 px @ 96 dpi); the overlay renders in inch space, so the live preview now divides _penToolOpts.penStrokeWidth by 96 — same trick the pencil draft already uses — and adds round line-cap / line-join so curves look consistent with the committed path.
This commit is contained in:
1 parent
cd54d8357f
commit
2fc555a4ff
1 file changed
+7
-1
+7
-1
@@ -11610,7 +11610,13 @@
|
||||
path.setAttribute('d', d);
|
||||
path.setAttribute('fill', 'none');
|
||||
path.setAttribute('stroke', _penToolOpts.penStrokeColor);
|
||||
path.setAttribute('stroke-width', String(lineW * 2));
|
||||
// The overlay is in canvas-inch space but the committed path
|
||||
// is in pixel-space (1 unit = 1 px @ 96 dpi). Divide by 96 so
|
||||
// the live preview reads at the same on-screen thickness the
|
||||
// path will have once it commits — matches the panel value.
|
||||
path.setAttribute('stroke-width', String(_penToolOpts.penStrokeWidth / 96));
|
||||
path.setAttribute('stroke-linecap', 'round');
|
||||
path.setAttribute('stroke-linejoin', 'round');
|
||||
_penOverlay.appendChild(path);
|
||||
}
|
||||
// Rubber-band from last node to cursor.
|
||||
|
||||
Reference in new issue
Block a user