Adding a close button to the inspector, See #85

This commit is contained in:
Pierre GIRAUD
2012-11-15 22:53:49 +01:00
parent ca55c8d88c
commit 7fcae51b0c
3 changed files with 28 additions and 3 deletions
+8
View File
@@ -191,3 +191,11 @@ button small {
padding:0;
border-spacing:0;
}
.inspector-wrap .close {
border: 0;
position: absolute;
top: 0;
right: 0;
cursor: pointer;
}
+11 -2
View File
@@ -52,7 +52,11 @@ iD.Map = function(elem) {
},
key = function(d) { return d.id; };
d3.select('.inspector-wrap').style('display', 'none');
function hideInspector() {
d3.select('.inspector-wrap').style('display', 'none');
}
hideInspector();
var messages = d3.select('.messages');
// Containers
@@ -355,7 +359,7 @@ iD.Map = function(elem) {
selection = null;
if (hadSelection) {
drawVector();
d3.select('.inspector-wrap').style('display', 'none');
hideInspector();
}
}
@@ -376,6 +380,11 @@ iD.Map = function(elem) {
map.operate(iD.operations.remove(d));
});
inspector.on('close', function(d) {
deselectClick();
hideInspector();
});
var translateStart;
function zoomPan() {
+9 -1
View File
@@ -1,5 +1,5 @@
iD.Inspector = function(graph) {
var event = d3.dispatch('change', 'update', 'remove');
var event = d3.dispatch('change', 'update', 'remove', 'close');
function inspector(selection) {
// http://jsfiddle.net/7WQjr/
@@ -7,6 +7,14 @@ iD.Inspector = function(graph) {
// TODO: there must be a better way to do this.
d3.select(this).node().innerHTML = '';
d3.select(this).append('button')
.text('x')
.attr('title', 'close')
.attr('class', 'close')
.on('click', function() {
event.close(d);
});
var head = d3.select(this)
.append('div')
.attr('class', 'head');