Merge branch 'master' of github.com:systemed/iD

This commit is contained in:
Tom MacWright
2013-03-27 14:59:32 -04:00
4 changed files with 54 additions and 15 deletions

View File

@@ -32,4 +32,7 @@ en:
road: "**Select Road from the grid**"
residential: "There are different types of roads, the most common of which is Residential. **Choose the Residential road type**"
describe: "**Name the road and close the feature editor.**"
startediting:
help: "More documentation and this walkthrough are available here."
save: "Don't forget to regularly save your changes!"

View File

@@ -107,6 +107,7 @@
<script src='js/id/ui/intro/point.js'></script>
<script src='js/id/ui/intro/area.js'></script>
<script src='js/id/ui/intro/line.js'></script>
<script src='js/id/ui/intro/start_editing.js'></script>
<script src='js/id/actions.js'></script>
<script src="js/id/actions/add_midpoint.js"></script>

View File

@@ -18,12 +18,17 @@ iD.ui.intro = function(context) {
context.history().reset();
context.history().merge(iD.Graph().load(JSON.parse(iD.introGraph)).entities);
// Block saving
var savebutton = d3.select('#bar button.save'),
save = savebutton.on('click');
savebutton.on('click', null);
d3.select('.layer-layer:first-child').style('opacity', 1);
var curtain = d3.curtain();
selection.call(curtain);
var steps = ['navigation', 'point', 'area', 'line'].map(function(step, i) {
var steps = ['navigation', 'point', 'area', 'line', 'startEditing'].map(function(step, i) {
var s = iD.ui.intro[step](context, curtain)
.on('done', function() {
entered.filter(function(d) {
@@ -34,17 +39,15 @@ iD.ui.intro = function(context) {
return s;
});
steps.push({
name: 'Start Editing',
enter: function() {
curtain.remove();
navwrap.remove();
d3.select('.layer-layer:first-child').style('opacity', opacity);
context.connection().toggle(true).flush().loadedTiles(loadedTiles);
context.history().reset().merge(baseEntities);
if (history) context.history().fromJSON(history);
window.location.replace(hash);
}
steps[steps.length - 1].on('startEditing', function() {
curtain.remove();
navwrap.remove();
d3.select('.layer-layer:first-child').style('opacity', opacity);
context.connection().toggle(true).flush().loadedTiles(loadedTiles);
context.history().reset().merge(baseEntities);
if (history) context.history().fromJSON(history);
window.location.replace(hash);
d3.select('#bar button.save').on('click', save);
});
var navwrap = selection.append('div').attr('class', 'intro-nav-wrap');
@@ -56,9 +59,7 @@ iD.ui.intro = function(context) {
var entered = buttonwrap.data(steps)
.enter().append('button')
.attr('class', 'step')
.on('click', function(d) {
enter(d);
});
.on('click', enter);
entered.append('label').text(function(d) { return d.name; });
enter(steps[0]);

View File

@@ -0,0 +1,34 @@
iD.ui.intro.startEditing = function(context, curtain) {
var event = d3.dispatch('done', 'startEditing'),
timeouts = [];
var step = {
name: 'Start Editing'
};
function timeout(f, t) {
timeouts.push(window.setTimeout(f, t));
}
step.enter = function() {
curtain.reveal('.map-control.help-control', t('intro.startediting.help'));
timeout(function() {
curtain.reveal('#bar button.save', t('intro.startediting.save'));
}, 3500);
timeout(function() {
curtain.reveal('#surface', t('intro.startediting.save'));
}, 7000);
timeout(event.startEditing, 7500);
};
step.exit = function() {
timeouts.forEach(window.clearTimeout);
};
return d3.rebind(step, event, 'on');
};