From 509464c932046551679b6d7b5cb382ea4faefc82 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 8 Nov 2018 14:07:06 -0500 Subject: [PATCH] Don't allow user to toggle sidebar in the walkthrough (this would mess up all the tooltips) --- modules/ui/intro/intro.js | 14 +++++++++----- modules/ui/sidebar.js | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/ui/intro/intro.js b/modules/ui/intro/intro.js index 39ed10db2..bdc85d23d 100644 --- a/modules/ui/intro/intro.js +++ b/modules/ui/intro/intro.js @@ -106,15 +106,18 @@ export function uiIntro(context) { callback(null, t('intro.graph.countrycode')); }; + // Disable the sidebar resizing button + d3_selectAll('button.sidebar-toggle').classed('disabled', true); + d3_selectAll('#map .layer-background').style('opacity', 1); var curtain = uiCurtain(); selection.call(curtain); - // store that the user started the walkthrough.. + // Store that the user started the walkthrough.. context.storage('walkthrough_started', 'yes'); - // restore previous walkthrough progress.. + // Restore previous walkthrough progress.. var storedProgress = context.storage('walkthrough_progress') || ''; var progress = storedProgress.split(';').filter(Boolean); @@ -133,7 +136,7 @@ export function uiIntro(context) { .classed('next', true); } - // store walkthrough progress.. + // Store walkthrough progress.. progress.push(chapter); context.storage('walkthrough_progress', _uniq(progress).join(';')); }); @@ -141,11 +144,11 @@ export function uiIntro(context) { }); chapters[chapters.length - 1].on('startEditing', function() { - // store walkthrough progress.. + // Store walkthrough progress.. progress.push('startEditing'); context.storage('walkthrough_progress', _uniq(progress).join(';')); - // store if walkthrough is completed.. + // Store if walkthrough is completed.. var incomplete = _difference(chapterFlow, progress); if (!incomplete.length) { context.storage('walkthrough_completed', 'yes'); @@ -154,6 +157,7 @@ export function uiIntro(context) { curtain.remove(); navwrap.remove(); d3_selectAll('#map .layer-background').style('opacity', opacity); + d3_selectAll('button.sidebar-toggle').classed('disabled', false); if (osm) { osm.toggle(true).reset().caches(caches); } context.history().reset().merge(_values(baseEntities)); context.background().baseLayerSource(background); diff --git a/modules/ui/sidebar.js b/modules/ui/sidebar.js index cf5064bdc..c678a44ba 100644 --- a/modules/ui/sidebar.js +++ b/modules/ui/sidebar.js @@ -258,6 +258,9 @@ export function uiSidebar(context) { e.preventDefault(); } + // Don't allow sidebar to toggle when the user is in the walkthrough. + if (context.inIntro()) return; + var isCollapsed = selection.classed('collapsed'); var isCollapsing = !isCollapsed; var xMarginProperty = textDirection === 'rtl' ? 'margin-right' : 'margin-left';