Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support (vertical) camera target limitation #16125

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

HoferMarkus
Copy link
Contributor

from forum entry

Inspector
Not too happy with the default behaviour of the inspector, as null is shown as 0.
The user would now expect that there is a limit on y=0, whereas there is none.
Also you have to switch to a different value and back to 0, to make the y limit on 0 work.

image

I didn't investigated further on that, since it's a common inspector behaviour, the alpha limits are affected as well.
Maybe just show null as empty value in the numfield? 🤔

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 30, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 30, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 30, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 30, 2025

Copy link
Member

@sebavan sebavan left a comment

Choose a reason for hiding this comment

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

LGTM I ll let @deltakosh having a quick look :-)

@@ -1129,6 +1137,9 @@ export class ArcRotateCamera extends TargetCamera {
this.radius = this.upperRadiusLimit;
this.inertialRadiusOffset = 0;
}
if (this.lowerTargetYLimit !== null && this.target.y < this.lowerTargetYLimit) {
this.target.y = this.lowerTargetYLimit;
Copy link
Member

Choose a reason for hiding this comment

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

is it basically not a this.target.y = Math.max(this.target.y, this.lowerTargetYLimit) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was my initial though as well, but the TS compiler blames because null is not a valid input for Math.max.
I guess that's why are lowerAlphaLimit and upperAlphaLimit are solved with this if pattern as well.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should initialize at -infinity so we prevent different objects maps and simplify the code ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good to me, as it would solve the inspector issue as well.
Should I also change lowerAlphaLimit and upperAlphaLimit to -Infinity / Infinity?

Copy link
Contributor

@deltakosh deltakosh left a comment

Choose a reason for hiding this comment

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

Besides Seb comment I'm good to go

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.

4 participants