don't capture onMouseDown if it's already used

Issue #2
This commit is contained in:
chrisgoringe
2023-10-14 17:04:43 +11:00
committed by GitHub
parent 77927e867c
commit da25a63927
+3 -1
View File
@@ -36,12 +36,14 @@ app.registerExtension({
nodeType.prototype.onNodeCreated = function () {
const r = onNodeCreated ? onNodeCreated.apply(this, arguments) : undefined;
const orig_onMouseDown = this.onMouseDown;
this.onMouseDown = function (event) {
//console.log("onMouseDown");
// set fixed node order so that state comparison works properly and avoids repeating the same state
// (is this really required tho? why not use _nodes_in_order when serializing? )
for (let i = 0; i < app.graph._nodes.length; i++) app.graph._nodes[i] = app.graph._nodes_in_order[i];
if (orig_onMouseDown) return orig_onMouseDown.apply(this, arguments);
return false;
};
@@ -207,4 +209,4 @@ LiteGraph.ContextMenu.prototype.close = function(e, ignore_parent_menu) {
const r = this.original_close(e, ignore_parent_menu);
workflowHistory.after();
return r;
}
}