Hello I am trying to rectify the component but some view items are not having the expected effect.
<ArcgisMap
itemId="e691172598f04ea8881cd2a4adaa45ba"
onArcgisViewDrag={ (event:ViewDragEvent) =>
{
// prevents panning with the mouse drag event
event.stopPropagation();
}
}
onArcgisViewKeyDown={(event: ViewKeyDownEvent) => {
// prevents panning with the arrow keys
const keyPressed = event.key;
if (keyPressed?.length<0 && keyPressed.slice(0, 5) === "Arrow") {
event.stopPropagation();
}
}}
>
</ArcgisMap>
both the `onArcgisViewDrag` event & the `onArcgisViewKeyDown` trigger but the `stopPropagation()` does not prevent movement
Solved! Go to Solution.
The components emit CustomEvents that wrap the native view mouse events, like CustomEvent<ViewDragEvent>.
Try to `event.detail.stopPropagation()`.
Versions used in package.json
"@arcgis/core": "^4.30.9",
"@arcgis/map-components-react": "^4.30.7",
The components emit CustomEvents that wrap the native view mouse events, like CustomEvent<ViewDragEvent>.
Try to `event.detail.stopPropagation()`.