mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-13 06:36:28 +00:00
use compatible mouse position properties
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user