Begin d3 v4 update

This commit is contained in:
Tom MacWright
2016-08-12 10:29:00 -04:00
parent 36a90b4f86
commit cdb533fa84
137 changed files with 842 additions and 6691 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
import { rebind } from '../../util/rebind';
import * as d3 from 'd3';
import { t } from '../../util/locale';
import { icon, pad } from './helper';
@@ -87,5 +89,5 @@ export function area(context, reveal) {
d3.select('.preset-search-input').on('keyup.intro', null);
};
return d3.rebind(step, event, 'on');
return rebind(step, event, 'on');
}
+3 -1
View File
@@ -1,3 +1,4 @@
import * as d3 from 'd3';
import { t } from '../../util/locale';
import { Entity, Graph } from '../../core/index';
import { Browse } from '../../modes/index';
@@ -6,6 +7,7 @@ import { line } from './line';
import { navigation } from './navigation';
import { point } from './point';
import { startEditing } from './start_editing';
import { d3curtain } from '../../util/curtain';
import { default as introGraphRaw } from '../../../data/intro_graph.json';
var sampleIntros = {
@@ -104,7 +106,7 @@ export function intro(context) {
d3.selectAll('#map .layer-background').style('opacity', 1);
var curtain = d3.curtain();
var curtain = d3curtain();
selection.call(curtain);
function reveal(box, text, options) {
+10 -7
View File
@@ -1,3 +1,6 @@
import { rebind } from '../../util/rebind';
import { bindOnce } from '../../util/bind_once';
import * as d3 from 'd3';
import { t } from '../../util/locale';
import _ from 'lodash';
import { icon, pad } from './helper';
@@ -113,7 +116,7 @@ export function line(context, reveal) {
d3.select('#curtain').style('pointer-events', 'none');
var road = d3.select('.preset-category-road .preset-list-button');
reveal(road.node(), t('intro.lines.road'));
road.one('click.intro', roadCategory);
bindOnce(road, 'click.intro', roadCategory);
}, 500);
}
@@ -121,10 +124,10 @@ export function line(context, reveal) {
timeout(function() {
var grid = d3.select('.subgrid');
reveal(grid.node(), t('intro.lines.residential'));
grid.selectAll(':not(.preset-highway-residential) .preset-list-button')
.one('click.intro', retryPreset);
grid.selectAll('.preset-highway-residential .preset-list-button')
.one('click.intro', roadDetails);
bindOnce(grid.selectAll(':not(.preset-highway-residential) .preset-list-button'),
'click.intro', retryPreset);
bindOnce(grid.selectAll('.preset-highway-residential .preset-list-button'),
'click.intro', roadDetails);
}, 500);
}
@@ -133,7 +136,7 @@ export function line(context, reveal) {
timeout(function() {
var preset = d3.select('.entity-editor-pane .preset-list-button');
reveal(preset.node(), t('intro.lines.wrong_preset'));
preset.one('click.intro', presetCategory);
bindOnce(preset, 'click.intro', presetCategory);
}, 500);
}
@@ -155,5 +158,5 @@ export function line(context, reveal) {
context.history().on('change.intro', null);
};
return d3.rebind(step, event, 'on');
return rebind(step, event, 'on');
}
+3 -1
View File
@@ -1,3 +1,5 @@
import { rebind } from '../../util/rebind';
import * as d3 from 'd3';
import { t } from '../../util/locale';
import _ from 'lodash';
import { icon, pointBox } from './helper';
@@ -112,5 +114,5 @@ export function navigation(context, reveal) {
.on('keyup.intro', null);
};
return d3.rebind(step, event, 'on');
return rebind(step, event, 'on');
}
+4 -2
View File
@@ -1,3 +1,5 @@
import { rebind } from '../../util/rebind';
import * as d3 from 'd3';
import { t } from '../../util/locale';
import { icon, pad } from './helper';
@@ -135,7 +137,7 @@ export function point(context, reveal) {
}
function deleted(changed) {
if (changed.deleted().length) event.done();
if (changed.deleted().length) event.call("done");
}
};
@@ -151,5 +153,5 @@ export function point(context, reveal) {
.on('keydown.intro', null);
};
return d3.rebind(step, event, 'on');
return rebind(step, event, 'on');
}
+4 -2
View File
@@ -1,3 +1,5 @@
import { rebind } from '../../util/rebind';
import * as d3 from 'd3';
import { t } from '../../util/locale';
import { icon } from './helper';
import { modal } from '../modal';
@@ -48,7 +50,7 @@ export function startEditing(context, reveal) {
startbutton.append('h2')
.text(t('intro.startediting.start'));
event.startEditing();
event.call("startEditing");
}, 10500);
};
@@ -57,5 +59,5 @@ export function startEditing(context, reveal) {
timeouts.forEach(window.clearTimeout);
};
return d3.rebind(step, event, 'on');
return rebind(step, event, 'on');
}