litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Cannot set property deltaX of #<WheelEvent> which has only a getter

Open L1nY4n opened this issue 4 years ago • 2 comments

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🤣

L1nY4n avatar Jul 19 '21 10:07 L1nY4n

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];
};```

L1nY4n avatar Aug 12 '21 10:08 L1nY4n

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

ghiscoding avatar Oct 27 '22 20:10 ghiscoding

Good to know 😹

L1nY4n avatar Oct 29 '22 20:10 L1nY4n

Unfortunately by removing this lines, the number widget is not working anymore. I'm receiving NaN if I drag the value.

Plaximo avatar Jan 09 '23 20:01 Plaximo

I tried using git+https://github.com/jagenjo/litegraph.js#ab9ca1afe2938dc9a7ce1676d98b94e05baae8fc as dependency but the error still occurs

KaKi87 avatar Feb 21 '23 09:02 KaKi87