[OpenLayers-Users] All marker offsets are wrong when using features
Deluded
rich at deluded.co.uk
Sun Jan 11 19:10:59 EST 2009
Hi everyone.
I've just been improving a site of mine that used to use the text layer to
overlay tracking points on a OSM map.
I've updated it to use the following function:
<code>
function addTripMarker(ll, popupContentHTML, img)
{
var feature = new OpenLayers.Feature(markers, ll);
feature.closeBox = true;
feature.popupClass =
OpenLayers.Class(OpenLayers.Popup.FramedCloud, {'autoSize': true});
feature.data.popupContentHTML = popupContentHTML;
feature.data.overflow = "auto";
var marker = feature.createMarker();
var markerClick = function (evt) {
if (this.popup == null) {
this.popup = this.createPopup(true);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
};
marker.events.register("mousedown", feature, markerClick);
marker.icon.url = img;
marker.icon.size = new OpenLayers.Size(32,32);
marker.icon.offset = new OpenLayers.Pixel(-160, -160);
markers.addMarker(marker);
}
</code>
All the icons are drawn correctly, but without any offset. You can see I've
put a silly 160,160 offset in to test this and it made no difference.
Anyone got any ideas what I'm doing wrong?? I could go back to using the
text layer, but I never figured out how to change the popup styles on that.
Thanks in advance :)
--
View this message in context: http://n2.nabble.com/All-marker-offsets-are-wrong-when-using-features-tp2143419p2143419.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list