[OpenLayers-Dev] defaultIcon: calculateOffset

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Mon Oct 29 11:47:30 EDT 2007


But with this particular icon as a user I would expect the focal point to be
in the dot which is approximately in the center of the icon.

But I get the logic behind this now more clearly at least, thanks for the
explanation (also Andrew ofcourse).

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl


--------- Oorspronkelijk bericht --------
Van: Erik Uzureau <erik.uzureau at metacarta.com>
Naar: Bart van den Eijnden OSGIS <bartvde at osgis.nl>
Cc: dev at openlayers.org
Onderwerp: Re: [OpenLayers-Dev] defaultIcon: calculateOffset
Datum: 29/10/07 13:42

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






More information about the Dev mailing list