Browse Source

HUE-3572 [editor] Map chart is broken

Enrico Berti 9 years ago
parent
commit
cd68e9b
1 changed files with 10 additions and 8 deletions
  1. 10 8
      desktop/core/src/desktop/static/desktop/js/ko.charts.js

+ 10 - 8
desktop/core/src/desktop/static/desktop/js/ko.charts.js

@@ -405,7 +405,7 @@
                 attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
               }
               if (LeafletGlobals) {
-                tileLayerOptions = LeafletGlobals
+                tileLayerOptions = LeafletGlobals;
               }
               L.tileLayer(tileLayerOptions.layer, {
                 attribution: $(element).width() > 300 ? tileLayerOptions.attribution : ''
@@ -485,14 +485,16 @@
               }
             });
 
-            _map.addLayer(_clusterGroup);
-            if (! $("#command" + $(element).parents(".card-widget").attr("id")).is(":checked")) {
-              _map.fitBounds(_clusterGroup.getBounds());
-            }
+            window.setTimeout(function(){
+              _map.addLayer(_clusterGroup);
+              if (! $("#command" + $(element).parents(".card-widget").attr("id")).is(":checked")) {
+                _map.fitBounds(_clusterGroup.getBounds());
+              }
+              if (_options.onComplete != null) {
+                _options.onComplete();
+              }
+            }, 0);
 
-            if (_options.onComplete != null) {
-              _options.onComplete();
-            }
           }
           catch (err) {
             $.jHueNotify.error(err.message);