mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 15:10:06 +00:00
* Restructures the application menu - rename Workflow to File - move new & template items to top level - add View menu and related sub items Commands - add "active" state getter shown as checkmark in the menu Node side panel - add refresh node defs - change reset view icon Help center - change to use store for visibility Fixes - Fix bug with mouse down where if you drag mouse out, mouse up wasn't caught - Fix issue with canvas info setting not triggering a redraw on change * Fix missing translation warnings * Add separator under new * tidy * Update locales [skip ci] * fix some tests * fix * Hide icon if there is an active state within the menu item group * Update locales [skip ci] * Fix tests * Implement feedback - Remove queue, node lib, model lib, workflows, manager, help center - Add minimap, link visibility * Update locales [skip ci] * Add plus icon on "New" menu item * Update locales [skip ci] * Fix test * Fix translations * Update locales [skip ci] * Update locales [skip ci] --------- Co-authored-by: github-actions <github-actions@github.com>
33 lines
786 B
TypeScript
33 lines
786 B
TypeScript
import { useEventListener } from '@vueuse/core'
|
|
|
|
export const whileMouseDown = (
|
|
elementOrEvent: HTMLElement | Event,
|
|
callback: (iteration: number) => void,
|
|
interval: number = 30
|
|
) => {
|
|
const element =
|
|
elementOrEvent instanceof HTMLElement
|
|
? elementOrEvent
|
|
: (elementOrEvent.target as HTMLElement)
|
|
|
|
let iteration = 0
|
|
|
|
const intervalId = setInterval(() => {
|
|
callback(iteration++)
|
|
}, interval)
|
|
|
|
const dispose = () => {
|
|
clearInterval(intervalId)
|
|
disposeGlobal()
|
|
disposeLocal()
|
|
}
|
|
|
|
// Listen for mouseup globally to catch cases where user drags out of element
|
|
const disposeGlobal = useEventListener(document, 'mouseup', dispose)
|
|
const disposeLocal = useEventListener(element, 'mouseup', dispose)
|
|
|
|
return {
|
|
dispose: dispose
|
|
}
|
|
}
|