From fc6cb352d855be62958a661b57974b83adfd9f4f Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 11 Feb 2013 12:12:18 -0500 Subject: [PATCH] use compatible mouse position properties --- js/id/behavior/lasso.js | 4 ++-- js/id/behavior/select.js | 6 +++--- js/id/modes/select.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/id/behavior/lasso.js b/js/id/behavior/lasso.js index e99b1bf14..0a26f311d 100644 --- a/js/id/behavior/lasso.js +++ b/js/id/behavior/lasso.js @@ -10,7 +10,7 @@ iD.behavior.Lasso = function(context) { function mousedown() { if (d3.event.shiftKey === true) { - pos = [d3.event.x, d3.event.y]; + pos = [d3.event.clientX, d3.event.clientY]; lasso = iD.ui.lasso().a(d3.mouse(context.surface().node())); @@ -48,7 +48,7 @@ iD.behavior.Lasso = function(context) { .on('mousemove.lasso', null) .on('mouseup.lasso', null); - if (d3.event.x !== pos[0] || d3.event.y !== pos[1]) { + if (d3.event.clientX !== pos[0] || d3.event.clientY !== pos[1]) { var selected = context.graph().intersects(extent); if (selected.length) { diff --git a/js/id/behavior/select.js b/js/id/behavior/select.js index 4d0bef2de..7369af97c 100644 --- a/js/id/behavior/select.js +++ b/js/id/behavior/select.js @@ -22,7 +22,7 @@ iD.behavior.Select = function(context) { function mousedown() { var datum = d3.event.target.__data__; - pos = [d3.event.x, d3.event.y]; + pos = [d3.event.clientX, d3.event.clientY]; if (datum instanceof iD.Entity || (datum && datum.type === 'midpoint')) { selection .on('mousemove.select', mousemove) @@ -51,7 +51,7 @@ iD.behavior.Select = function(context) { // allow mousemoves to cancel the click function mousemove() { - if (iD.geo.dist([d3.event.x, d3.event.y], pos) > 4) { + if (iD.geo.dist([d3.event.clientX, d3.event.clientY], pos) > 4) { window.clearTimeout(timeout); timeout = null; } @@ -59,7 +59,7 @@ iD.behavior.Select = function(context) { function mouseup() { selection.on('mousemove.select', null); - if (pos && d3.event.x === pos[0] && d3.event.y === pos[1] && + if (pos && d3.event.clientX === pos[0] && d3.event.clientY === pos[1] && !(d3.event.target.__data__ instanceof iD.Entity)) { context.enter(iD.modes.Browse(context)); } diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 5732b58df..9b12c8134 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -76,10 +76,10 @@ iD.modes.Select = function(context, selection, initial) { var inspector_size = context.container().select('.inspector-wrap').size(), map_size = context.map().size(), offset = 50, - shift_left = d3.event.x - map_size[0] + inspector_size[0] + offset, + shift_left = d3.event.clientX - map_size[0] + inspector_size[0] + offset, center = (map_size[0] / 2) + shift_left + offset; - if (shift_left > 0 && inspector_size[1] > d3.event.y) { + if (shift_left > 0 && inspector_size[1] > d3.event.clientY) { context.map().centerEase(context.projection.invert([center, map_size[1]/2])); } }