diff --git a/src/app.css b/src/app.css
index 57a264a..702c791 100644
--- a/src/app.css
+++ b/src/app.css
@@ -10,6 +10,10 @@
@apply text-text bg-primary-500 px-4 py-2 rounded-md shadow-md hover:bg-secondary-300;
}
+ button.secondary {
+ @apply text-text bg-secondary-500 px-4 py-2 rounded-md shadow-md hover:bg-secondary-300;
+ }
+
@media (prefers-color-scheme: dark) {
button {
@apply text-background;
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index fa74f97..d32bcfd 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -45,7 +45,7 @@
{#if tools.length === 0}
No tools exist yet..
{:else}
-
+
{/each}
+ {#if $lastSkin}
+
+ {/if}
@@ -167,50 +222,18 @@
{#if browser}
{
- const left = roundToPixelWidth(e.translate[0]);
- const top = roundToPixelHeight(e.translate[1]);
- e.target.style.transform = "translate(" + left + "px, " + roundToPixelHeight(top) + "px)";
-
- e.target.setAttribute("data-x", (left / getImagePixelWidth()).toString());
- e.target.setAttribute("data-y", (top / getImagePixelHeight()).toString());
- }}
bounds={imgCanvasBounds}
- useResizeObserver={true}
- useMutationObserver={true}
- on:beforeResize={({ detail: e }) => {
- const width = roundToPixelWidth(e.boundingWidth);
- const height = roundToPixelHeight(e.boundingHeight);
-
- e.setSize([width, height]);
-
- e.target.setAttribute("data-width", (width / getImagePixelWidth()).toString());
- e.target.setAttribute("data-height", (height / getImagePixelHeight()).toString());
- }}
- on:resize={({ detail: e }) => {
- e.target.style.width = `${e.boundingWidth}px`;
- e.target.style.height = `${e.boundingHeight}px`;
-
- if (e.drag) {
- const left = roundToPixelWidth(e.drag.translate[0]);
- const top = roundToPixelHeight(e.drag.translate[1]);
-
- e.target.setAttribute("data-x", (left / getImagePixelWidth()).toString());
- e.target.setAttribute("data-y", (top / getImagePixelHeight()).toString());
- }
-
- e.target.style.transform = e.transform;
- }}
- on:dragEnd={({ detail: e }) => {
- notifyRegionUpdate(e.target);
- }}
- on:resizeEnd={({ detail: e }) => {
- notifyRegionUpdate(e.target);
- }}
+ on:drag={({ detail: e }) => handleDragEvent(e)}
+ on:beforeResize={({ detail: e }) => handleBeforeResizeEvent(e)}
+ on:resize={({ detail: e }) => handleResizeEvent(e)}
+ on:dragEnd={({ detail: e }) => notifyRegionUpdate(e.target)}
+ on:resizeEnd={({ detail: e }) => notifyRegionUpdate(e.target)}
snappable
draggable
resizable
+ useResizeObserver
+ useMutationObserver
+ origin={false}
target={targets}
/>
@@ -228,10 +251,21 @@
});
}
targets = e.selected;
+
+ if (targets.length == 0 && e.isDouble) {
+ let eventX = e.inputEvent.clientX - imgCanvasBounds.left;
+ let eventY = e.inputEvent.clientY - imgCanvasBounds.top;
+ let x = Math.round(eventX / getImagePixelWidth()) - 2;
+ let y = Math.round(eventY / getImagePixelHeight()) - 2;
+
+ addRegion(Math.max(0, x), Math.max(0, y), 4, 4);
+ }
}}
/>
{/if}
+
+