-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix viewer.flyTo ignoring and resetting minimumZoomDistance #5668
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
04e31a8
Fix minimum zoom getting reset on flyTo
cguldner d1c876a
Fix flyTo going past minimum zoom for billboards
cguldner 2676a5e
Remove console statement
cguldner bcb14c7
Handle case when outside maximumZoomDistance, or when the zoomDistanc…
cguldner e04bf0f
Write tests for Camera to not fly outside limits on flyToBoundingSphere
cguldner 875b4c8
Change some variable names to camelCase
cguldner 4ba2964
Simplify if statement
cguldner 9d00cbd
Style changes
cguldner 0ccf646
Style changes
cguldner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2853,23 +2853,25 @@ define([ | |
return Math.max(right, top) * 1.50; | ||
} | ||
|
||
var MINIMUM_ZOOM = 100.0; | ||
|
||
function adjustBoundingSphereOffset(camera, boundingSphere, offset) { | ||
if (!defined(offset)) { | ||
offset = HeadingPitchRange.clone(Camera.DEFAULT_OFFSET); | ||
} | ||
|
||
var defaultZoom = 100.0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move this back outside of the function where it was before |
||
var minimumZoom = camera._scene.screenSpaceCameraController.minimumZoomDistance; | ||
var maximumZoom = camera._scene.screenSpaceCameraController.maximumZoomDistance; | ||
var range = offset.range; | ||
if (!defined(range) || range === 0.0) { | ||
var radius = boundingSphere.radius; | ||
if (radius === 0.0) { | ||
offset.range = MINIMUM_ZOOM; | ||
if(radius === 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add back the space between |
||
offset.range = defaultZoom; | ||
} else if (camera.frustum instanceof OrthographicFrustum || camera._mode === SceneMode.SCENE2D) { | ||
offset.range = distanceToBoundingSphere2D(camera, radius); | ||
} else { | ||
offset.range = distanceToBoundingSphere3D(camera, radius); | ||
} | ||
offset.range = CesiumMath.clamp(offset.range, minimumZoom, maximumZoom); | ||
} | ||
|
||
return offset; | ||
|
@@ -2950,7 +2952,6 @@ define([ | |
//>>includeEnd('debug'); | ||
|
||
options = defaultValue(options, defaultValue.EMPTY_OBJECT); | ||
|
||
var scene2D = this._mode === SceneMode.SCENE2D || this._mode === SceneMode.COLUMBUS_VIEW; | ||
this._setTransform(Matrix4.IDENTITY); | ||
var offset = adjustBoundingSphereOffset(this, boundingSphere, options.offset); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mramato do you remember why this was added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because our default minimumZoomDistance (at least at the time) was fairly large, so it was impossible to zoom to a model because you would end up 50 meters away. What is the current default minimumZoomDistance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mramato If no minimumZoom is specified, it goes to 1, and the flyTo will go to about 100 units away if the bounding sphere for that model has a radius of 0. But this problem is fixed by the clamping of the zoom to the
screenSpaceCameraController
minimum and maximum zoom, so now it will never go outside those bounds.