Persist area-fill-toggle so we can toggle out of wireframe

(closes #4740)
This commit is contained in:
Bryan Housel
2018-01-24 14:53:30 -05:00
parent 300616819d
commit fb196bee8c
2 changed files with 15 additions and 9 deletions

View File

@@ -30,7 +30,7 @@ export function uiBackground(context) {
var key = t('background.key');
var _customSource = context.background().findSource('custom');
var _previousBackground = context.background().findSource(context.storage('background-previous-last-used'));
var _previousBackground = context.background().findSource(context.storage('background-last-used-toggle'));
var _shown = false;
var _backgroundList = d3_select(null);
@@ -92,7 +92,7 @@ export function uiBackground(context) {
d3_event.preventDefault();
_previousBackground = context.background().baseLayerSource();
context.storage('background-previous-last-used', _previousBackground.id);
context.storage('background-last-used-toggle', _previousBackground.id);
context.storage('background-last-used', d.id);
context.background().baseLayerSource(d);
_backgroundList.call(updateLayerSelections);

View File

@@ -20,8 +20,7 @@ export function uiMapData(context) {
var layers = context.layers();
var fills = ['wireframe', 'partial', 'full'];
var _fillDefault = context.storage('area-fill') || 'partial';
var _fillSelected = _fillDefault !== 'wireframe' ? _fillDefault : 'partial';
var _fillSelected = context.storage('area-fill') || 'partial';
var _shown = false;
var _dataLayerContainer = d3_select(null);
var _fillList = d3_select(null);
@@ -55,10 +54,10 @@ export function uiMapData(context) {
});
_fillSelected = d;
if (d !== 'wireframe') {
_fillDefault = d;
}
context.storage('area-fill', d);
if (d !== 'wireframe') {
context.storage('area-fill-toggle', d);
}
update();
}
@@ -385,7 +384,14 @@ export function uiMapData(context) {
d3_event.preventDefault();
d3_event.stopPropagation();
}
setFill((_fillSelected === 'wireframe' ? _fillDefault : 'wireframe'));
if (_fillSelected === 'wireframe') {
_fillSelected = context.storage('area-fill-toggle') || 'partial';
} else {
_fillSelected = 'wireframe';
}
setFill(_fillSelected);
context.map().pan([0,0]); // trigger a redraw
}
@@ -489,7 +495,7 @@ export function uiMapData(context) {
.on('change.map_data-update', update);
update();
setFill(_fillDefault);
setFill(_fillSelected);
var keybinding = d3_keybinding('features')
.on(key, togglePane)