[OpenLayers-Users] Wrong pop-up position (falling off the map)

Marc Jansen jansen at terrestris.de
Tue Jul 28 11:05:22 EDT 2009


Hi Emmanuele,

would the attribute "panMapIfOutOfView" of your Popup-object-instance be 
a possible solution to your problem?

Regards,
Marc

Emmanuele Sordini schrieb:
> Dear all,
> I have a world map with some fixed markers on it; clicking on each
> marker will open an AnchoredBubble popup with some content in it. So
> far I've let OL decide where to put the popup, just by doing something
> like this:
>
> myPopup =
>     new OpenLayers.Popup.AnchoredBubble("Project",				
>                                                 new OpenLayers.LonLat(lon, lat),
>                                                 new OpenLayers.Size(340, 250),
>                                                 html,
>                                                 null,
>                                                 true,
>                                                 null);
> map.addPopup(myPopup);
>
> Trouble is, that in some cases the popup is placed in the wrong
> position, thus resulting in a good portion of it ending up off the
> viewport bounds (and therefore, invisible). This seems to be happening
> a little more often in the vertical side, i.e. with markers whose
> position is closer to either the top or the bottom of the viewport.
>
> What could I do to fix this problem, i.e. by having OL choose the
> right coordinates, or by figuring them out myself? Of course the first
> approach would be preferable, but I'm determined to get rid of this
> annoying bug.
>
> Other useful info: OL 2.8, viewport around 800 x 600 pixels with
> multiple layers (popup, Google maps) and a 340 x 250-pixel popup.
>
> Any help on this issue will be highly valued.
>
> Thanks in advance
> Emmanuele
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   






More information about the Users mailing list