From a76d195579513e2d737f7c6f2207e927420cef35 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 18 May 2025 17:31:43 +0200 Subject: [PATCH] removed offset indicator --- src/components/SpriteCanvas.vue | 95 +++------------------------------ 1 file changed, 7 insertions(+), 88 deletions(-) diff --git a/src/components/SpriteCanvas.vue b/src/components/SpriteCanvas.vue index ea0a183..65ae950 100644 --- a/src/components/SpriteCanvas.vue +++ b/src/components/SpriteCanvas.vue @@ -15,26 +15,12 @@ -
- - - -
-
- -
- - -
+ +
@@ -46,11 +32,8 @@
- -
-
-
x:{{ pos.x }}, y:{{ pos.y }}
-
+
+
@@ -106,9 +89,6 @@ const ghostSprite = ref<{ id: string; x: number; y: number } | null>(null); const highlightCell = ref(null); - // Add these refs at the top with other refs - const baseOffsets = ref>({}); - const showAllSprites = ref(false); const spritePositions = computed(() => { @@ -120,11 +100,6 @@ const col = index % props.columns; const row = Math.floor(index / props.columns); - // Calculate relative offset from base - const baseOffset = baseOffsets.value[sprite.id] || { x: 0, y: 0 }; - const relativeX = sprite.x - baseOffset.x; - const relativeY = sprite.y - baseOffset.y; - return { id: sprite.id, canvasX: col * maxWidth + sprite.x, @@ -138,9 +113,8 @@ col, row, index, - // Use relative offsets for display - x: relativeX, - y: relativeY, + x: sprite.x, + y: sprite.y, }; }); }); @@ -496,61 +470,6 @@ const rect = canvasRef.value.getBoundingClientRect(); return rect.width / canvasRef.value.width; }); - - // Add new ref for offset anchor - const offsetAnchor = ref('top-left'); - - // Add new method to calculate indicator position - const getOffsetIndicatorStyle = (pos: any) => { - const baseX = pos.cellX * scale.value; - const baseY = pos.cellY * scale.value; - const cellWidth = pos.maxWidth * scale.value; - const cellHeight = pos.maxHeight * scale.value; - - switch (offsetAnchor.value) { - case 'top-right': - return { - left: `${baseX + cellWidth}px`, - top: `${baseY}px`, - transform: 'translateX(-100%)', - }; - case 'bottom-left': - return { - left: `${baseX}px`, - top: `${baseY + cellHeight}px`, - transform: 'translateY(-100%)', - }; - case 'bottom-right': - return { - left: `${baseX + cellWidth}px`, - top: `${baseY + cellHeight}px`, - transform: 'translate(-100%, -100%)', - }; - default: // top-left - return { - left: `${baseX}px`, - top: `${baseY}px`, - }; - } - }; - - const setNewOffsetBase = () => { - // Store current positions as new base positions - props.sprites.forEach(sprite => { - baseOffsets.value[sprite.id] = { - x: Math.floor(sprite.x), - y: Math.floor(sprite.y), - }; - }); - - // Force redraw to update offset indicators - drawCanvas(); - }; - +