Use checkpoints to reset history to known states in walkthrough

This commit is contained in:
Bryan Housel
2017-03-22 22:32:44 -04:00
parent 833a67f399
commit 8200cbb1f4
5 changed files with 25 additions and 9 deletions

View File

@@ -18,7 +18,7 @@ export function uiIntroArea(context, reveal) {
var playground = [-85.63552, 41.94159],
corner = [-85.63565411045074, 41.9417715536927];
// context.map().centerZoom(playground, 19);
context.history().reset('initial');
context.map().zoom(19).centerEase(playground);
reveal('button.add-area',
@@ -104,5 +104,11 @@ export function uiIntroArea(context, reveal) {
};
chapter.restart = function() {
chapter.exit();
chapter.enter();
};
return utilRebind(chapter, dispatch, 'on');
}

View File

@@ -105,6 +105,7 @@ export function uiIntro(context) {
context.connection().toggle(false).reset();
context.history().reset();
context.history().merge(d3.values(coreGraph().load(introGraph).entities));
context.history().checkpoint('initial');
context.background().bing();
d3.selectAll('#map .layer-background').style('opacity', 1);

View File

@@ -35,7 +35,7 @@ export function uiIntroLine(context, reveal) {
chapter.enter = function() {
// context.map().centerZoom(start, 18);
context.history().reset('initial');
context.map().zoom(18).centerEase(start);
reveal('button.add-line',
@@ -177,12 +177,6 @@ export function uiIntroLine(context, reveal) {
};
chapter.restart = function() {
chapter.exit();
chapter.enter();
};
chapter.exit = function() {
d3.select(window).on('mousedown.intro', null, true);
d3.select('#curtain').style('pointer-events', 'none');
@@ -197,5 +191,12 @@ export function uiIntroLine(context, reveal) {
}
};
chapter.restart = function() {
chapter.exit();
chapter.enter();
};
return utilRebind(chapter, dispatch, 'on');
}

View File

@@ -25,6 +25,7 @@ export function uiIntroNavigation(context, reveal) {
chapter.enter = function() {
context.history().reset('initial');
dragMap();
function dragMap() {

View File

@@ -26,7 +26,7 @@ export function uiIntroPoint(context, reveal) {
chapter.enter = function() {
// context.map().centerZoom([-85.63279, 41.94394], 19);
context.history().reset('initial');
context.map().zoom(19).centerEase([-85.63279, 41.94394]);
reveal('button.add-point',
@@ -178,5 +178,12 @@ export function uiIntroPoint(context, reveal) {
.on('keydown.intro', null);
};
chapter.restart = function() {
chapter.exit();
chapter.enter();
};
return utilRebind(chapter, dispatch, 'on');
}