diff --git a/index.js b/index.js index 2b52672..c9a9b8d 100644 --- a/index.js +++ b/index.js @@ -148,6 +148,10 @@ AFRAME.registerComponent('orbit-controls', { ROTATE_TO: 6 }; + this.camData = { + zoomFactor: 10 + } + this.state = this.STATE.NONE; this.EPS = 0.000001; @@ -915,6 +919,11 @@ AFRAME.registerComponent('orbit-controls', { this.spherical.radius *= this.scale; this.spherical.radius = Math.max(this.data.minDistance, Math.min(this.data.maxDistance, this.spherical.radius)); // restrict radius to be inside desired limits + if (this.camera) { + this.camData.zoomFactor = this.spherical.radius; + this.camera.userData = this.camData; + } + this.target.add(this.panOffset); // move target to panned location offset.setFromSpherical(this.spherical);