]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/assets/iD/iD.js
Update to iD v1.3.9
[rails.git] / vendor / assets / iD / iD.js
index f3da45171496acf5840cf84d5fb0d903e47f7802..8ffa66d17e544cd416ab44ea22683a75800cfa90 100644 (file)
@@ -16151,7 +16151,7 @@ window.iD = function () {
     return d3.rebind(context, dispatch, 'on');
 };
 
-iD.version = '1.3.8';
+iD.version = '1.3.9';
 
 (function() {
     var detected = {};
@@ -17460,41 +17460,52 @@ iD.actions.Disconnect = function(nodeId, newNodeId) {
 
     var action = function(graph) {
         var node = graph.entity(nodeId),
-            replacements = action.replacements(graph);
+            connections = action.connections(graph);
+
+        connections.forEach(function(connection) {
+            var way = graph.entity(connection.wayID),
+                newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
 
-        replacements.forEach(function(replacement) {
-            var newNode = iD.Node({id: newNodeId, loc: node.loc, tags: node.tags});
             graph = graph.replace(newNode);
-            graph = graph.replace(graph.entity(replacement.wayID).updateNode(newNode.id, replacement.index));
+            if (connection.index === 0 && way.isArea()) {
+                // replace shared node with shared node..
+                graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
+            } else {
+                // replace shared node with multiple new nodes..
+                graph = graph.replace(way.updateNode(newNode.id, connection.index));
+            }
         });
 
         return graph;
     };
 
-    action.replacements = function(graph) {
+    action.connections = function(graph) {
         var candidates = [],
             keeping = false,
-            parents = graph.parentWays(graph.entity(nodeId));
+            parentWays = graph.parentWays(graph.entity(nodeId));
 
-        parents.forEach(function(parent) {
-            if (wayIds && wayIds.indexOf(parent.id) === -1) {
+        parentWays.forEach(function(way) {
+            if (wayIds && wayIds.indexOf(way.id) === -1) {
                 keeping = true;
                 return;
             }
-
-            parent.nodes.forEach(function(waynode, index) {
-                if (waynode === nodeId) {
-                    candidates.push({wayID: parent.id, index: index});
-                }
-            });
+            if (way.isArea() && (way.nodes[0] === nodeId)) {
+                candidates.push({wayID: way.id, index: 0});
+            } else {
+                way.nodes.forEach(function(waynode, index) {
+                    if (waynode === nodeId) {
+                        candidates.push({wayID: way.id, index: index});
+                    }
+                });
+            }
         });
 
         return keeping ? candidates : candidates.slice(1);
     };
 
     action.disabled = function(graph) {
-        var replacements = action.replacements(graph);
-        if (replacements.length === 0 || (wayIds && wayIds.length !== replacements.length))
+        var connections = action.connections(graph);
+        if (connections.length === 0 || (wayIds && wayIds.length !== connections.length))
             return 'not_connected';
     };
 
@@ -25499,7 +25510,8 @@ iD.ui.Background = function(context) {
             ['right', [-1, 0]],
             ['bottom', [0, 1]]],
         opacityDefault = (context.storage('background-opacity') !== null) ?
-            (+context.storage('background-opacity')) : 0.5;
+            (+context.storage('background-opacity')) : 0.5,
+        customTemplate;
 
     // Can be 0 from <1.3.0 use or due to issue #1923.
     if (opacityDefault === 0) opacityDefault = 0.5;
@@ -25539,15 +25551,20 @@ iD.ui.Background = function(context) {
             selectLayer();
         }
 
-        function clickCustom() {
+        function editCustom() {
             d3.event.preventDefault();
-            var template = window.prompt(t('background.custom_prompt'));
-            if (!template || template.indexOf('google.com') !== -1 ||
-               template.indexOf('googleapis.com') !== -1 ||
-               template.indexOf('google.ru') !== -1) {
+            var template = window.prompt(t('background.custom_prompt'), customTemplate);
+            if (!template ||
+                template.indexOf('google.com') !== -1 ||
+                template.indexOf('googleapis.com') !== -1 ||
+                template.indexOf('google.ru') !== -1) {
                 selectLayer();
                 return;
             }
+            setCustom(template);
+        }
+
+        function setCustom(template) {
             context.background().baseLayerSource(iD.BackgroundSource.Custom(template));
             selectLayer();
         }
@@ -25611,6 +25628,11 @@ iD.ui.Background = function(context) {
                 .property('checked', showsGpx);
 
             selectLayer();
+
+            var source = context.background().baseLayerSource();
+            if (source.id === 'custom') {
+                customTemplate = source.template;
+            }
         }
 
         function clickNudge(d) {
@@ -25717,12 +25739,27 @@ iD.ui.Background = function(context) {
             .attr('class', 'custom_layer')
             .datum(iD.BackgroundSource.Custom());
 
+        custom.append('button')
+            .attr('class', 'layer-browse')
+            .call(bootstrap.tooltip()
+                .title(t('background.custom_button'))
+                .placement('left'))
+            .on('click', editCustom)
+            .append('span')
+            .attr('class', 'icon geocode');
+
         var label = custom.append('label');
 
         label.append('input')
             .attr('type', 'radio')
             .attr('name', 'layers')
-            .on('change', clickCustom);
+            .on('change', function () {
+                if (customTemplate) {
+                    setCustom(customTemplate);
+                } else {
+                    editCustom();
+                }
+            });
 
         label.append('span')
             .text(t('background.custom'));
@@ -41654,22 +41691,23 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
             "overlay": true
         },
         {
-            "name": "MapBox Satellite",
+            "name": "MapQuest Open Aerial",
+            "type": "tms",
+            "template": "http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png",
+            "default": true
+        },
+        {
+            "name": "Mapbox Satellite",
             "type": "tms",
             "description": "Satellite and aerial imagery.",
             "template": "http://{switch:a,b,c}.tiles.mapbox.com/v3/openstreetmap.map-4wvf9l0l/{zoom}/{x}/{y}.png",
             "scaleExtent": [
                 0,
-                16
+                19
             ],
             "terms_url": "http://www.mapbox.com/about/maps/",
             "terms_text": "Terms & Feedback",
-            "default": true
-        },
-        {
-            "name": "MapQuest Open Aerial",
-            "type": "tms",
-            "template": "http://oatile{switch:1,2,3,4}.mqcdn.com/tiles/1.0.0/sat/{zoom}/{x}/{y}.png",
+            "id": "Mapbox",
             "default": true
         },
         {
@@ -65641,18 +65679,18 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                     "opening_hours"
                 ]
             },
-            "craft/photographic_labratory": {
-                "name": "Photographic Labratory",
+            "craft/photographic_laboratory": {
+                "name": "Photographic Laboratory",
                 "geometry": [
                     "point",
                     "area"
                 ],
                 "terms": [
-                    "photographic labratory",
+                    "photographic laboratory",
                     "film developer"
                 ],
                 "tags": {
-                    "craft": "photographic_labratory"
+                    "craft": "photographic_laboratory"
                 },
                 "icon": "camera",
                 "fields": [
@@ -68646,6 +68684,21 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                 ],
                 "name": "Neighborhood"
             },
+            "place/suburb": {
+                "icon": "triangle-stroked",
+                "geometry": [
+                    "point",
+                    "area"
+                ],
+                "tags": {
+                    "place": "suburb"
+                },
+                "terms": [
+                    "Boro",
+                    "Quarter"
+                ],
+                "name": "Borough"
+            },
             "place/town": {
                 "icon": "town",
                 "geometry": [
@@ -69507,7 +69560,8 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                 "tags": {
                     "shop": "fishmonger"
                 },
-                "name": "Fishmonger"
+                "name": "Fishmonger",
+                "searchable": false
             },
             "shop/florist": {
                 "icon": "shop",
@@ -69913,6 +69967,26 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                 },
                 "name": "Photography Store"
             },
+            "shop/seafood": {
+                "icon": "shop",
+                "fields": [
+                    "address",
+                    "building_area",
+                    "opening_hours"
+                ],
+                "geometry": [
+                    "point",
+                    "vertex",
+                    "area"
+                ],
+                "tags": {
+                    "shop": "seafood"
+                },
+                "terms": [
+                    "fishmonger"
+                ],
+                "name": "Seafood Shop"
+            },
             "shop/shoes": {
                 "icon": "shop",
                 "fields": [
@@ -70777,7 +70851,6 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
             "waterway/stream": {
                 "icon": "waterway-stream",
                 "fields": [
-                    "layer",
                     "tunnel"
                 ],
                 "geometry": [
@@ -112277,6 +112350,7 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
         "nl",
         "en-GB",
         "et",
+        "fil",
         "fi",
         "fr",
         "gl",
@@ -112587,7 +112661,8 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
             "percent_brightness": "{opacity}% brightness",
             "none": "None",
             "custom": "Custom",
-            "custom_prompt": "Enter a tile template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.",
+            "custom_button": "Edit custom background",
+            "custom_prompt": "Enter a tile URL template. Valid tokens are {z}, {x}, {y} for Z/X/Y scheme and {u} for quadtile scheme.",
             "fix_misalignment": "Fix alignment",
             "reset": "reset"
         },
@@ -113862,9 +113937,9 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                     "name": "Photographer",
                     "terms": "photographer"
                 },
-                "craft/photographic_labratory": {
-                    "name": "Photographic Labratory",
-                    "terms": "photographic labratory,film developer"
+                "craft/photographic_laboratory": {
+                    "name": "Photographic Laboratory",
+                    "terms": "photographic laboratory,film developer"
                 },
                 "craft/plasterer": {
                     "name": "Plasterer",
@@ -114634,6 +114709,10 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                     "name": "Neighborhood",
                     "terms": "neighbourhood"
                 },
+                "place/suburb": {
+                    "name": "Borough",
+                    "terms": "Boro,Quarter"
+                },
                 "place/town": {
                     "name": "Town",
                     "terms": ""
@@ -114946,6 +115025,10 @@ iD.introGraph = '{"n185954700":{"id":"n185954700","loc":[-85.642244,41.939081],"
                     "name": "Photography Store",
                     "terms": ""
                 },
+                "shop/seafood": {
+                    "name": "Seafood Shop",
+                    "terms": "fishmonger"
+                },
                 "shop/shoes": {
                     "name": "Shoe Store",
                     "terms": ""