mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 15:08:23 +02:00
Display undo title in button
This commit is contained in:
+9
-1
@@ -131,7 +131,15 @@ table td {
|
||||
|
||||
#bar button.mini,
|
||||
#bar button.mini {
|
||||
width:50px;
|
||||
width:auto;
|
||||
}
|
||||
|
||||
button small {
|
||||
display: inline-block;
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
line-height: 30px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#bar input[type=text] {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
+ Place</button><button id='road'>
|
||||
+ Road</button><button id='area'>
|
||||
+ Area</button><button class='mini' id='undo'>
|
||||
←</button><button class='mini' id='redo'>
|
||||
← <small></small></button><button class='mini' id='redo'>
|
||||
→</button><input type='text' id='geocode-location' placeholder='find a place' />
|
||||
<div class='zoombuttons'>
|
||||
<button class='zoom-in'>+</button><button class='zoom-out'>–</button>
|
||||
|
||||
@@ -6,4 +6,9 @@ iD.UI.bind = function() {
|
||||
area: d3.select('button#area'),
|
||||
road: d3.select('button#road')
|
||||
};
|
||||
|
||||
this.undoText = d3.select('button#undo small');
|
||||
};
|
||||
|
||||
iD.UI.update = function() {
|
||||
};
|
||||
|
||||
@@ -5,5 +5,6 @@ iD.operations.addNode = function(map, node) {
|
||||
var o = {};
|
||||
o[node.id] = node;
|
||||
return graph.set(o);
|
||||
}, 'Added a new unidentified place');
|
||||
}, 'added a place');
|
||||
map.update();
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/*
|
||||
iD.Node = function(id, lat, lon, tags, loaded) {
|
||||
this.id = id;
|
||||
this.lat = lat;
|
||||
@@ -17,3 +18,4 @@ iD.Node.prototype = {
|
||||
(this.lat >= extent[1][1]);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@
|
||||
|
||||
iD.Way = {
|
||||
isClosed: function(w) {
|
||||
if (!w.nodes.length) return true;
|
||||
return w.nodes[w.nodes.length - 1] === w.nodes[0];
|
||||
return (!w.nodes.length) || w.nodes[w.nodes.length - 1] === w.nodes[0];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+13
-10
@@ -12,7 +12,7 @@ iD.Map = function(elem) {
|
||||
|
||||
var map = {},
|
||||
width, height,
|
||||
dispatch = d3.dispatch('move'),
|
||||
dispatch = d3.dispatch('move', 'update'),
|
||||
// data
|
||||
graph = new iD.Graph(),
|
||||
connection = new iD.Connection(graph),
|
||||
@@ -141,14 +141,12 @@ iD.Map = function(elem) {
|
||||
|
||||
// Markers
|
||||
markers.exit().remove();
|
||||
|
||||
markers.enter().append('image')
|
||||
.attr('class', class_marker)
|
||||
.on('click', selectClick)
|
||||
.attr({ width: 16, height: 16 })
|
||||
.attr('xlink:href', iD.Style.markerimage)
|
||||
.call(dragbehavior);
|
||||
|
||||
markers.attr('transform', function(d) {
|
||||
var pt = projection([d.lon, d.lat]);
|
||||
pt[0] -= 8;
|
||||
@@ -204,8 +202,8 @@ iD.Map = function(elem) {
|
||||
|
||||
function zoomPan() {
|
||||
projection
|
||||
.translate(d3.event.translate)
|
||||
.scale(d3.event.scale);
|
||||
.translate(d3.event.translate)
|
||||
.scale(d3.event.scale);
|
||||
redraw();
|
||||
}
|
||||
|
||||
@@ -220,6 +218,13 @@ iD.Map = function(elem) {
|
||||
}
|
||||
}
|
||||
|
||||
// UI elements
|
||||
// -----------
|
||||
var undolabel = d3.select('button#undo small');
|
||||
dispatch.on('update', function() {
|
||||
undolabel.text(graph.annotations[graph.annotations.length - 1]);
|
||||
});
|
||||
|
||||
// Getters & setters for map state
|
||||
// -------------------------------
|
||||
// The map state can be expressed entirely as the combination
|
||||
@@ -312,10 +317,8 @@ iD.Map = function(elem) {
|
||||
map.graph = graph;
|
||||
map.surface = surface;
|
||||
|
||||
setSize(
|
||||
parent.node().offsetWidth,
|
||||
parent.node().offsetHeight);
|
||||
redraw();
|
||||
setSize(parent.node().offsetWidth, parent.node().offsetHeight);
|
||||
redraw();
|
||||
|
||||
return d3.rebind(map, dispatch, 'on');
|
||||
return d3.rebind(map, dispatch, 'on', 'move', 'update');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user