Skip to content

Commit

Permalink
add overrideCloneAlphaBetaRadius to ArcRotateCamera (#12378)
Browse files Browse the repository at this point in the history
* add overrideCloneAlphaBetaRadius to ArcRotateCamera

* remove trailing whitespace

* remove whitespace
  • Loading branch information
BlakeOne authored Apr 12, 2022
1 parent 60baae1 commit 69920ea
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/dev/core/src/Cameras/arcRotateCamera.ts
Original file line number Diff line number Diff line change
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

0 comments on commit 69920ea

Please sign in to comment.