diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e84a9b..6bc8e2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,18 @@ The format is based on [Keep a Changelog](https://github.com/olivierlacan/keep-a ### Removed +## [2.0.1] - 2023-12-17 + +### Added + +### Changed + +### Fixed + +- Fix don't camera rotation and zooming in editors. (https://github.com/yushiang-demo/pano-to-mesh/pull/71) + +### Removed + ## [2.0.0] - 2023-12-16 ### Added @@ -185,7 +197,8 @@ Codes without pull requests won't be recorded. ### Removed -[unreleased]: https://github.com/yushiang-demo/PanoToMesh/compare/v2.0.0...HEAD +[unreleased]: https://github.com/yushiang-demo/PanoToMesh/compare/v2.0.1...HEAD +[2.0.1]: https://github.com/yushiang-demo/PanoToMesh/compare/v2.0.0...v2.0.1 [2.0.0]: https://github.com/yushiang-demo/PanoToMesh/compare/v1.4.1...v2.0.0 [1.4.1]: https://github.com/yushiang-demo/PanoToMesh/compare/v1.4.0...v1.4.1 [1.4.0]: https://github.com/yushiang-demo/PanoToMesh/compare/v1.3.0...v1.4.0 diff --git a/packages/three/core/helpers/CameraControls.js b/packages/three/core/helpers/CameraControls.js index 0435700..9c9a4d8 100644 --- a/packages/three/core/helpers/CameraControls.js +++ b/packages/three/core/helpers/CameraControls.js @@ -91,7 +91,12 @@ function CameraControls(camera, domElement) { }; let constraintPanEvent = null; - const focus = (object, constraintPan = true) => { + const focus = ( + object, + constraintZoom = true, + constraintPan = true, + constraintRotate = true + ) => { if (!object) return; const { origin, distance, boundingBox } = getFocusSettings( object, @@ -106,7 +111,21 @@ function CameraControls(camera, domElement) { controls.minDistance = 0; controls.update(); - setMode(MODE.TOP_VIEW, object); + if (constraintZoom) { + const { distance: minDistance } = getFocusSettings(object, 1.0); + const { distance: maxDistance } = getFocusSettings(object, 0.5); + controls.maxDistance = maxDistance; + controls.minDistance = minDistance; + controls.update(); + } + + if (constraintRotate) { + controls.maxPolarAngle = Math.PI / 2; + controls.minPolarAngle = 0; + controls.maxAzimuthAngle = Infinity; + controls.minAzimuthAngle = -Infinity; + controls.update(); + } if (constraintPan) { const checkTarget = () => {