Skip to content

Commit 903cb2c

Browse files
committed
✨ node propertyChanged event
1 parent b3143d9 commit 903cb2c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@litegraph-ts/core",
3-
"version": "0.2.18",
3+
"version": "0.2.19",
44
"description": "A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.",
55
"source": "src/index.ts",
66
"types": "src/index.ts",

packages/core/src/LGraphNode.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ export default class LGraphNode {
335335
nodeOptionalInputAdd: (slot: INodeInputSlot) => void;
336336
nodeOptionalOutputAdd: (slot: INodeOutputSlot) => void;
337337
resize: (size: Vector2) => void;
338+
propertyChanged: (k: string, v: any, prev_v: any) => void;
338339
}>();
339340

340341
// sync position with the node
@@ -369,6 +370,12 @@ export default class LGraphNode {
369370
if (this.onPropertyChanged) {
370371
this.onPropertyChanged(k, info.properties[k]);
371372
}
373+
this.events.emit(
374+
"propertyChanged",
375+
k,
376+
info.properties[k],
377+
undefined,
378+
);
372379
}
373380
continue;
374381
}
@@ -625,6 +632,7 @@ export default class LGraphNode {
625632
//abort change
626633
this.properties[name] = prev_value;
627634
}
635+
this.events.emit("propertyChanged", name, value, prev_value);
628636
if (this.widgets)
629637
//widgets could be linked to properties
630638
for (var i = 0; i < this.widgets.length; ++i) {

0 commit comments

Comments
 (0)