[OpenLayers-Dev] defaultIcon: calculateOffset

Erik Uzureau erik.uzureau at metacarta.com
Mon Oct 29 11:41:27 EDT 2007


Basically this is because the general markers (icons) that we've been
working with are sort of like the gmaps one: the point of focus is on
the bottom line center of the icon itself.

e

On 10/29/07, Bart van den Eijnden (OSGIS) <bartvde at osgis.nl> wrote:
> Hi list,
>
> can anybody explain why the calculateOffset from the defaultIcon places the
> icon on top of the point, and not in the center of the point?
>
> OpenLayers.Marker.defaultIcon = function() {
>     var url = OpenLayers.Util.getImagesLocation() + "marker.png";
>     var size = new OpenLayers.Size(21, 25);
>     var calculateOffset = function(size) {
>                     return new OpenLayers.Pixel(-(size.w/2), -size.h);
>                  };
>
>     return new OpenLayers.Icon(url, size, null, calculateOffset);
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS, Open Source GIS
> http://www.osgis.nl
>
>
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
>



More information about the Dev mailing list