You can file an RFE for this feature, but I don't know when I'd get around
to implementing it.

The problem with your code is zoomTo() is asynchronous. After a zoomTo
call, you need to wait for the map to finish zooming before you check the
bounds again.  Here is a code snippet I pulled from some scratch code of
mine that does roughly what you want.

https://gist.github.com/shannah/d157120e990d8c4c0f5f9aa577c55a43

It probably isn't as smooth as using the native methods directly, but it
works.

Steve

On Mon, Mar 27, 2017 at 5:52 AM, roman canoniero <[email protected]>
wrote:

> Steve: actually, didnt work on android. I was reading that the right way
> is to use the panToBounds() procedure in maps api.
>
> Saldy, i have not the advanced knowledge to do it in native interface.
>
> Can you help me?
>
> ThNks roman
>
> El El lun, 27 de mar. de 2017 a las 02:45, Steve Hannah <
> [email protected]> escribió:
>
>> That strategy looks like it should work.  What results are you getting?
>>
>> Steve
>>
>> On Sun, Mar 26, 2017 at 3:31 PM, <[email protected]> wrote:
>>
>> Hi! im tryng do make a zoom to some area in a Map (native)  like the
>> MapComponent's   zoomTo(BoundingBox) use to do.
>>
>> i was tryng to implemented by myself coding -but without- good results
>> and i cant do it on the native way that i think tha its the best.
>>
>> considering that that functionality was originally in the mapComponent,
>> its possible to the team plans to implement it in the MapContainer?
>>
>> also, if somebody have solve that problem , please share the code.
>>
>> My CN1 code is:
>>
>>         Coord centro = getCenterCoord(parBoundingBox);
>>         mapa.setCameraPosition(centro);
>>         int currentZoom = 1;
>>         mapa.zoom(centro, currentZoom);
>>         while (mapa.getBoundingBox().contains(parBoundingBox.getNorthEast())
>> == true && mapa.getBoundingBox().contains(parBoundingBox.getSouthWest())
>> == true)
>>         {
>>        currentZoom++;
>>             mapa.zoom(centro, currentZoom);
>>         }
>>         currentZoom--;
>>         mapa.zoom(centro, currentZoom);
>>
>>
>> If you are experiencing an issue please mention the full platform your
>> issue applies to:
>> IDE: NetBeans/Eclipse/IDEA
>> Desktop OS
>> Simulator
>> Device
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "CodenameOne Discussions" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> Visit this group at https://groups.google.com/
>> group/codenameone-discussions.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/codenameone-discussions/007061fd-20f3-451e-8237-
>> 37e3a2b600e1%40googlegroups.com
>> <https://groups.google.com/d/msgid/codenameone-discussions/007061fd-20f3-451e-8237-37e3a2b600e1%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>>
>> --
>> Steve Hannah
>> Software Developer
>> Codename One
>> http://www.codenameone.com
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "CodenameOne Discussions" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/codenameone-discussions/xNisJiv7nCU/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> Visit this group at https://groups.google.com/
>> group/codenameone-discussions.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/codenameone-discussions/CAGOYrKWiW1-zP%2Bz_
>> djO0JfMhnDaHZ0oZvzs_S9F%3D_RmShh78gg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKWiW1-zP%2Bz_djO0JfMhnDaHZ0oZvzs_S9F%3D_RmShh78gg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/
> group/codenameone-discussions.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/codenameone-discussions/CAO%3DXYf3vfgdvw8FQv9c8KjW18Qqm4%
> 2BROJ5jk%3DteaabHa2noCnA%40mail.gmail.com
> <https://groups.google.com/d/msgid/codenameone-discussions/CAO%3DXYf3vfgdvw8FQv9c8KjW18Qqm4%2BROJ5jk%3DteaabHa2noCnA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKVezYae7SsfKXRUHamzSjRe9EYReVwm25mUCxVvwFS7%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to