mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
Feat: Double Click on Image Assets to open the lightbox (#6955)
## Summary Make it easier to open the lightbox preview. ## Review Focus The first click still selects the image. I liked the suggestion to require shift or ctrl to initiate selection and have click go back to the previous behavior. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6955-Feat-Double-Click-on-Image-Assets-to-open-the-lightbox-2b76d73d365081f0bf0de847add5c820) by [Unito](https://www.unito.io)
This commit is contained in:
@@ -59,35 +59,29 @@
|
|||||||
|
|
||||||
<!-- Media actions - show on hover or when playing -->
|
<!-- Media actions - show on hover or when playing -->
|
||||||
<IconGroup v-else-if="showActionsOverlay">
|
<IconGroup v-else-if="showActionsOverlay">
|
||||||
<div v-tooltip.top="$t('mediaAsset.actions.inspect')">
|
<IconButton
|
||||||
<IconButton
|
v-tooltip.top="$t('mediaAsset.actions.inspect')"
|
||||||
size="sm"
|
size="sm"
|
||||||
@click.stop="handleZoomClick"
|
@click.stop="handleZoomClick"
|
||||||
@mouseenter="handleOverlayMouseEnter"
|
>
|
||||||
@mouseleave="handleOverlayMouseLeave"
|
<i class="icon-[lucide--zoom-in] size-4" />
|
||||||
>
|
</IconButton>
|
||||||
<i class="icon-[lucide--zoom-in] size-4" />
|
<MoreButton
|
||||||
</IconButton>
|
ref="moreButtonRef"
|
||||||
</div>
|
v-tooltip.top="$t('mediaAsset.actions.more')"
|
||||||
<div v-tooltip.top="$t('mediaAsset.actions.more')">
|
size="sm"
|
||||||
<MoreButton
|
@menu-opened="handleMenuOpened"
|
||||||
ref="moreButtonRef"
|
@menu-closed="handleMenuClosed"
|
||||||
size="sm"
|
>
|
||||||
@menu-opened="handleMenuOpened"
|
<template #default="{ close }">
|
||||||
@menu-closed="handleMenuClosed"
|
<MediaAssetMoreMenu
|
||||||
@mouseenter="handleOverlayMouseEnter"
|
:close="close"
|
||||||
@mouseleave="handleOverlayMouseLeave"
|
:show-delete-button="showDeleteButton"
|
||||||
>
|
@inspect="handleZoomClick"
|
||||||
<template #default="{ close }">
|
@asset-deleted="handleAssetDelete"
|
||||||
<MediaAssetMoreMenu
|
/>
|
||||||
:close="close"
|
</template>
|
||||||
:show-delete-button="showDeleteButton"
|
</MoreButton>
|
||||||
@inspect="handleZoomClick"
|
|
||||||
@asset-deleted="handleAssetDelete"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</MoreButton>
|
|
||||||
</div>
|
|
||||||
</IconGroup>
|
</IconGroup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -101,8 +95,6 @@
|
|||||||
size="sm"
|
size="sm"
|
||||||
:label="String(outputCount)"
|
:label="String(outputCount)"
|
||||||
@click.stop="handleOutputCountClick"
|
@click.stop="handleOutputCountClick"
|
||||||
@mouseenter="handleOverlayMouseEnter"
|
|
||||||
@mouseleave="handleOverlayMouseLeave"
|
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<i class="icon-[lucide--layers] size-4" />
|
<i class="icon-[lucide--layers] size-4" />
|
||||||
@@ -216,7 +208,6 @@ const moreButtonRef = ref<InstanceType<typeof MoreButton>>()
|
|||||||
const isVideoPlaying = ref(false)
|
const isVideoPlaying = ref(false)
|
||||||
const isMenuOpen = ref(false)
|
const isMenuOpen = ref(false)
|
||||||
const showVideoControls = ref(false)
|
const showVideoControls = ref(false)
|
||||||
const isOverlayHovered = ref(false)
|
|
||||||
|
|
||||||
// Store actual image dimensions
|
// Store actual image dimensions
|
||||||
const imageDimensions = ref<{ width: number; height: number } | undefined>()
|
const imageDimensions = ref<{ width: number; height: number } | undefined>()
|
||||||
@@ -299,7 +290,7 @@ const durationChipClasses = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const isCardOrOverlayHovered = computed(
|
const isCardOrOverlayHovered = computed(
|
||||||
() => isHovered.value || isOverlayHovered.value || isMenuOpen.value
|
() => isHovered.value || isMenuOpen.value
|
||||||
)
|
)
|
||||||
|
|
||||||
// Show static chips when NOT hovered and NOT playing (normal state)
|
// Show static chips when NOT hovered and NOT playing (normal state)
|
||||||
@@ -320,14 +311,6 @@ const showActionsOverlay = computed(
|
|||||||
(isCardOrOverlayHovered.value || isVideoPlaying.value)
|
(isCardOrOverlayHovered.value || isVideoPlaying.value)
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleOverlayMouseEnter = () => {
|
|
||||||
isOverlayHovered.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleOverlayMouseLeave = () => {
|
|
||||||
isOverlayHovered.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleZoomClick = () => {
|
const handleZoomClick = () => {
|
||||||
if (asset) {
|
if (asset) {
|
||||||
emit('zoom', asset)
|
emit('zoom', asset)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="relative size-full overflow-hidden rounded bg-modal-card-placeholder-background"
|
class="relative size-full overflow-hidden rounded bg-modal-card-placeholder-background"
|
||||||
|
@dblclick="emit('view')"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
v-if="!error"
|
v-if="!error"
|
||||||
@@ -28,6 +29,7 @@ const { asset } = defineProps<{
|
|||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
'image-loaded': [width: number, height: number]
|
'image-loaded': [width: number, height: number]
|
||||||
|
view: []
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { state, error, isReady } = useImage({
|
const { state, error, isReady } = useImage({
|
||||||
|
|||||||
Reference in New Issue
Block a user