How to disable map navigation in the ArcGIS Server JavaScript API v4.x
It seems to completely disable map navigation (under a condition, like you asked) you would need to stop event propagation from certain events.
view.on(["click", "drag", "double-click", "mouse-wheel", "hold", ], function(event) {
if(thinking){
event.stopPropagation();
}
});
This will stop all of those events, if you want to disable a click or drag event from just the right mouse button (in case you want to disable just rotation for example), then the click
,drag
and double-click
events also have a button property which you can use:
Value Description
0 left click (or touch)
1 middle click
2 right click
*Taken from the view event documentation
EDIT
After asking about Disabling Shift+Left-click+Drag
zooming as well, I went back to the docs and found this example
Apparently you can add the definition of a pressed keyboard key to the event to stop the event from bubbling.
view.on("drag", ["Shift"], function(event) {
event.stopPropagation();
});
view.on("drag", ["Shift", "Control"], function(event) {
event.stopPropagation();
});