mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-24 00:09:32 +00:00
Compare commits
2 Commits
fix/highli
...
sno-fix-fl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0153e72c2 | ||
|
|
1a25695392 |
@@ -1540,7 +1540,7 @@ export class ComfyPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async convertOffsetToCanvas(pos: [number, number]) {
|
async convertOffsetToCanvas(pos: [number, number]) {
|
||||||
return this.page.evaluate((pos) => {
|
return await this.page.evaluate((pos) => {
|
||||||
return window['app'].canvas.ds.convertOffsetToCanvas(pos)
|
return window['app'].canvas.ds.convertOffsetToCanvas(pos)
|
||||||
}, pos)
|
}, pos)
|
||||||
}
|
}
|
||||||
@@ -1592,21 +1592,21 @@ export class ComfyPage {
|
|||||||
await this.page.mouse.move(10, 10)
|
await this.page.mouse.move(10, 10)
|
||||||
}
|
}
|
||||||
async getUndoQueueSize() {
|
async getUndoQueueSize() {
|
||||||
return this.page.evaluate(() => {
|
return await this.page.evaluate(() => {
|
||||||
const workflow = (window['app'].extensionManager as WorkspaceStore)
|
const workflow = (window['app'].extensionManager as WorkspaceStore)
|
||||||
.workflow.activeWorkflow
|
.workflow.activeWorkflow
|
||||||
return workflow?.changeTracker.undoQueue.length
|
return workflow?.changeTracker.undoQueue.length
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async getRedoQueueSize() {
|
async getRedoQueueSize() {
|
||||||
return this.page.evaluate(() => {
|
return await this.page.evaluate(() => {
|
||||||
const workflow = (window['app'].extensionManager as WorkspaceStore)
|
const workflow = (window['app'].extensionManager as WorkspaceStore)
|
||||||
.workflow.activeWorkflow
|
.workflow.activeWorkflow
|
||||||
return workflow?.changeTracker.redoQueue.length
|
return workflow?.changeTracker.redoQueue.length
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
async isCurrentWorkflowModified() {
|
async isCurrentWorkflowModified() {
|
||||||
return this.page.evaluate(() => {
|
return await this.page.evaluate(() => {
|
||||||
return (window['app'].extensionManager as WorkspaceStore).workflow
|
return (window['app'].extensionManager as WorkspaceStore).workflow
|
||||||
.activeWorkflow?.isModified
|
.activeWorkflow?.isModified
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ export class QueueSidebarTab extends SidebarTab {
|
|||||||
if (width < 0 || width > 100) {
|
if (width < 0 || width > 100) {
|
||||||
throw new Error('Width must be between 0 and 100')
|
throw new Error('Width must be between 0 and 100')
|
||||||
}
|
}
|
||||||
return this.page.evaluate((width) => {
|
return await this.page.evaluate((width) => {
|
||||||
localStorage.setItem('queue', JSON.stringify([width, 100 - width]))
|
localStorage.setItem('queue', JSON.stringify([width, 100 - width]))
|
||||||
}, width)
|
}, width)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ test.describe('Remote COMBO Widget', () => {
|
|||||||
}, nodeName)
|
}, nodeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
const clickRefreshButton = (comfyPage: ComfyPage, nodeName: string) => {
|
const clickRefreshButton = async (comfyPage: ComfyPage, nodeName: string) => {
|
||||||
return comfyPage.page.evaluate((name) => {
|
return await comfyPage.page.evaluate((name) => {
|
||||||
const node = window['app'].graph.nodes.find((node) => node.title === name)
|
const node = window['app'].graph.nodes.find((node) => node.title === name)
|
||||||
const buttonWidget = node.widgets.find((w) => w.name === 'refresh')
|
const buttonWidget = node.widgets.find((w) => w.name === 'refresh')
|
||||||
return buttonWidget?.callback()
|
return buttonWidget?.callback()
|
||||||
|
|||||||
@@ -94,40 +94,42 @@ const showPopover = (event: Event) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show popover after a short delay
|
// Show popover after a short delay
|
||||||
showTimeout = setTimeout(async () => {
|
showTimeout = setTimeout(() => {
|
||||||
if (popoverRef.value && positionRef.value) {
|
void (async () => {
|
||||||
popoverRef.value.show(event, positionRef.value)
|
if (popoverRef.value && positionRef.value) {
|
||||||
await nextTick()
|
popoverRef.value.show(event, positionRef.value)
|
||||||
// PrimeVue has a bug where when the tabs are scrolled, it positions the element incorrectly
|
await nextTick()
|
||||||
// Manually set the position to the middle of the tab and prevent it from going off the left/right edge
|
// PrimeVue has a bug where when the tabs are scrolled, it positions the element incorrectly
|
||||||
const el = document.querySelector(
|
// Manually set the position to the middle of the tab and prevent it from going off the left/right edge
|
||||||
`.workflow-popover-fade[data-popover-id="${id}"]`
|
const el = document.querySelector(
|
||||||
) as HTMLElement
|
`.workflow-popover-fade[data-popover-id="${id}"]`
|
||||||
if (el) {
|
) as HTMLElement
|
||||||
const middle = positionRef.value!.getBoundingClientRect().left
|
if (el) {
|
||||||
const popoverWidth = el.getBoundingClientRect().width
|
const middle = positionRef.value!.getBoundingClientRect().left
|
||||||
const halfWidth = popoverWidth / 2
|
const popoverWidth = el.getBoundingClientRect().width
|
||||||
let pos = middle - halfWidth
|
const halfWidth = popoverWidth / 2
|
||||||
let shift = 0
|
let pos = middle - halfWidth
|
||||||
|
let shift = 0
|
||||||
|
|
||||||
// Calculate shift when clamping is needed
|
// Calculate shift when clamping is needed
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
shift = pos - 8 // Negative shift to move arrow left
|
shift = pos - 8 // Negative shift to move arrow left
|
||||||
pos = 8
|
pos = 8
|
||||||
} else if (pos + popoverWidth > window.innerWidth) {
|
} else if (pos + popoverWidth > window.innerWidth) {
|
||||||
const newPos = window.innerWidth - popoverWidth - 16
|
const newPos = window.innerWidth - popoverWidth - 16
|
||||||
shift = pos - newPos // Positive shift to move arrow right
|
shift = pos - newPos // Positive shift to move arrow right
|
||||||
pos = newPos
|
pos = newPos
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shift + halfWidth < 0) {
|
||||||
|
shift = -halfWidth + 24
|
||||||
|
}
|
||||||
|
|
||||||
|
el.style.left = `${pos}px`
|
||||||
|
el.style.setProperty('--shift', `${shift}px`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shift + halfWidth < 0) {
|
|
||||||
shift = -halfWidth + 24
|
|
||||||
}
|
|
||||||
|
|
||||||
el.style.left = `${pos}px`
|
|
||||||
el.style.setProperty('--shift', `${shift}px`)
|
|
||||||
}
|
}
|
||||||
}
|
})()
|
||||||
}, 200) // 200ms delay before showing
|
}, 200) // 200ms delay before showing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ const useNodePreview = <T extends MediaElement>(
|
|||||||
|
|
||||||
if (options?.block) node.isLoading = true
|
if (options?.block) node.isLoading = true
|
||||||
|
|
||||||
loadElements(outputUrls)
|
void loadElements(outputUrls)
|
||||||
.then((elements) => {
|
.then((elements) => {
|
||||||
const validElements = elements.filter(
|
const validElements = elements.filter(
|
||||||
(el): el is NonNullable<Awaited<T>> => el !== null
|
(el): el is NonNullable<Awaited<T>> => el !== null
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class ManageTemplates extends ComfyDialog {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
this.load().then((v) => {
|
void this.load().then((v) => {
|
||||||
this.templates = v
|
this.templates = v
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @ts-expect-error fixme ts strict error
|
// @ts-expect-error fixme ts strict error
|
||||||
node[WEBCAM_READY].then((v) => {
|
void node[WEBCAM_READY].then((v) => {
|
||||||
video = v
|
video = v
|
||||||
// If width isnt specified then use video output resolution
|
// If width isnt specified then use video output resolution
|
||||||
// @ts-expect-error fixme ts strict error
|
// @ts-expect-error fixme ts strict error
|
||||||
|
|||||||
@@ -384,14 +384,16 @@ export class ComfyApi extends EventTarget {
|
|||||||
* Poll status for colab and other things that don't support websockets.
|
* Poll status for colab and other things that don't support websockets.
|
||||||
*/
|
*/
|
||||||
#pollQueue() {
|
#pollQueue() {
|
||||||
setInterval(async () => {
|
setInterval(() => {
|
||||||
try {
|
void (async () => {
|
||||||
const resp = await this.fetchApi('/prompt')
|
try {
|
||||||
const status = (await resp.json()) as StatusWsMessageStatus
|
const resp = await this.fetchApi('/prompt')
|
||||||
this.dispatchCustomEvent('status', status)
|
const status = (await resp.json()) as StatusWsMessageStatus
|
||||||
} catch (error) {
|
this.dispatchCustomEvent('status', status)
|
||||||
this.dispatchCustomEvent('status', null)
|
} catch (error) {
|
||||||
}
|
this.dispatchCustomEvent('status', null)
|
||||||
|
}
|
||||||
|
})()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user