F
F
fooligun2014-05-26 12:26:43
JavaScript
fooligun, 2014-05-26 12:26:43

Positioning popup in openlayers

Greetings!
There is a map with OpenStreetMap. On the map markers move along with balloons (popups).
I add a marker with a balloon to the same coordinate (LonLat) on the map.

map.addPopup(popup);
markerLayer.addMarker(marker);

When they move, everything works fine.
var newLonLat = new OpenLayers.LonLat(newLon,newLat).transform(projection.from,projection.to);
var newPx = map.getLayerPxFromLonLat(newLonLat);
marker.moveTo(newPx);
popup.moveTo(newPx);

But, if you change the zoom of the map (any), then the balloon moves out of the current coordinate.
When moving a marker with a balloon at a new zoom'e, it again (sticks together with the new position of the marker) is positioned correctly.
How to make the balloon not fall off the marker when zooming?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
callback, 2014-05-26
@callback

fuck OpenLayers, use Leaflet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question