Skip to content

Commit

Permalink
Peg zoom out factor to .1X
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnetordoff authored and felliott committed Feb 1, 2017
1 parent e8f890f commit cbaf917
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mfr/extensions/jsc3d/static/js/jsc3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ JSC3D.Viewer.prototype.replaceScene = function(scene) {
JSC3D.Viewer.prototype.resetScene = function() {
var d = (!this.scene || this.scene.isEmpty()) ? 0 : this.scene.aabb.lengthOfDiagonal();
this.zoomFactor = (d == 0) ? 1 : (this.frameWidth < this.frameHeight ? this.frameWidth : this.frameHeight) / d;
this.minZoomFactor = this.zoomFactor/10
this.panning = [0, 0];
this.rotMatrix.identity();
this.rotMatrix.rotateAboutXAxis(this.initRotX);
Expand Down Expand Up @@ -1108,6 +1109,7 @@ JSC3D.Viewer.prototype.setupScene = function(scene) {
var w = this.frameWidth;
var h = this.frameHeight;
this.zoomFactor = (d == 0) ? 1 : (w < h ? w : h) / d;
this.minZoomFactor = this.zoomFactor/10;
this.panning = [0, 0];
}

Expand Down Expand Up @@ -1464,8 +1466,8 @@ JSC3D.Viewer.prototype.render = function() {
if(this.scene.isEmpty())
return;

if(this.zoomFactor < .1){
this.zoomFactor = .1;
if(this.zoomFactor < this.minZoomFactor){
this.zoomFactor = this.minZoomFactor;
}

var aabb = this.scene.aabb;
Expand Down Expand Up @@ -5762,4 +5764,4 @@ JSC3D.StlLoader.prototype.onprogress = null;
JSC3D.StlLoader.prototype.onresource = null;
JSC3D.StlLoader.prototype.decimalPrecision = 3;

JSC3D.LoaderSelector.registerLoader('stl', JSC3D.StlLoader);
JSC3D.LoaderSelector.registerLoader('stl', JSC3D.StlLoader);

0 comments on commit cbaf917

Please sign in to comment.