@inkandswitch/patchwork-pkg-base 0.0.100 → 0.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/module-settings-url +1 -1
- package/package.json +1 -1
- package/packages/patternwitch/tool.js +21 -0
- package/plugin-registry-url +1 -1
package/module-settings-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:3MYvvipDiiZpKx6DZQvxJgXGeXh9
|
package/package.json
CHANGED
|
@@ -292,6 +292,26 @@ function icon(name) {
|
|
|
292
292
|
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${ICONS[name]}</svg>`;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
// Crosshair (hotspot at 8,8) with the tool's icon small at the bottom-right.
|
|
296
|
+
// Everything is drawn twice, white halo under black, so it reads on any pixel.
|
|
297
|
+
function toolCursor(name) {
|
|
298
|
+
const cross = `M8.5 1.5v5M8.5 10.5v5M1.5 8.5h5M10.5 8.5h5`;
|
|
299
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none" stroke-linejoin="round">
|
|
300
|
+
<path d="${cross}" stroke="#fff" stroke-width="3" stroke-linecap="square"/>
|
|
301
|
+
<path d="${cross}" stroke="#000" stroke-width="1" stroke-linecap="square"/>
|
|
302
|
+
<g transform="translate(15 15) scale(.6)" stroke-linecap="round">
|
|
303
|
+
<g stroke="#fff" stroke-width="6">${ICONS[name]}</g>
|
|
304
|
+
<g stroke="#000" stroke-width="2">${ICONS[name]}</g>
|
|
305
|
+
</g>
|
|
306
|
+
</svg>`;
|
|
307
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}") 8 8, crosshair`;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const TOOL_ICONS = { draw: "pencil", fill: "fill" };
|
|
311
|
+
const TOOL_CURSORS = Object.fromEntries(
|
|
312
|
+
Object.entries(TOOL_ICONS).map(([tool, name]) => [tool, toolCursor(name)]),
|
|
313
|
+
);
|
|
314
|
+
|
|
295
315
|
// ============================================================================
|
|
296
316
|
// Tool
|
|
297
317
|
// ============================================================================
|
|
@@ -488,6 +508,7 @@ export default function PatternWitchTool(handle, element) {
|
|
|
488
508
|
root.querySelectorAll("[data-tool]").forEach((el) => {
|
|
489
509
|
el.toggleAttribute("data-active", el.dataset.tool === activeTool);
|
|
490
510
|
});
|
|
511
|
+
canvas.style.cursor = TOOL_CURSORS[activeTool];
|
|
491
512
|
}
|
|
492
513
|
|
|
493
514
|
// ============================================================
|
package/plugin-registry-url
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
automerge:
|
|
1
|
+
automerge:2UeoFgDBNJDkK7cwPRWxkxtF72gW
|