Skip to content

Zoom using FoV - #729

Merged
elalish merged 5 commits into
masterfrom
zoomFOV
Aug 30, 2019
Merged

elalish merged 5 commits into
masterfrom
zoomFOV

Conversation

@elalish

@elalish elalish commented Aug 28, 2019 •

Copy link
Copy Markdown
Contributor

Fixes #542

In addition to zooming using FoV instead of radius, I also interpolate using log(FoV) in order to make it perpetually linear (same movement is the same fractional change from any starting point). I also narrowed the minimum so you can get closer to the object, since you can never enter it now.

@elalish
elalish requested a review from cdata August 28, 2019 21:26
@elalish elalish self-assigned this Aug 28, 2019

@cdata cdata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks really good. I really love the look of zooming now. A few bike-shed-y tweaks requested 🙇


test('defaults FOV correctly', async () => {
expect(element.getFieldOfView()).to.be.equal(DEFAULT_FOV);
expect(element.getFieldOfView()).to.be.closeTo(DEFAULT_FOV, 0.00001);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👯‍♂

Comment thread src/three-components/SmoothControls.ts Outdated
maximumAzimuthalAngle?: number;
// The minimum camera field of view in degrees
minimumFov?: number;
minimumLogFov?: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fieldOfView

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Separately, its incongruous for us to ask the user to think about "log field of view" here when configuring the controls, but separately set field of view directly in a method like setFov. It seems like we could get away with asking the user to set a desired range in degrees and we could log(fov) as an internal detail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call.

@@ -280,13 +280,17 @@ suite('SmoothControls', () => {
test('does not zoom when scrolling while blurred', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's add test coverage for configuring min/max field of view.

@elalish elalish mentioned this pull request Aug 29, 2019
@elalish
elalish requested a review from cdata August 29, 2019 22:45

@cdata cdata left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sweet 🍯

});
});

suite('field of view', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💯

@elalish
elalish merged commit 34afa3f into master Aug 30, 2019
@elalish
elalish deleted the zoomFOV branch August 30, 2019 15:44
@pushmatrix

Copy link
Copy Markdown
Contributor

Amazing!!

elalish added a commit to elalish/model-viewer that referenced this pull request Feb 4, 2020
 
Zoom using FoV (google#729)

* switch zoom from radius to FOV

* made perceptually linear

* fixed tests

* addressing feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Camera can enter object

3 participants