chrvadala/react-svg-pan-zoom

Improving scrolling performance with passive listeners?

Opened this issue · 1 comments

Hello,

Google Lighthouse recommends using passive listener to improve performance. Please consider the following change:

  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this.autoPanIsRunning = true;
      requestAnimationFrame(this.autoPanLoop);
      this.ViewerDOM.addEventListener('wheel', this.onWheel, false);
    }
  }, {

would need to be set as passive

  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this.autoPanIsRunning = true;
      requestAnimationFrame(this.autoPanLoop);
      this.ViewerDOM.addEventListener('wheel', this.onWheel, false, {passive: true});
    }
  }, {

https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners
https://web.dev/uses-passive-event-listeners/?utm_source=lighthouse&utm_medium=devtools

Br,

Mikko

Has this change been implemented yet?