Don't allow user to toggle sidebar in the walkthrough

(this would mess up all the tooltips)
This commit is contained in:
Bryan Housel
2018-11-08 14:07:06 -05:00
parent 826e08149b
commit 509464c932
2 changed files with 12 additions and 5 deletions
+9 -5
View File
@@ -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);
+3
View File
@@ -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';