Fix mixup around events so that background and geocoder close each other

This commit is contained in:
Tom MacWright
2013-03-28 18:06:12 -04:00
parent 98a05586a2
commit 1439b30049
2 changed files with 10 additions and 24 deletions

View File

@@ -140,27 +140,20 @@ iD.ui.Background = function(context) {
content.selectAll('.toggle-list li:first-child a').node().focus();
}
function blockClick() {
selection.on('mousedown.help-inside', function() {
return d3.event.stopPropagation();
});
selection.on('mousedown.help-inside', function() {
return d3.event.stopPropagation();
});
}
function setVisible(show) {
if (show !== shown) {
button.classed('active', show);
shown = show;
if (show) {
selection.on('mousedown.background-inside', function() {
return d3.event.stopPropagation();
});
content.style('display', 'block')
.style('left', '-500px')
.transition()
.duration(200)
.style('left', '30px')
.each('end', blockClick);
.style('left', '30px');
} else {
content.style('display', 'block')
.style('left', '30px')
@@ -227,7 +220,7 @@ iD.ui.Background = function(context) {
gpxLayerItem.call(bootstrap.tooltip()
.title(t('gpx.drag_drop'))
.placement('right'))
.placement('right'));
gpxLayerItem.append('span')
.text(t('gpx.local_layer'));

View File

@@ -94,15 +94,6 @@ iD.ui.Geocoder = function(context) {
setVisible(!button.classed('active'));
}
function blockClick() {
selection.on('mousedown.help-inside', function() {
return d3.event.stopPropagation();
});
selection.on('mousedown.help-inside', function() {
return d3.event.stopPropagation();
});
}
function setVisible(show) {
if (show !== shown) {
button.classed('active', show);
@@ -117,14 +108,17 @@ iD.ui.Geocoder = function(context) {
}
if (show) {
selection.on('mousedown.geocoder-inside', function() {
return d3.event.stopPropagation();
});
gcForm.style('display', 'block')
.style('left', '-500px')
.transition()
.duration(200)
.style('left', '30px')
.each('end', blockClick);
.style('left', '30px');
inputNode.node().focus();
} else {
selection.on('mousedown.geocoder-inside', null);
gcForm.style('display', 'block')
.style('left', '30px')
.transition()
@@ -133,7 +127,6 @@ iD.ui.Geocoder = function(context) {
.each('end', function() {
d3.select(this).style('display', 'none');
});
selection.on('mousedown.background-inside', null);
inputNode.node().blur();
}
}