[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) <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