Skip to content

Commit

Permalink
✨ onPropertyChange
Browse files Browse the repository at this point in the history
  • Loading branch information
zhzLuke96 committed May 24, 2024
1 parent afe066f commit f91ce69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@litegraph-ts/core",
"version": "0.2.14",
"version": "0.2.15",
"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.",
"source": "src/index.ts",
"types": "src/index.ts",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/IWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export default interface IWidget<TOptions = any, TValue = any> {
onNodeCollapse?(node: LGraphNode, collapsed: boolean): void;
onNodeResize?(node: LGraphNode, size: Vector2): void;
onNodeModeChange?(node: LGraphNode, mode: NodeMode): void;

onPropertyChange?(value: any): void;
}
export interface IButtonWidget extends IWidget<{}, null> {
type: "button";
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/LGraphNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ export default class LGraphNode {
if (!w) continue;
if (w.options.property == name) {
w.value = value;
if (w.onPropertyChange) {
w.onPropertyChange(value);
}
break;
}
}
Expand Down

0 comments on commit f91ce69

Please sign in to comment.