I have an infoWindow that contains an iFrame with a chart image generated by a GP tool. It's fairly large 640 x 680 pixels. It tends to go off the edges of the visible map. I've seen a lot of threads about automatically panning the map to accommodate the infoWindow. I'm wondering if it's possible to just have the infoWindow popup in the middle of the screen, regardless of where the click point is?
Lloyd,
The popup has a method called reposition that you should use:
https://developers.arcgis.com/javascript/3/jsapi/popup-amd.html#reposition
Thanks. Will this also work for an infoWindow? I noticed that when I first click a point, the infoWindow automatically positions itself above, below, or beside the point based on where it is in the map. After I run the GP tool and click the result link, the new infoWindow pops up, it's always above the point and it's usually going off the screen. Could it be happening because I resize it to accommodate the iFrame?
I've tried using window.map.infoWindow.show(evt.mapPoint); but that didn't help.
Llyod,
Definitely it is because you resize the infoWindow. BTW. the map.infoWindow by default is a Popup dijit, so yes map.infoWindow.reposition(); will work fine.
OK. I tried it, and it's still above the point.
window.map.infoWindow.resize(640, 660);
window.map.infoWindow.setContent(content);
window.map.infoWindow.reposition();
Any thoughts as to why map.infoWindow.reposition(); might not be working?
Sorry I do not. Is there enough space for the popup and the map point to show? Maybe try to decrease the size of the infowindow some.
Yes, there is room. I don't need the map point to show once the infowindow is up, I just need the infowindow to behave like it's supposed to. Not always above the point, regardless of where the point is on the map. I can't really make it any smaller, because I need the chart to be visible/readable in the infowindow. Maybe this is a bug?
So I've discovered that the infoWindow won't reposition if it is wider than 550px. This is unfortunate because I need it to be 640px for the chart to be legible. I've also noticed that when the window is full size (640, 660), if zoom in after the chart window is displayed, it moves into the full view of the map. I'm wondering if this is a set limit or if it's just a bug.