Merge branch 'master' of gitea.iwm-tuebingen.de:IWMBrowser/iwmlib

This commit is contained in:
Manfred Knobloch 2019-05-31 13:59:02 +02:00
commit aafa528f03
6 changed files with 879 additions and 64 deletions

35
dist/iwmlib.js vendored
View File

@ -1687,12 +1687,23 @@
}
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() {
@ -1766,16 +1777,13 @@
let p1 = this.previous.get(c1.key);
let p2 = this.previous.get(c2.key);
//let p1 = previous[0]
//let p2 = previous[1]
let d1 = Points.subtract(c1, p1);
let d2 = Points.subtract(c2, p2);
let cm = Points.mean(c1, c2);
//let pm = Points.mean(p1, p2)
// UO: Using the mean lead to jumps between time slices with 3 and 2 fingers
// Using the mean leads to jumps between time slices with 3 and 2 fingers
// We use the mean of deltas instead
let delta = Points.mean(d1, d2); //Points.subtract(cm, pm)
let delta = Points.mean(d1, d2);
let zoom = 1.0;
let distance1 = Points.distance(p1, p2);
let distance2 = Points.distance(c1, c2);
@ -1785,13 +1793,14 @@
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
// 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
}
@ -2940,7 +2949,9 @@
this.lastframe = t;
if (dt > 0) {
// Avoid division by zero errors later on
let velocity = { t: t, dt: dt, dx: delta.x, dy: delta.y };
// and consider the number of involved pointers sind addVelocity will be called by the
// onMove events
let velocity = { t: t, dt: dt, dx: delta.x / delta.number, dy: delta.y / delta.number};
this.velocities.push(velocity);
while (this.velocities.length > buffer) {
this.velocities.shift();
@ -2949,7 +2960,7 @@
}
meanVelocity(milliseconds = 30) {
this.addVelocity({ x: 0, y: 0 });
this.addVelocity({ x: 0, y: 0, number: 1 });
let sum = { x: 0, y: 0 };
let count = 0;
let t = 0;

35
dist/iwmlib.pixi.js vendored
View File

@ -4851,12 +4851,23 @@
}
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() {
@ -4930,16 +4941,13 @@
let p1 = this.previous.get(c1.key);
let p2 = this.previous.get(c2.key);
//let p1 = previous[0]
//let p2 = previous[1]
let d1 = Points.subtract(c1, p1);
let d2 = Points.subtract(c2, p2);
let cm = Points.mean(c1, c2);
//let pm = Points.mean(p1, p2)
// UO: Using the mean lead to jumps between time slices with 3 and 2 fingers
// Using the mean leads to jumps between time slices with 3 and 2 fingers
// We use the mean of deltas instead
let delta = Points.mean(d1, d2); //Points.subtract(cm, pm)
let delta = Points.mean(d1, d2);
let zoom = 1.0;
let distance1 = Points.distance(p1, p2);
let distance2 = Points.distance(c1, c2);
@ -4949,13 +4957,14 @@
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
// 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
}
@ -6104,7 +6113,9 @@
this.lastframe = t;
if (dt > 0) {
// Avoid division by zero errors later on
let velocity = { t: t, dt: dt, dx: delta.x, dy: delta.y };
// and consider the number of involved pointers sind addVelocity will be called by the
// onMove events
let velocity = { t: t, dt: dt, dx: delta.x / delta.number, dy: delta.y / delta.number};
this.velocities.push(velocity);
while (this.velocities.length > buffer) {
this.velocities.shift();
@ -6113,7 +6124,7 @@
}
meanVelocity(milliseconds = 30) {
this.addVelocity({ x: 0, y: 0 });
this.addVelocity({ x: 0, y: 0, number: 1 });
let sum = { x: 0, y: 0 };
let count = 0;
let t = 0;

View File

@ -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() {
@ -201,16 +212,13 @@ export class InteractionPoints {
let p1 = this.previous.get(c1.key)
let p2 = this.previous.get(c2.key)
//let p1 = previous[0]
//let p2 = previous[1]
let d1 = Points.subtract(c1, p1)
let d2 = Points.subtract(c2, p2)
let cm = Points.mean(c1, c2)
//let pm = Points.mean(p1, p2)
// UO: Using the mean lead to jumps between time slices with 3 and 2 fingers
// Using the mean leads to jumps between time slices with 3 and 2 fingers
// We use the mean of deltas instead
let delta = Points.mean(d1, d2) //Points.subtract(cm, pm)
let delta = Points.mean(d1, d2)
let zoom = 1.0
let distance1 = Points.distance(p1, p2)
let distance2 = Points.distance(c1, c2)
@ -220,13 +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
// 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
}

View File

@ -127,7 +127,9 @@ class Throwable {
this.lastframe = t
if (dt > 0) {
// Avoid division by zero errors later on
let velocity = { t: t, dt: dt, dx: delta.x, dy: delta.y }
// and consider the number of involved pointers sind addVelocity will be called by the
// onMove events
let velocity = { t: t, dt: dt, dx: delta.x / delta.number, dy: delta.y / delta.number}
this.velocities.push(velocity)
while (this.velocities.length > buffer) {
this.velocities.shift()
@ -136,7 +138,7 @@ class Throwable {
}
meanVelocity(milliseconds = 30) {
this.addVelocity({ x: 0, y: 0 })
this.addVelocity({ x: 0, y: 0, number: 1 })
let sum = { x: 0, y: 0 }
let count = 0
let t = 0

836
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "iwmlib",
"version": "1.0.7",
"version": "1.0.8",
"description": "An Open Source library for multi-touch, WebGL powered applications.",
"main": "index.js",
"directories": {