Skip to content

Map.refreshLayout()

wf9a5m75 edited this page Sep 28, 2014 · 3 revisions

Force recalculate the map view location when the map is embedded. Also updates the touchable regions internally.

So when you update the children size inside the map div, you should call this method.

###Code (with jQuery Mobile)

  /**
   * jQuery Mobile's panel feature uses CSS transition,
   * However this plugin can not detect when CSS transition is started.
   * 
   * For better performance, hide the map before transition,
   * then show it again after the transition is finished.
   */
  function hideMap() {
    map.setVisible(false);
  }
  
  function showMap() {
    // Map.refreshLayout() changes the map position forcely.
    // It causes slow or hang up on iOS,
    // so do not use too much.
    map.refreshLayout();
    
    map.setVisible(true);
  }
  
  $("#menulist").panel({
    "beforeclose": hideMap,
    "close": showMap,
    "beforeopen": hideMap,
    "open": showMap
  });

Join the official community

New versions will be announced through the official community. Stay tune!

Do you have a question or feature request?

Feel free to ask me on the issues tracker.

Or on the official community is also welcome!


New version 2.0-beta2 is available.

The cordova-googlemaps-plugin v2.0 has more faster, more features.

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md

Clone this wiki locally