Syncs minimap toggle button and keyboard shortcut (using same method).

This commit is contained in:
Rowan Hogan
2015-06-15 09:38:07 +10:00
parent fb34b953b8
commit 21526aff2a
2 changed files with 8 additions and 2 deletions

View File

@@ -261,9 +261,7 @@ iD.ui.Background = function(context) {
.append('input')
.attr('type', 'checkbox')
.on('change', function() {
var exp = label.classed('active');
iD.ui.MapInMap.toggle();
label.classed('active', !exp);
d3.event.preventDefault();
});

View File

@@ -244,6 +244,8 @@ iD.ui.MapInMap = function(context) {
function toggle() {
if (d3.event) d3.event.preventDefault();
var label = d3.select('.minimap-toggle');
if (hidden()) {
selection
.style('display', 'block')
@@ -252,6 +254,9 @@ iD.ui.MapInMap = function(context) {
.duration(200)
.style('opacity', 1);
label.classed('active', true)
.select('input').property('checked', true);
redraw();
} else {
@@ -264,6 +269,9 @@ iD.ui.MapInMap = function(context) {
.each('end', function() {
d3.select(this).style('display', 'none');
});
label.classed('active', false)
.select('input').property('checked', false);
}
}