问题
My app features a ContainerMap
(GoogleMap with valid Javascript API Key) that is laid in center location of a BorderLayout form.
super(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE));
...
this.add(BorderLayout.CENTER_BEHAVIOR_CENTER, BorderLayout.center(userReportsMap));
I have registered a MapListener
and I wonder why it is not always fired when I zoom in or out under simulator ? It looks like it is fired a dozen of times right at the beginning when the GoogleMap is initialized and the MapListener is added to the map, and then it does not fire anymore. I press minus key and plus key to zoom out and in.
Please note : I don't remove the listener or instantiate the map anywhere afterwards.
On the contrary on an Android device it seems to work as expected when I pinch. So is it a limitation in the simulator due to the underlying Javascript map ?
Any hint appreciated,
回答1:
I have just released some changes to the Google Maps lib to fix a couple of race conditions in JS and simulator. This might fix the issue for you.
here is a direct link to latest lib. Or you can wait (probably less than a day) for it to appear in Codename One Settings/Extensions and update through there.
来源:https://stackoverflow.com/questions/42880326/why-is-the-maplistener-not-always-fired-on-codename-one-googlemap-under-simulato