From 21526aff2abe7eb2c7dc027ba09ed5e3517d42b9 Mon Sep 17 00:00:00 2001 From: Rowan Hogan Date: Mon, 15 Jun 2015 09:38:07 +1000 Subject: [PATCH] Syncs minimap toggle button and keyboard shortcut (using same method). --- js/id/ui/background.js | 2 -- js/id/ui/map_in_map.js | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/js/id/ui/background.js b/js/id/ui/background.js index 3a674d66c..d6236553b 100644 --- a/js/id/ui/background.js +++ b/js/id/ui/background.js @@ -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(); }); diff --git a/js/id/ui/map_in_map.js b/js/id/ui/map_in_map.js index 5aff866d9..27cbc232c 100644 --- a/js/id/ui/map_in_map.js +++ b/js/id/ui/map_in_map.js @@ -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); } }