[FEAT] Format code
This commit is contained in:
@@ -227,7 +227,7 @@
|
||||
(e: 'removeSprite', id: string): void;
|
||||
(e: 'removeSprites', ids: string[]): void;
|
||||
(e: 'replaceSprite', id: string, file: File): void;
|
||||
(e: 'addSprite', file: File): void;
|
||||
(e: 'addSprite', file: File, index?: number): void;
|
||||
(e: 'addSpriteWithResize', file: File): void;
|
||||
(e: 'rotateSprite', id: string, angle: number): void;
|
||||
(e: 'flipSprite', id: string, direction: 'horizontal' | 'vertical'): void;
|
||||
@@ -263,6 +263,7 @@
|
||||
handleTouchStart,
|
||||
handleTouchMove,
|
||||
findSpriteAtPosition,
|
||||
findCellAtPosition,
|
||||
calculateMaxDimensions,
|
||||
} = useDragSprite({
|
||||
sprites: computed(() => props.layers.find(l => l.id === props.activeLayerId)?.sprites ?? []),
|
||||
@@ -293,6 +294,7 @@
|
||||
const showContextMenu = ref(false);
|
||||
const contextMenuX = ref(0);
|
||||
const contextMenuY = ref(0);
|
||||
const contextMenuIndex = ref<number | null>(null);
|
||||
const contextMenuSpriteId = ref<string | null>(null);
|
||||
const selectedSpriteIds = ref<Set<string>>(new Set());
|
||||
const replacingSpriteId = ref<string | null>(null);
|
||||
@@ -383,6 +385,7 @@
|
||||
if (!pos) return;
|
||||
|
||||
const clickedSprite = findSpriteAtPosition(pos.x, pos.y);
|
||||
contextMenuIndex.value = findCellAtPosition(pos.x, pos.y)?.index ?? null;
|
||||
contextMenuSpriteId.value = clickedSprite?.id || null;
|
||||
|
||||
if (clickedSprite) {
|
||||
@@ -529,13 +532,18 @@
|
||||
if (replacingSpriteId.value) {
|
||||
emit('replaceSprite', replacingSpriteId.value, file);
|
||||
} else {
|
||||
emit('addSprite', file);
|
||||
if (contextMenuIndex.value !== null) {
|
||||
emit('addSprite', file, contextMenuIndex.value);
|
||||
} else {
|
||||
emit('addSprite', file);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert('Please select an image file.');
|
||||
}
|
||||
}
|
||||
replacingSpriteId.value = null;
|
||||
contextMenuIndex.value = null;
|
||||
input.value = '';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user