So, I have a map and some points on it. When someone clicks on a point to view the popup(popupTemplate), and then zooms in, the popup is anchored to the exact point where they clicked, so it could be a few streets away if they zoom in.
Is there a way to anchor the popups to open on the spot of the symbol that was clicked?
I attached an image, so ideally, I'd want the popup to be centered from that blue dot
Solved! Go to Solution.
This isn't the prettiest thing, but it works; I would recommend adding it directly after creating your MapView.
reactiveUtils.when(() => view.popup?.actions, ()=>{
view.popup.watch("selectedFeatureIndex, visible, location", function(newValue, oldValue, propertyName, target) {
if ((target.visible) && (target.selectedFeatureIndex === 0) && (target.selectedFeature.geometry?.type == "point") && (!target.selectedFeature.geometry.equals(target.location)))
target.location = target.selectedFeature.geometry.clone();
});
});
(Note that reactiveUtils is esri/core/reactiveUtils)
This isn't the prettiest thing, but it works; I would recommend adding it directly after creating your MapView.
reactiveUtils.when(() => view.popup?.actions, ()=>{
view.popup.watch("selectedFeatureIndex, visible, location", function(newValue, oldValue, propertyName, target) {
if ((target.visible) && (target.selectedFeatureIndex === 0) && (target.selectedFeature.geometry?.type == "point") && (!target.selectedFeature.geometry.equals(target.location)))
target.location = target.selectedFeature.geometry.clone();
});
});
(Note that reactiveUtils is esri/core/reactiveUtils)