1

I want to disable wheel scroll zooming so the viewer can scroll down the page without losing the cursor in the map.

But this code freezes scrolling altogether, so when the cursor is over the map, there is no scrolling at all.

view.on("mouse-wheel", function(event) {
          // disable mouse wheel scroll zooming on the view
          event.stopPropagation();
        });

Codepen is https://codepen.io/nadinetrahan/full/VNYxRg

1

Try using the code example from here instead:

view.surface.addEventListener("wheel", function(event) {   
  event.stopImmediatePropagation();  
}, true);  

Demo of the two here.

  • Where is view.surface documented? – kenbuja Apr 11 at 18:48
  • Thanks Gavin, that does continue to scroll over the map if you start the scroll out of it. But if you stop scrolling on the map, then start again, the zoom kicks in. – Nadine Apr 12 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.