Honor the user's third party icon preference

This commit is contained in:
Bryan Housel
2019-12-18 17:46:21 -05:00
parent a47029897b
commit 7f2c2062b0
2 changed files with 7 additions and 5 deletions
+4 -4
View File
@@ -10,7 +10,7 @@ import { uiTooltipHtml } from './tooltipHtml';
export function uiPreferences(context) {
const key = t('preferences.key');
let _pane = d3_select(null);
let _showThirdPartyIcons = context.storage('preferences.privacy.thirdpartyicons') || true;
let _showThirdPartyIcons = context.storage('preferences.privacy.thirdpartyicons') || 'true';
const paneTooltip = tooltip()
.placement((textDirection === 'rtl') ? 'right' : 'left')
@@ -40,7 +40,7 @@ export function uiPreferences(context) {
.attr('type', 'checkbox')
.on('change', () => {
d3_event.preventDefault();
_showThirdPartyIcons = !_showThirdPartyIcons;
_showThirdPartyIcons = (_showThirdPartyIcons === 'true') ? 'false' : 'true';
context.storage('preferences.privacy.thirdpartyicons', _showThirdPartyIcons);
update();
});
@@ -68,9 +68,9 @@ export function uiPreferences(context) {
function update() {
selection.selectAll('.privacy-third-party-icons-item')
.classed('active', _showThirdPartyIcons)
.classed('active', (_showThirdPartyIcons === 'true'))
.select('input')
.property('checked', _showThirdPartyIcons);
.property('checked', (_showThirdPartyIcons === 'true'));
}
}
+3 -1
View File
@@ -231,8 +231,10 @@ export function uiPresetIcon(context) {
if (geom === 'relation' && p.tags && ((p.tags.type === 'route' && p.tags.route && routeSegments[p.tags.route]) || p.tags.type === 'waterway')) {
geom = 'route';
}
const showThirdPartyIcons = context.storage('preferences.privacy.thirdpartyicons') || 'true';
const isFallback = isSmall() && p.isFallback && p.isFallback();
const imageURL = p.imageURL;
const imageURL = (showThirdPartyIcons === 'true') && p.imageURL;
const picon = getIcon(p, geom);
const isMaki = picon && /^maki-/.test(picon);
const isTemaki = picon && /^temaki-/.test(picon);