litegraph.js
litegraph.js copied to clipboard
Cannot set property deltaX of #<WheelEvent> which has only a getter
I'am trying migrate the editor-demo to my vue appliction and got the console error
at LGraphCanvas.adjustMouseEvent (litegraph.js:6613)
at LGraphCanvas.processMouseWheel (litegraph.js:6041)
it seems cause by javascritpt 'strict mode' ? how can I fix this🤣
before this can be fix ,I just override the method "adjustMouseEvent" to remove the setter
if (this.canvas) {
var b = this.canvas.getBoundingClientRect();
e.localX = e.clientX - b.left;
e.localY = e.clientY - b.top;
} else {
e.localX = e.clientX;
e.localY = e.clientY;
}
// e.localX - this.last_mouse_position[0];
// e.localY - this.last_mouse_position[1];
this.last_mouse_position[0] = e.localX;
this.last_mouse_position[1] = e.localY;
e.canvasX = e.localX / this.ds.scale - this.ds.offset[0];
e.canvasY = e.localY / this.ds.scale - this.ds.offset[1];
};```
I got that problem while trying the lib and it seems that it got fix latest with this commit, however it's not yet released under a new version
Good to know 😹
Unfortunately by removing this lines, the number widget is not working anymore. I'm receiving NaN if I drag the value.
I tried using git+https://github.com/jagenjo/litegraph.js#ab9ca1afe2938dc9a7ce1676d98b94e05baae8fc as dependency but the error still occurs