Manuel Gonzalez
2011-May-24 03:15 UTC
[Mapstraction] Change the origen point of a custom marker
Hi all, I created a custom marker but it is positioned using its upper left corner and I want to use the lower left corner. The documentation says that setIconAnchor() takes strings as parameter but it does not provide any example. Hope someone in the list could help me with this Thanks in advance to all of you Many -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20110523/b4d33b72/attachment.htm>
The documentation is wrong. As far as I can tell from experimentation, the method takes an array that is treated as an x, y ordered pair of distances right and down from the top left. So if you want to use the bottom left and your marker is 10 pixels high, you''d call setIconAnchor( [ 0, 10 ] ). I''d be willing to update the inline documentation, I think this is wrong in a few places. It seems like it is important that all implementations interpret the dimensions the same way, so if anyone disagrees with my interpretation speak up. -dylan- On Mon, May 23, 2011 at 8:15 PM, Manuel Gonzalez <elmany at gmail.com> wrote:> Hi all, > > I created a custom marker but it is positioned using its upper left corner > and I want to use the lower left corner. > The documentation says that setIconAnchor() takes strings as parameter but > it does not provide any example. > > Hope someone in the list could help me with this > > Thanks in advance to all of you > > Many > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20110523/40b5c682/attachment.htm>
Bruno Bergot
2011-May-24 07:32 UTC
[Mapstraction] Change the origen point of a custom marker
Hi, Le 24/05/2011 06:18, cyberhobo a ?crit :> The documentation is wrong. As far as I can tell from experimentation, the > method takes an array that is treated as an x, y ordered pair of distances > right and down from the top left. So if you want to use the bottom left and > your marker is 10 pixels high, you''d call setIconAnchor( [ 0, 10 ] ).Right. The documentation provided in mapstraction archive could be confusing but explain it : setIconAnchor(iconAnchor) Sets the anchor point for a marker Parameters: {String} iconAnchor *The array* offset of the anchor point> > I''d be willing to update the inline documentation, I think this is wrong in > a few places. It seems like it is important that all implementations > interpret the dimensions the same way, so if anyone disagrees with my > interpretation speak up.Good news, i''ve been thinking about it too, and i think we should also update the examples pages here : http://mapstraction.appspot.com/ I''ve tried to provide an example page in mapstraction archive every time i''ve added or implementer a mxn function in an api, cause i think example code is a good way for people who want to learn how stuff works. But a good documentation is important too... ++ b_b
Manuel Gonzalez
2011-May-24 10:56 UTC
[Mapstraction] Change the origen point of a custom marker
Thank you very much! Yes indeed, examples of code are a valuable source of knowledge. Even more for newbies like me. Thanks again El May 24, 2011, a las 3:02 AM, Bruno Bergot <brunobergot at gmail.com> escribi?:> Hi, > > Le 24/05/2011 06:18, cyberhobo a ?crit : >> The documentation is wrong. As far as I can tell from experimentation, the >> method takes an array that is treated as an x, y ordered pair of distances >> right and down from the top left. So if you want to use the bottom left and >> your marker is 10 pixels high, you''d call setIconAnchor( [ 0, 10 ] ). > > Right. The documentation provided in mapstraction archive could be confusing but explain it : > > setIconAnchor(iconAnchor) > Sets the anchor point for a marker > > Parameters: > {String} iconAnchor > *The array* offset of the anchor point > >> >> I''d be willing to update the inline documentation, I think this is wrong in >> a few places. It seems like it is important that all implementations >> interpret the dimensions the same way, so if anyone disagrees with my >> interpretation speak up. > > Good news, i''ve been thinking about it too, and i think we should also update the examples pages here : > > http://mapstraction.appspot.com/ > > I''ve tried to provide an example page in mapstraction archive every time i''ve added or implementer a mxn function in an api, cause i think example code is a good way for people who want to learn how stuff works. But a good documentation is important too... > > ++ > b_b > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com