]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/assets/iD/iD.js
Update to iD v2.12.1
[rails.git] / vendor / assets / iD / iD.js
index b80275e1bfac981468c94816d0902f7678ae9427..aad2e1f05e4c9d8e0f012437cc36db8aa58d2366 100644 (file)
       };
 
 
-      tooltip.destroy = function(selection$$1) {
+      tooltip.destroy = function(selection$$1, selector$$1) {
+          // by default, just destroy the current tooltip
+          selector$$1 = selector$$1 || '.tooltip-' + _id;
+
           selection$$1
               .on('mouseenter.tooltip', null)
               .on('mouseleave.tooltip', null)
                   return this.getAttribute('data-original-title') || this.getAttribute('title');
               })
               .attr('data-original-title', null)
-              .selectAll('.tooltip-' + _id)
+              .selectAll(selector$$1)
               .remove();
       };
 
 
+      tooltip.destroyAny = function(selection$$1) {
+          selection$$1.call(tooltip.destroy, '.tooltip');
+      };
+
+
       function setup() {
           var root = select(this);
           var animate = _animation.apply(this, arguments);
           // Setup data layers (only OSM)
           var layers = context.layers();
           layers.all().forEach(function(item) {
-              item.layer.enabled(item.id === 'osm');
+              // if the layer has the function `enabled`
+              if (typeof item.layer.enabled === 'function') {
+                  item.layer.enabled(item.id === 'osm');
+              }
           });
 
           // Mock geocoder
               var description = d.description();
               var isOverflowing = (span.property('clientWidth') !== span.property('scrollWidth'));
 
+              item.call(tooltip().destroyAny);
+
               if (d === _previousBackground) {
                   item.call(tooltip()
                       .placement(placement)
                       .placement(placement)
                       .title(description || d.name())
                   );
-              } else {
-                  item.call(tooltip().destroy);
               }
           });
       }
 
   function coreContext() {
       var context = {};
-      context.version = '2.12.0';
+      context.version = '2.12.1';
 
       // create a special translation that contains the keys in place of the strings
       var tkeys = cloneDeep(en);