[OpenLayers-Commits] r12179 - addins/bookmark/trunk/lib/OpenLayers/Control

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Jul 22 11:10:35 EDT 2011


Author: hpbrantley
Date: 2011-07-22 08:10:34 -0700 (Fri, 22 Jul 2011)
New Revision: 12179

Modified:
   addins/bookmark/trunk/lib/OpenLayers/Control/Bookmark.js
Log:
Correct condition on add when limit reached and allowDuplicates is false.


Modified: addins/bookmark/trunk/lib/OpenLayers/Control/Bookmark.js
===================================================================
--- addins/bookmark/trunk/lib/OpenLayers/Control/Bookmark.js	2011-07-21 13:56:05 UTC (rev 12178)
+++ addins/bookmark/trunk/lib/OpenLayers/Control/Bookmark.js	2011-07-22 15:10:34 UTC (rev 12179)
@@ -169,15 +169,15 @@
      * {Boolean} false if limit reached. true if added successfully.
      */
     add: function(label, bounds, func, param) {
+      if(this.allowDuplicates != false) {
+        if(this.find(label) != false) {
+            this.remove(label, true);
+        }
+      }
       if(this.stack.length == this.limit && this.limit != 0) {
          OpenLayers.Console.log("limit reached");
          return false;  // limit reached
       }
-      if(!this.allowDuplicates) {
-        if(this.find(label)) {
-            this.remove(label, true);
-        }
-      }
       func = (typeof func == "undefined") ? function() {} : func;
       param = (typeof param == "undefined" || param.length == 0) ? "" : param;
       label = (label == "undefined" || label.length == 0) ? "NONAME" : label;
@@ -332,7 +332,7 @@
      * {Boolean} False if not found
      */
     zoomToLabel: function(label) {
-      f = this.find(label);
+      var f = this.find(label);
       if(f != false) {
          OpenLayers.Console.log(f[0][1] + " found");
          this.zoomToId(f[0][0]);
@@ -448,7 +448,7 @@
      */
     load: function() {
       var allCookies=document.cookie.split(";");
-      f = this.check();
+      var f = this.check();
       if(f != false) {
          var items = f.split(this.cookieDelimiter);
          for(var ii in items) {



More information about the Commits mailing list