mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 22:48:10 +02:00
Merge pull request #88 from pgiraud/inspector_close_button
Adding a close button to the inspector, See #85
This commit is contained in:
@@ -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
@@ -59,7 +59,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
|
||||
@@ -360,7 +364,7 @@ iD.Map = function(elem) {
|
||||
selection = null;
|
||||
if (hadSelection) {
|
||||
drawVector();
|
||||
d3.select('.inspector-wrap').style('display', 'none');
|
||||
hideInspector();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,6 +385,11 @@ iD.Map = function(elem) {
|
||||
map.operate(iD.operations.remove(d));
|
||||
});
|
||||
|
||||
inspector.on('close', function(d) {
|
||||
deselectClick();
|
||||
hideInspector();
|
||||
});
|
||||
|
||||
var translateStart;
|
||||
|
||||
function zoomPan() {
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user