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

add overrideCloneAlphaBetaRadius to ArcRotateCamera #12378

Merged
merged 3 commits into from Apr 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/dev/core/src/Cameras/arcRotateCamera.ts
Expand Up @@ -50,6 +50,13 @@ export class ArcRotateCamera extends TargetCamera {
@serialize()
public radius: number;

/**
* Defines an override value to use as the parameter to setTarget.
* This allows the parameter to be specified when animating the target (e.g. using FramingBehavior).
*/
@serialize()
public overrideCloneAlphaBetaRadius: Nullable<boolean>;

@serializeAsVector3("target")
protected _target: Vector3;
@serializeAsMeshReference("targetHost")
Expand Down Expand Up @@ -1075,6 +1082,8 @@ export class ArcRotateCamera extends TargetCamera {
* @param cloneAlphaBetaRadius If true, replicate the current setup (alpha, beta, radius) on the new target
*/
public setTarget(target: AbstractMesh | Vector3, toBoundingCenter = false, allowSamePosition = false, cloneAlphaBetaRadius = false): void {
cloneAlphaBetaRadius = this.overrideCloneAlphaBetaRadius ?? cloneAlphaBetaRadius;

if ((<any>target).getBoundingInfo) {
if (toBoundingCenter) {
this._targetBoundingCenter = (<any>target).getBoundingInfo().boundingBox.centerWorld.clone();
Expand Down