[Refactor] Use litegraph LGraphNode.strokeStyles API (#3278)

This commit is contained in:
Chenlei Hu
2025-03-30 12:05:45 -04:00
committed by GitHub
parent 28def833f9
commit 8c789bd05d
4 changed files with 27 additions and 43 deletions

View File

@@ -46,6 +46,26 @@ export const useLitegraphService = () => {
constructor(title: string) {
super(title)
this.strokeStyles['running'] = function (this: LGraphNode) {
if (this.id == app.runningNodeId) {
return { color: '#0f0' }
}
}
this.strokeStyles['nodeError'] = function (this: LGraphNode) {
if (app.lastNodeErrors?.[this.id]?.errors) {
return { color: 'red' }
}
}
this.strokeStyles['dragOver'] = function (this: LGraphNode) {
if (app.dragOverNode?.id == this.id) {
return { color: 'dodgerblue' }
}
}
this.strokeStyles['executionError'] = function (this: LGraphNode) {
if (app.lastExecutionError?.node_id == this.id) {
return { color: '#f0f', lineWidth: 2 }
}
}
const nodeMinSize = { width: 1, height: 1 }
// Process inputs using V2 schema