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,4 +1,6 @@
import * as d3 from 'd3';
import { t } from '../util/locale';
import { getDimensions } from '../util/dimensions';
import _ from 'lodash';
import { AddMidpoint, Connect, MoveNode, Noop } from '../actions/index';
import { Browse, Select } from './index';
@@ -104,7 +106,7 @@ export function DragNode(context) {
var nudge = childOf(context.container().node(),
d3.event.sourceEvent.toElement) &&
edge(d3.event.point, context.map().dimensions());
edge(d3.event.point, getDimensions(context.map()));
if (nudge) startNudge(nudge);
else stopNudge();
+5 -2
View File
@@ -1,4 +1,7 @@
import { d3keybinding } from '../../js/lib/d3.keybinding.js';
import * as d3 from 'd3';
import { t } from '../util/locale';
import { getDimensions } from '../util/dimensions';
import { Browse, Select } from './index';
import { Move as MoveAction, Noop } from '../actions/index';
import { Edit } from '../behavior/index';
@@ -9,7 +12,7 @@ export function Move(context, entityIDs, baseGraph) {
button: 'browse'
};
var keybinding = d3.keybinding('move'),
var keybinding = d3keybinding('move'),
edit = Edit(context),
annotation = entityIDs.length === 1 ?
t('operations.move.annotation.' + context.geometry(entityIDs[0])) :
@@ -57,7 +60,7 @@ export function Move(context, entityIDs, baseGraph) {
context.overwrite(action, annotation);
var nudge = edge(currMouse, context.map().dimensions());
var nudge = edge(currMouse, getDimensions(context.map()));
if (nudge) startNudge(nudge);
else stopNudge();
}
+4 -2
View File
@@ -1,3 +1,5 @@
import { d3keybinding } from '../../js/lib/d3.keybinding.js';
import * as d3 from 'd3';
import { t } from '../util/locale';
import _ from 'lodash';
import { Browse, Select } from './index';
@@ -10,7 +12,7 @@ export function RotateWay(context, wayId) {
button: 'browse'
};
var keybinding = d3.keybinding('rotate-way'),
var keybinding = d3keybinding('rotate-way'),
edit = Edit(context);
mode.enter = function() {
@@ -20,7 +22,7 @@ export function RotateWay(context, wayId) {
way = context.graph().entity(wayId),
nodes = _.uniq(context.graph().childNodes(way)),
points = nodes.map(function(n) { return context.projection(n.loc); }),
pivot = d3.geom.polygon(points).centroid(),
pivot = d3.polygonCentroid(points),
angle;
context.perform(
+1
View File
@@ -1,3 +1,4 @@
import * as d3 from 'd3';
import { t } from '../util/locale';
import _ from 'lodash';
import { Commit, Conflicts, Loading, Success } from '../ui/index';
+3 -1
View File
@@ -1,3 +1,5 @@
import { d3keybinding } from '../../js/lib/d3.keybinding.js';
import * as d3 from 'd3';
import { t } from '../util/locale';
import _ from 'lodash';
import * as Operations from '../operations/index';
@@ -16,7 +18,7 @@ export function Select(context, selectedIDs) {
button: 'browse'
};
var keybinding = d3.keybinding('select'),
var keybinding = d3keybinding('select'),
timeout = null,
behaviors = [
Copy(context),