Skip to content

Commit

Permalink
Add zoom state to toJSON() and fromJSON()
Browse files Browse the repository at this point in the history
This is critical when using an orthographic camera.

Closes #87
  • Loading branch information
paulmelnikow committed Apr 5, 2020
1 parent 5dbfd3a commit 1669a07
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/CameraControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ export class CameraControls extends EventDispatcher {
bb.min.y -= paddingBottom;
bb.max.x += paddingRight;
bb.max.y += paddingTop;

const bbSize = bb.getSize( _v3B );
const distance = this.getDistanceToFit( bbSize.x, bbSize.y, bbSize.z );
const center = bb.getCenter( _v3B ).applyQuaternion( rotation );
Expand Down Expand Up @@ -1175,6 +1175,8 @@ export class CameraControls extends EventDispatcher {

target0 : this._target0.toArray(),
position0 : this._position0.toArray(),

zoom : this._camera.zoom,
} );

}
Expand Down Expand Up @@ -1212,6 +1214,8 @@ export class CameraControls extends EventDispatcher {

}

this._camera.zoom = obj.zoom;

this._needsUpdate = true;

}
Expand Down

0 comments on commit 1669a07

Please sign in to comment.