Hi.maybe my question is piece of cake but I don't know a nice solution. I hope you can help.I have a polygon graphic from a find-result and I want to pan to the location. I want to keep the current scale of the map (even if you can hardly see the polygon in the map).The standard examples shows how to zoom to the polygon bymap.setExtent(polygon.getExtent());
This changes the current scale of the map to the scale where the polygon fits.I want to keep the current scale. My solution right now changes the scale afterwards to the previous scale. Like this:
var scale = esri.geometry.getScale(map);
map.setExtent(currentItem.geometry.getExtent());
// Wait until the extent change has completed
var tempHook = dojo.connect(map, "onUpdateEnd", function() {
map.setExtent(esri.geometry.getExtentForScale(map, scale));
// Dispose of the temporary listener
dojo.disconnect(tempHook);
});
The disadvantage is: I have to create a temp-hook waiting for the map-update of my first zoom to the polygon. After that I change the extent back to the previous one (var scale). Two map requests and responses. And it looks grumpy because the map changes two times (zoom-in, zoom-out).Is there a way to "pan" to the polygon directly? I don't know why I can't find it. There must be a way, I guess...Thanks.Axel