mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-19 14:30:07 +00:00
yagni mm? [skip ci]
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
import { useElementBounding } from '@vueuse/core'
|
||||
import { shallowRef, watch } from 'vue'
|
||||
|
||||
type Rect = DOMRectReadOnly
|
||||
|
||||
// Target container element (covers the canvas fully and shares its origin)
|
||||
const containerRef = shallowRef<HTMLElement | null>(null)
|
||||
|
||||
@@ -42,25 +40,12 @@ watch([x, y, width, height], () => {
|
||||
if (listeners.size) listeners.forEach((cb) => cb())
|
||||
})
|
||||
|
||||
export function invalidate(notify = false) {
|
||||
if (notify && listeners.size) listeners.forEach((cb) => cb())
|
||||
}
|
||||
|
||||
export function onCanvasRectChange(cb: () => void): () => void {
|
||||
ensureContainer()
|
||||
listeners.add(cb)
|
||||
return () => listeners.delete(cb)
|
||||
}
|
||||
|
||||
export function getCanvasRect(): Rect {
|
||||
ensureContainer()
|
||||
const lx = x.value || 0
|
||||
const ly = y.value || 0
|
||||
const w = width.value || 0
|
||||
const h = height.value || 0
|
||||
return new DOMRect(lx, ly, w, h)
|
||||
}
|
||||
|
||||
export function getCanvasClientOrigin() {
|
||||
ensureContainer()
|
||||
return { left: x.value || 0, top: y.value || 0 }
|
||||
|
||||
Reference in New Issue
Block a user