[OpenLayers-Dev] defaultIcon: calculateOffset

Andrew Hughes ahhughes at gmail.com
Mon Oct 29 09:35:53 EDT 2007


IMHO, the intersection point between the two longest of the 4-sides is
clearly the focal point..this is the bottom point and... hence the
intersection point bottom is aligned over the position.

Perhaps what you are really raising is that the default icon does not
clearly focus its attention on the bottom of the icon. An arrow / teardrop,
flag or triangle may be a clearer option? I would agree the default is not
as good as it could be.


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20071030/2e9dad11/attachment.html


More information about the Dev mailing list