mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
- Increased the z-index on app mode outputs so that they display above a zoomed image - The "view job" button on the job queued toast in mobile app mode will take you to outputs instead of assets - Image previews now have a minimum zoom of ~20% and a maximum zoom of ~50x - The enter panel in linear mode now has a minimum size of ~1/5th screen size - In arrange mode, dragging to rearrange inputs will no longer cause a horizontal scrollbar to appear. - Videos will now display the first frame instead of a generic video icon - Muted/Bypassed nodes can no longer be selected as inputs/outputs, or be displayed when in app mode. - Linked input can no longer be selected or displayed - Adds a share workflow button in app mode and wires up the existing context menu ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9432-More-app-fixes-31a6d73d365081509cd0ea74bfdc9b95) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
61 lines
1.5 KiB
Vue
61 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import { computed, ref, useTemplateRef } from 'vue'
|
|
|
|
const zoomPane = useTemplateRef('zoomPane')
|
|
|
|
const zoom = ref(1.0)
|
|
const panX = ref(0.0)
|
|
const panY = ref(0.0)
|
|
|
|
function handleWheel(e: WheelEvent) {
|
|
const zoomPaneEl = zoomPane.value
|
|
if (!zoomPaneEl || (e.deltaY < 0 ? zoom.value > 1200 : zoom.value < -500))
|
|
return
|
|
|
|
zoom.value -= e.deltaY
|
|
const { x, y, width, height } = zoomPaneEl.getBoundingClientRect()
|
|
const offsetX = e.clientX - x - width / 2
|
|
const offsetY = e.clientY - y - height / 2
|
|
const scaler = 1.1 ** (e.deltaY / -30)
|
|
|
|
panY.value = panY.value * scaler - offsetY * (scaler - 1)
|
|
panX.value = panX.value * scaler - offsetX * (scaler - 1)
|
|
}
|
|
|
|
let dragging = false
|
|
function handleDown(e: PointerEvent) {
|
|
if (e.button !== 0) return
|
|
|
|
const zoomPaneEl = zoomPane.value
|
|
if (!zoomPaneEl) return
|
|
zoomPaneEl.parentElement?.focus()
|
|
|
|
zoomPaneEl.setPointerCapture(e.pointerId)
|
|
dragging = true
|
|
}
|
|
function handleMove(e: PointerEvent) {
|
|
if (!dragging) return
|
|
panX.value += e.movementX
|
|
panY.value += e.movementY
|
|
}
|
|
|
|
const transform = computed(() => {
|
|
const scale = 1.1 ** (zoom.value / 30)
|
|
const matrix = [scale, 0, 0, scale, panX.value, panY.value]
|
|
return `matrix(${matrix.join(',')})`
|
|
})
|
|
</script>
|
|
<template>
|
|
<div
|
|
ref="zoomPane"
|
|
class="place-content-center contain-size"
|
|
@wheel="handleWheel"
|
|
@pointerdown.prevent="handleDown"
|
|
@pointermove="handleMove"
|
|
@pointerup="dragging = false"
|
|
@pointercancel="dragging = false"
|
|
>
|
|
<slot :style="{ transform }" />
|
|
</div>
|
|
</template>
|