[fusion-commits] r2747 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Jul 23 00:45:15 PDT 2013


Author: jng
Date: 2013-07-23 00:45:15 -0700 (Tue, 23 Jul 2013)
New Revision: 2747

Modified:
   trunk/widgets/Legend.js
Log:
Freeze/Thaw the legend tree when inserting nodes.

Modified: trunk/widgets/Legend.js
===================================================================
--- trunk/widgets/Legend.js	2013-07-22 02:49:32 UTC (rev 2746)
+++ trunk/widgets/Legend.js	2013-07-23 07:45:15 UTC (rev 2747)
@@ -532,6 +532,7 @@
      * update the tree when the map scale changes
      */
     _update: function() {
+        this.oTree.freeze();
         this.updateTimer = null;
         var map = this.getMap();
         var currentScale = map.getScale();
@@ -542,6 +543,7 @@
         for (var i=map.layerRoot.layers.length-1; i>=0; i--) {
             this.updateLayer(map.layerRoot.layers[i], currentScale);
         }
+        this.oTree.thaw();
     },
    
     /**
@@ -575,10 +577,9 @@
       }
     },
     addLayerStyleTreeItems: function(treeItem, items) {
-        //TODO: (Perf) Batching opportunity for JxLib if such API exists.
-        for (var i = 0; i < items.length; i++) {
-            treeItem.add(items[i]);
-        }
+        treeItem.tree.freeze();
+        treeItem.add(items);
+        treeItem.tree.thaw();
     },
     addLayerTreeItem: function(treeItem, layerTreeItem) {
         //Here's the problem: The layers are being iterated in the correct draw order, but they are



More information about the fusion-commits mailing list