lore-engine
Advanced tools
Comparing version 1.1.22 to 1.1.26
{ | ||
"name": "lore-engine", | ||
"version": "1.1.22", | ||
"version": "1.1.26", | ||
"description": "A WebGL based 3D data visualization engine.", | ||
@@ -40,2 +40,2 @@ "main": "./app.js", | ||
"private": false | ||
} | ||
} |
@@ -27,3 +27,3 @@ //@ts-check | ||
* @param {Number} far Far extend of the viewing volume. | ||
*/ | ||
*/ | ||
constructor(left, right, top, bottom, near = 0.1, far = 2500) { | ||
@@ -60,3 +60,3 @@ super(); | ||
let bottom = y - height; | ||
this.projectionMatrix.setOrthographic(left, right, top, bottom, this.near, this.far); | ||
@@ -76,9 +76,11 @@ this.isProjectionMatrixStale = true; | ||
* @param {Number} height Height of region to be contained. | ||
* @param {Number} padding Padding applied to the zoom as a fraction of width and height. | ||
* | ||
* @returns {Number} The zoom to be set to contain the specified width and height. | ||
*/ | ||
getRequiredZoomToContain(width, height) { | ||
let zoom_width = (this.right - this.left) / (2.0 * width); | ||
let zoom_height = (this.top - this.bottom) / (2.0 * height); | ||
getRequiredZoomToContain(width, height, padding = 0.1) { | ||
let zoom_width = (this.right - this.left) / (width + width * padding); | ||
let zoom_height = (this.top - this.bottom) / (height + height * padding); | ||
return Math.min(zoom_width, zoom_height); | ||
@@ -85,0 +87,0 @@ } |
@@ -48,11 +48,11 @@ //@ts-check | ||
this.addEventListener("mousedrag", function(e) { | ||
this.addEventListener("mousedrag", function (e) { | ||
that.update(e.e, e.source); | ||
}); | ||
this.addEventListener("touch", function(e) { | ||
this.addEventListener("touch", function (e) { | ||
that.update(e.e, e.source); | ||
}); | ||
this.addEventListener("mousewheel", function(e) { | ||
this.addEventListener("mousewheel", function (e) { | ||
that.update( | ||
@@ -167,3 +167,3 @@ { | ||
this.spherical.secure(); | ||
// Limit radius here | ||
@@ -204,3 +204,3 @@ this.lookAt.add(this._dPan); | ||
this.spherical.secure(); | ||
// Limit radius here | ||
@@ -301,10 +301,15 @@ this.lookAt = lookAt.clone(); | ||
* @param {Number} height The height of the square to be contained. | ||
* @param {Number} padding Padding applied to the zoom as a fraction of width and height. | ||
* @returns {OrbitalControls} Returns itself. | ||
*/ | ||
zoomTo(width, height) { | ||
zoomTo(width, height, padding = 0.1) { | ||
if (this.camera.type !== 'Lore.OrthographicCamera') { | ||
throw('Feature not implemented.'); | ||
throw ('Feature not implemented.'); | ||
} | ||
this.setZoom(this.camera.getRequiredZoomToContain(width, height)); | ||
this.setZoom(this.camera.getRequiredZoomToContain( | ||
width, | ||
height, | ||
padding | ||
)); | ||
@@ -320,3 +325,2 @@ return this; | ||
panTo(v) { | ||
return this; | ||
@@ -323,0 +327,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47696426
35475