React-map-gl: How to enable wheel scroll in Popup?

Created on 25 Feb 2018  路  10Comments  路  Source: visgl/react-map-gl

I've set the popup to captureScroll, and I'm able to scroll my popup with the scrollbar but mouse-wheel events don't seem to scroll the content.

bug

All 10 comments

+1

@jamalx31 What I ended up doing was adding this:

  componentDidMount() {
    this._handleScroll = this._handleScroll.bind(this);
    document.addEventListener("wheel", this._handleScroll);
  }
  componentWillUnmount() {
    document.removeEventListener("wheel", this._handleScroll);
  }

  _handleScroll = function(e) {
    if (this.scrollableDiv.contains(e.target) && this.props.isPopupExpanded) {
      e.preventDefault();
      const dY = e.deltaY;
      this.scrollableDiv.scrollTop += dY;
    }
  };

and in the continer div: <div ref={e => (this.scrollableDiv = e)} >

+1

God, thank you @mkral, was loosing my mind!

@fabioespinosa @mkral @jamalx31 Give v3.2.7 a try.

Thanks @Pessimistress worked great 馃挴

@Pessimistress sorry to bother, in desktop works well, but on phone it does not respond to touch scrolling

@fabioespinosa Try set the CSS of your scrollable component touch-action: pan-y? Related issue https://github.com/uber/react-map-gl/issues/506

Closed for inactivity.

Not sure if this is the same issue, but I landed here and my problem was that my (handmade) popup was inside my HTMLOverlay. Taking it out meant that scroll events were registered on the popup rather than the map.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Majaspic picture Majaspic  路  4Comments

xoddong picture xoddong  路  4Comments

tbergman picture tbergman  路  3Comments

cjmyles picture cjmyles  路  3Comments

tomrussell picture tomrussell  路  5Comments