Skip to content

Commit

Permalink
Merge pull request #72 from yushiang-demo/dev
Browse files Browse the repository at this point in the history
v2.0.1
  • Loading branch information
tsengyushiang authored Dec 17, 2023
2 parents ebc87fd + 14f406d commit a5bf931
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions packages/three/core/helpers/CameraControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = () => {
Expand Down

1 comment on commit a5bf931

@vercel
Copy link

@vercel vercel bot commented on a5bf931 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pano-to-mesh – ./

pano-to-mesh.vercel.app
pano-to-mesh-yushiang.vercel.app
pano-to-mesh-git-main-yushiang.vercel.app

Please sign in to comment.