mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-29 19:29:35 +02:00
Fix prior commit and add additional safety checks
This commit is contained in:
@@ -72,7 +72,7 @@ export function behaviorDraw(context) {
|
||||
downLoc: pointerLocGetter(d3_event)
|
||||
};
|
||||
|
||||
dispatch.call('pointerdown', this, datum());
|
||||
dispatch.call('down', this, datum());
|
||||
}
|
||||
|
||||
function pointerup() {
|
||||
@@ -108,7 +108,9 @@ export function behaviorDraw(context) {
|
||||
}
|
||||
|
||||
function pointermove() {
|
||||
if (_downPointer && !_downPointer.isCancelled) {
|
||||
if (_downPointer &&
|
||||
_downPointer.id === (d3_event.pointerId || 'mouse') &&
|
||||
!_downPointer.isCancelled) {
|
||||
var p2 = _downPointer.pointerLocGetter(d3_event);
|
||||
var dist = geoVecLength(_downPointer.downLoc, p2);
|
||||
if (dist >= _closeTolerance) {
|
||||
@@ -131,6 +133,17 @@ export function behaviorDraw(context) {
|
||||
dispatch.call('move', this, datum());
|
||||
}
|
||||
|
||||
function pointercancel() {
|
||||
if (_downPointer &&
|
||||
_downPointer.id === (d3_event.pointerId || 'mouse')) {
|
||||
|
||||
if (!_downPointer.isCancelled) {
|
||||
dispatch.call('downcancel', this);
|
||||
}
|
||||
_downPointer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function mouseenter() {
|
||||
_mouseLeave = false;
|
||||
}
|
||||
@@ -246,7 +259,8 @@ export function behaviorDraw(context) {
|
||||
.on(_pointerPrefix + 'move.draw', pointermove);
|
||||
|
||||
d3_select(window)
|
||||
.on(_pointerPrefix + 'up.draw', pointerup, true);
|
||||
.on(_pointerPrefix + 'up.draw', pointerup, true)
|
||||
.on('pointercancel.draw', pointercancel, true);
|
||||
|
||||
d3_select(document)
|
||||
.call(keybinding);
|
||||
@@ -267,7 +281,8 @@ export function behaviorDraw(context) {
|
||||
.on(_pointerPrefix + 'move.draw', null);
|
||||
|
||||
d3_select(window)
|
||||
.on(_pointerPrefix + 'up.draw', null);
|
||||
.on(_pointerPrefix + 'up.draw', null)
|
||||
.on('pointercancel.draw', null);
|
||||
// note: keyup.space-block, click.draw-block should remain
|
||||
|
||||
d3_select(document)
|
||||
|
||||
Reference in New Issue
Block a user