mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
Refactor customEvent system to use d3.customEvent
This commit is contained in:
@@ -22,7 +22,7 @@ if (process.argv[2] === 'develop') {
|
||||
});
|
||||
|
||||
http.createServer(
|
||||
ecstatic({ root: __dirname })
|
||||
ecstatic({ root: __dirname, cache: 0 })
|
||||
).listen(8080);
|
||||
|
||||
console.log('Listening on :8080');
|
||||
|
||||
@@ -32,15 +32,8 @@ export function drag() {
|
||||
|
||||
function eventOf(thiz, argumentz) {
|
||||
return function(e1) {
|
||||
var e0 = e1.sourceEvent = d3.event;
|
||||
e1.target = drag;
|
||||
// TODO
|
||||
// d3.event = e1;
|
||||
try {
|
||||
event[e1.type].apply(thiz, argumentz);
|
||||
} finally {
|
||||
// d3.event = e0;
|
||||
}
|
||||
d3.customEvent(e1, event.apply, event, [e1.type, thiz, argumentz]);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ export function Draw(context) {
|
||||
function click() {
|
||||
var d = datum();
|
||||
if (d.type === 'way') {
|
||||
var dims = getDimensions(context.map()),
|
||||
var dims = context.map().dimensions(),
|
||||
mouse = context.mouse(),
|
||||
pad = 5,
|
||||
trySnap = mouse[0] > pad && mouse[0] < dims[0] - pad &&
|
||||
|
||||
@@ -42,7 +42,7 @@ export function DrawWay(context, wayId, index, mode, baseGraph) {
|
||||
loc = datum.loc;
|
||||
|
||||
} else if (datum.type === 'way' && datum.id !== segment.id) {
|
||||
var dims = getDimensions(context.map()),
|
||||
var dims = context.map().dimensions(),
|
||||
mouse = context.mouse(),
|
||||
pad = 5,
|
||||
trySnap = mouse[0] > pad && mouse[0] < dims[0] - pad &&
|
||||
|
||||
@@ -106,7 +106,7 @@ export function DragNode(context) {
|
||||
|
||||
var nudge = childOf(context.container().node(),
|
||||
d3.event.sourceEvent.toElement) &&
|
||||
edge(d3.event.point, getDimensions(context.map()));
|
||||
edge(d3.event.point, context.map().dimensions());
|
||||
|
||||
if (nudge) startNudge(nudge);
|
||||
else stopNudge();
|
||||
|
||||
@@ -60,7 +60,7 @@ export function Move(context, entityIDs, baseGraph) {
|
||||
|
||||
context.overwrite(action, annotation);
|
||||
|
||||
var nudge = edge(currMouse, getDimensions(context.map()));
|
||||
var nudge = edge(currMouse, context.map().dimensions());
|
||||
if (nudge) startNudge(nudge);
|
||||
else stopNudge();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user