<div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">><br> > After some investigations, I found how to fix it.<br> ><br> > I've changed the piece of the code where it calculates the coordinates,<br>
> from:<br> ><br> > var lonlat = map.getLonLatFromLayerPx(evt.xy);<br> ><br> > To:<br> ><br> > var lonlat = map.getLonLatFromViewPortPx(evt.xy);<br> ><br> > Now it works fine.<br> ><br> > I'm just wondering, what's the difference of "getLonLatFromLayerPx", and<br>
> "getLonLatFromViewPortPx"? I've looked at the docs but I still don't get it.<br> > At first glance, I thought that these methods were similars.<br> <br> The answer is actually: "THey're the same insofar as you shouldn't need<br>
to use either one of them" :)</blockquote><div><br><br>Thanks! I knew I was missing something! =)<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Both of these are really designed to be internal methods: I've just<br> changed their definition from APIMethod to Method. The one you *shoul*<br> be using is the more nicely named getLonLatFromPixel: this hides the<br>
fact that you have to worry about any of this stuff.</blockquote><div><br><br>Good. I think this will help other users looking for some info about this in<br>the documentation.<br> <br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
In any case: We providedd getLonLatFromPixel as the main 'API' property<br> so that people wouldn't have to use a funky-named property: it's a<br> wrapper around getLonLatFromViewPortPx.<br> </blockquote>
</div><br>Just a suggestion. Considering that the "getLonLatFromPixel " is a <br>wrapper around "getLonLatFromViewPortPx", why not renaming it as<br>"getLonLatFromPixel", and use this in the rest of the library?<br>
<br>As JavaScript is a interpreted language, all function calls has a cost,<br>and because of this, is not recommended to use wrappers and getters <br>since they will just call another function, with a higher performance cost.<br>
<br>But, of course, changing this will require a refactoring and many files,<br>so one have to analyze well the benefits of making such a change,<br>before starting the refactoring.<br><br>Thanks for the helpfull answer!<br>
<br><br>my best regards,<br><br>Pedro Simonetti.<br>