I want to change from a cached Basemap to a dynamic Basemap when the zoom is past a certain level. All Basemaps stored inside view's baseMapLayout (assume currently there's only 2). view is an ArcGIS View object.

"mouse-wheel" seems to be a MapView only event.

My current code:

view.onEvent("mouse-wheel", ()=>{
    if(view.getZoom() > 18) view.changeBasemap("A")
    else view.changeBasemap("B")
  • If I understand your question correctly, your current code works on mouse-wheel event, but you want it to work on zoom change event?
    – TomazicM
    Oct 20, 2023 at 10:01
  • No. mouse-wheel doesn't seem to be a valid event for View. So the event isn't triggered. I am trying to use mouse-wheel for zoom.
    – Someone
    Oct 20, 2023 at 15:31

1 Answer 1


You can use reactiveUtils (see https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html and https://developers.arcgis.com/javascript/latest/programming-patterns/#watching-for-property-changes) to watch for view.zoom property change. Watch for view.stationary can be added to skip zoom changes during animation.

In your case code could look something like this:

var currZoom = null;

const handle = reactiveUtils.watch(
  () => [view.stationary, view.zoom],
  ([stationary, zoom]) => {
    if(stationary && (zoom != currZoom)){
      currZoom = zoom;
      if (zoom > 18)
  • That was very useful. Thank you very much!
    – Someone
    Oct 20, 2023 at 23:21
  • Thank you for that info! Done. I am new to stack exchange.
    – Someone
    Oct 22, 2023 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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