Skip to content

Commit

Permalink
Fix #1179 setPanorama transition options
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 17, 2023
1 parent 9032cda commit 02ab79d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions packages/core/src/services/DataHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DataHelper extends AbstractService {
const zoomProvided = !isNil(targetZoom);

const properties: AnimationOptions<{ yaw: any; pitch: any; zoom: any }>['properties'] = {};
let duration;
let duration = null;

// clean/filter position and compute duration
if (positionProvided) {
Expand All @@ -86,13 +86,22 @@ export class DataHelper extends AbstractService {

properties.zoom = { start: currentZoom, end: targetZoom };

if (!duration) {
if (duration === null) {
// if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration
duration = speedToDuration(speed, ((Math.PI / 4) * dZoom) / 100);
}
}

duration = Math.max(ANIMATION_MIN_DURATION, duration);
// if nothing to animate
if (duration === null) {
if (typeof speed === 'number') {
duration = speed;
} else {
duration = ANIMATION_MIN_DURATION;
}
} else {
duration = Math.max(ANIMATION_MIN_DURATION, duration);
}

return { duration, properties };
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/services/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ export class Renderer extends AbstractService {
this.renderer.setRenderTarget(null);

const { duration, properties } = this.viewer.dataHelper.getAnimationProperties(
options.transition as any,
options.speed,
options.transition === true ? e.position : null,
e.zoomLevel
);
Expand Down

1 comment on commit 02ab79d

@sonniydsgn
Copy link

Choose a reason for hiding this comment

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

Wow, how quickly you fix it! Thank you, I'll be waiting for the release)

Please sign in to comment.