This is the same strategy that React Native uses.  Google Maps on android
doesn't send map updates with the frequency required to have a separate
component laid over top using z-layering smoothly.   To solve this problem,
when the user presses the pointer on the map, your lightweight component is
seamlessly converted to a bitmap marker so that when the map is moved, the
marker will move with it with no delay.  When the pointer is released, the
bitmap marker is removed and the lightweight component is again shown.

Even native Android apps face this issue, and have to use a similar
strategy to achieve this result, as Google Maps only support bitmap markers
(no views of any kind).

It solves the lag issue you were experiencing.  The fact that it does this
by creating a bitmap marker is just an implementation detail.

I have fixed the build issue you are having.  The cn1lib still had some
orphan classes included in it.  Had to do a clean build.  You can download
the latest here
https://github.com/codenameone/codenameone-google-maps/blob/master/GoogleMaps.cn1lib

Or wait until it in Codename One Settings/Extensions.

Steve

On Fri, Apr 6, 2018 at 6:59 PM, Thomas <tombernar...@gmail.com> wrote:

> Thanks. I couldn't test the new API yet as it looks like it broke the
> compiler (see my build error log attached).
> I have no doubt that leaving the native google map component to deal with
> the markers will fix their lag issue.
> However, I wouldn't say this issue is resolved.
> From what I understood, the origin of this lag has not been fixed yet. So
> rendering a CN1 lightweighted component on top of a native one would still
> have really bad performances issue. Transforming a component into an image
> seems pretty much like a step back to me and would never be as effective as
> directly rendering the components with a correct Z-ordering (I did not test
> to render 50 1s timer markers with the new api for example, but I am pretty
> sure performances would not be as good as with react-native). Furthermore,
> not every native component can handle the display of custom images. For
> example, if I want to render a CN1 component on top of a native camera
> component and to make it track the camera movement/device orientation (to
> make some augmented reality app for example), would I still have to face
> the same issue? Would my CN1 component lag out in front of my native camera
> one?  Also, I do not only want to render static markers on top of my native
> map component, but also a moving marker for the user position and
> orientation and some custom paths (with different stroke and color) and to
> make them responsive on click. It can probably be handled with components
> transformed into images and passed as markers to the native map component,
> but it would just be much more easier and efficient if they could be kept
> as lightweighted components rendered on top of the native one...
>
> So I hope you would really try to get the same level of performances for
> rendering CN1 components on top of native one as with react-native, as I
> don't see any technical fouling (react-native has to transform js code into
> native view before rendering it so it should be slower than CN1, not the
> opposite) and many CN1 potential usage would probably benefit from it
> (augmented reality, complex apps with native components to render specific
> gui like maps, video, 3D...)
>
> On Friday, April 6, 2018 at 7:29:39 AM UTC+2, Shai Almog wrote:
>>
>> The issue should be resolved now. Steve added a new API to address this
>> as explained in the issue: https://github.com/codenameone
>> /CodenameOne/issues/2381
>>
> --
> 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 codenameone-discussions+unsubscr...@googlegroups.com.
> 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/ba290b89-8a36-42c1-bcab-
> 497759ab6b83%40googlegroups.com
> <https://groups.google.com/d/msgid/codenameone-discussions/ba290b89-8a36-42c1-bcab-497759ab6b83%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 the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
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/CAGOYrKXqk%3D_fY1jH-%2BsehZ4mYPyM_G%3DdUn_R4oiVp6zP4MkbVw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to