diff --git a/src/Camera.js b/src/Camera.js index 80d766b8..d5bf5996 100644 --- a/src/Camera.js +++ b/src/Camera.js @@ -149,10 +149,10 @@ class Camera { // Do not let transform offet go beyond this limit. // if (scaled-image-size < screen) it remains fully contained // else the scaled-image boundary closest to the screen cannot enter the screen. - const dx = Math.abs(bw - sw) / 2 + this.boundingBox.center()[0] - tbox.center()[0]; + const dx = Math.abs(bw - sw) / 2;// + this.boundingBox.center().x- tbox.center().x; x = Math.min(Math.max(-dx, x), dx); - const dy = Math.abs(bh - sh) / 2 + this.boundingBox.center()[1] - tbox.center()[1]; + const dy = Math.abs(bh - sh) / 2;// + this.boundingBox.center().y - tbox.center().y; y = Math.min(Math.max(-dy, y), dy); } @@ -165,6 +165,7 @@ class Camera { if (a - this.source.a > 180) this.source.a += 360; if (this.source.a - a > 180) this.source.a -= 360; Object.assign(this.target, { x: x, y: y, z: z, a: a, t: now + dt }); + console.assert(!isNaN(this.target.x)); this.emit('update'); } @@ -290,7 +291,7 @@ class Camera { let c = box.center(); let z = Math.min(w / bw, h / bh); - this.setPosition(dt, -c[0]*z, -c[1]*z, z, 0); + this.setPosition(dt, -c.x*z, -c.y*z, z, 0); } /** diff --git a/src/Transform.js b/src/Transform.js index 6b074ffe..8fff5809 100644 --- a/src/Transform.js +++ b/src/Transform.js @@ -177,6 +177,8 @@ class Transform { //FIXME Add translation to P? * @returns {Transform} The interpolated transform. */ static interpolate(source, target, time, easing) { //FIXME STATIC + console.assert(!isNaN(source.x)); + console.assert(!isNaN(target.x)); const pos = new Transform(); let dt = (target.t - source.t); if (time < source.t) { diff --git a/src/index.js b/src/index.js index bf121a00..95e650f8 100644 --- a/src/index.js +++ b/src/index.js @@ -22,7 +22,7 @@ let lime = new Viewer('.openlime', { background: 'black', canvas: { preserveDraw //imageTest('google'); // image google deepzoom deepzoom1px zoomify iiif tarzoon itarzoom //flipTest(); //brdfTest(); -//rtiTest('rbf'); +rtiTest('rbf'); //tomeTest(); //testUIBasic(); @@ -32,7 +32,7 @@ let lime = new Viewer('.openlime', { background: 'black', canvas: { preserveDraw //testMedicalAnnotations(); -testAnnotationEditor(); +//testAnnotationEditor(); //testNeural();