Display undo title in button

This commit is contained in:
Tom MacWright
2012-11-05 13:21:24 -05:00
parent 91cb8cd83e
commit 84e54112e1
7 changed files with 33 additions and 15 deletions
+9 -1
View File
@@ -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
View File
@@ -15,7 +15,7 @@
+&nbsp;Place</button><button id='road'>
+&nbsp;Road</button><button id='area'>
+&nbsp;Area</button><button class='mini' id='undo'>
&larr;</button><button class='mini' id='redo'>
&larr; <small></small></button><button class='mini' id='redo'>
&rarr;</button><input type='text' id='geocode-location' placeholder='find a place' />
<div class='zoombuttons'>
<button class='zoom-in'>+</button><button class='zoom-out'>&ndash;</button>
+5
View File
@@ -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() {
};
+2 -1
View File
@@ -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();
};
+2
View File
@@ -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
View File
@@ -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
View File
@@ -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');
};