수정: 에디터 아이템 우클릭 복제 메뉴 기본 메뉴 차단
This commit is contained in:
@@ -460,9 +460,22 @@ function duplicateItemToPool() {
|
||||
}
|
||||
|
||||
function handleGlobalContextMenu(event) {
|
||||
if (!itemContextMenu.value.open) return
|
||||
const target = event?.target
|
||||
if (target?.closest?.('[data-item-context-menu]') || target?.closest?.('[data-item-id]')) return
|
||||
if (target?.closest?.('[data-item-context-menu]')) {
|
||||
event?.preventDefault?.()
|
||||
event?.stopPropagation?.()
|
||||
return
|
||||
}
|
||||
|
||||
const itemEl = target?.closest?.('[data-item-id]')
|
||||
if (canEdit.value && itemEl?.dataset?.itemId) {
|
||||
event?.preventDefault?.()
|
||||
event?.stopPropagation?.()
|
||||
openItemContextMenu(itemEl.dataset.itemId, event)
|
||||
return
|
||||
}
|
||||
|
||||
if (!itemContextMenu.value.open) return
|
||||
closeItemContextMenu()
|
||||
}
|
||||
|
||||
@@ -1316,7 +1329,7 @@ watch(
|
||||
onMounted(() => {
|
||||
if (typeof window === 'undefined') return
|
||||
window.addEventListener('pointerdown', handleGlobalPointerDown)
|
||||
window.addEventListener('contextmenu', handleGlobalContextMenu)
|
||||
window.addEventListener('contextmenu', handleGlobalContextMenu, true)
|
||||
window.addEventListener('blur', closeItemContextMenu)
|
||||
window.addEventListener('scroll', closeItemContextMenu, true)
|
||||
})
|
||||
@@ -1324,7 +1337,7 @@ onMounted(() => {
|
||||
onUnmounted(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('pointerdown', handleGlobalPointerDown)
|
||||
window.removeEventListener('contextmenu', handleGlobalContextMenu)
|
||||
window.removeEventListener('contextmenu', handleGlobalContextMenu, true)
|
||||
window.removeEventListener('blur', closeItemContextMenu)
|
||||
window.removeEventListener('scroll', closeItemContextMenu, true)
|
||||
}
|
||||
@@ -1643,9 +1656,13 @@ onUnmounted(() => {
|
||||
:class="{ 'cell--selected': selectedItemId === id }"
|
||||
:data-item-id="id"
|
||||
@click.stop="selectItemByClick(id)"
|
||||
@contextmenu.prevent.stop="openItemContextMenu(id, $event)"
|
||||
>
|
||||
<img :src="resolveItemSrc(itemsById[id])" class="thumb" :alt="itemsById[id]?.label || id" />
|
||||
<img
|
||||
:src="resolveItemSrc(itemsById[id])"
|
||||
class="thumb"
|
||||
:alt="itemsById[id]?.label || id"
|
||||
draggable="false"
|
||||
/>
|
||||
<div v-if="showCharacterNames" class="itemNameOverlay">{{ itemsById[id]?.label || id }}</div>
|
||||
<button
|
||||
v-if="canEdit && !isExporting"
|
||||
@@ -1725,9 +1742,13 @@ onUnmounted(() => {
|
||||
}"
|
||||
:data-item-id="id"
|
||||
@click.stop="selectItemByClick(id)"
|
||||
@contextmenu.prevent.stop="openItemContextMenu(id, $event)"
|
||||
>
|
||||
<img :src="resolveItemSrc(itemsById[id])" class="thumb" :alt="itemsById[id]?.label || id" />
|
||||
<img
|
||||
:src="resolveItemSrc(itemsById[id])"
|
||||
class="thumb"
|
||||
:alt="itemsById[id]?.label || id"
|
||||
draggable="false"
|
||||
/>
|
||||
<div class="poolItem__label">{{ itemsById[id]?.label || id }}</div>
|
||||
<div v-if="!canEdit" class="poolItem__state">미배치</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user