-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have created a ZK application that uses the Zk Google Maps library. In this application I would like a button that, once clicked, should prompt the map to be displayed with the specific marker in the center. I have created a method that handles the event of the click of the 'centerMarkerButton' button:
public void onClick$centerMarkerButton(event evt){
myMap.setCenter(marker.getLat(), marker.getLng());
}
However when clicked, the map doesn't do anything. The following method, which put the marker in the center of the map whenever the map is moved, contains the same code and fully works:
public void onMapMoved$myMap(event evt){
myMap.setCenter(marker.getLat(), marker.getLng());
}
Can someone explain me why the first method doesn't work and what a possible solution to this problem can be? THANKS IN ADVANCE
Hello.
Sorry, it seems gmaps did not update center attribute when map moved. The workaround is to update gmaps center attribute manually when map moved, for example:
<gmaps id="map">
<attribute name="onMapMove">
map.setCenter(event.getLat(), event.getLng());
</attribute>
</gmaps>
I've created the issue here. If the workaround does not solve your problem, please tell us. Thanks.
Asked: 2014-05-06 21:04:52 +0800
Seen: 15 times
Last updated: May 07 '14