Fixed throwing problems with 2+ pointers
This commit is contained in:
+14
-3
@@ -122,12 +122,23 @@ export class PointMap extends MapProxy {
|
||||
}
|
||||
|
||||
export class InteractionDelta {
|
||||
constructor(x, y, zoom, rotate, about) {
|
||||
/**
|
||||
*Creates an instance of InteractionDelta.
|
||||
* @param {*} x
|
||||
* @param {*} y
|
||||
* @param {*} zoom
|
||||
* @param {*} rotate
|
||||
* @param {*} about
|
||||
* @param {*} number - number of involved pointer
|
||||
* @memberof InteractionDelta
|
||||
*/
|
||||
constructor(x, y, zoom, rotate, about, number) {
|
||||
this.x = x
|
||||
this.y = y
|
||||
this.zoom = zoom
|
||||
this.rotate = rotate
|
||||
this.about = about
|
||||
this.number = number
|
||||
}
|
||||
|
||||
toString() {
|
||||
@@ -217,14 +228,14 @@ export class InteractionPoints {
|
||||
let currentAngle = Points.angle(c1, c2)
|
||||
let previousAngle = Points.angle(p1, p2)
|
||||
let alpha = this.diffAngle(currentAngle, previousAngle)
|
||||
return new InteractionDelta(delta.x, delta.y, zoom, alpha, cm)
|
||||
return new InteractionDelta(delta.x, delta.y, zoom, alpha, cm, csize)
|
||||
} else if (csize == 1 && psize == 1 && this.current.firstKey() == this.previous.firstKey()) {
|
||||
// We need to ensure that the keys are the same, since single points with different keys
|
||||
// can jump
|
||||
let current = this.current.first()
|
||||
let previous = this.previous.first()
|
||||
let delta = Points.subtract(current, previous)
|
||||
return new InteractionDelta(delta.x, delta.y, 1.0, 0.0, current)
|
||||
return new InteractionDelta(delta.x, delta.y, 1.0, 0.0, current, csize)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user