Select to view content in your preferred language

Is it possible to center the infoWindow?

2386
8
02-09-2017 07:54 AM
LloydBronn
Frequent Contributor

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? 

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Lloyd,

   The popup has a method called reposition that you should use:

https://developers.arcgis.com/javascript/3/jsapi/popup-amd.html#reposition 

LloydBronn
Frequent Contributor

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.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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.

0 Kudos
LloydBronn
Frequent Contributor

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();
0 Kudos
LloydBronn
Frequent Contributor

Any thoughts as to why map.infoWindow.reposition(); might not be working? 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

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.

0 Kudos
LloydBronn
Frequent Contributor

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? 

0 Kudos
LloydBronn
Frequent Contributor

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. 

0 Kudos