-
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
Added resolution scaling sandcasle example #8151
Conversation
Thanks for the pull request @IanLilleyT!
Reviewers, don't forget to make sure that:
|
f66210f
to
60785ef
Compare
} | ||
update(); | ||
|
||
viewer.scene.camera.setView({ |
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.
The default view is already good enough, this setView
isn't needed.
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Set a custom resolution scale or enable device pixel resolution."> | ||
<meta name="cesium-sandcastle-labels" content="Post Processing"> |
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.
Put this in the Showcases
category instead since it's not strictly post-processing related.
<div id="toolbar"> | ||
<table><tbody> | ||
<tr> | ||
<td>Use Device Pixel Resolution</td> |
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.
A better description is: Use Browser Recommended Resolution
Also edit the Sandcastle description and any variables names.
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.
Rename useDevicePixelResolution
<input type="text" size="5" data-bind="value: customResolutionScale, enable: !useDevicePixelResolution"> | ||
</td> | ||
</tr> | ||
|
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.
Remove empty line
viewer.resolutionScale = 1.0 / window.devicePixelRatio; | ||
} else { | ||
var res = Number(params.customResolutionScale); | ||
res = Cesium.Math.clamp(res, 0.1, 8.0); |
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.
res = Cesium.Math.clamp(res, 0.1, 8.0); | |
res = Cesium.Math.clamp(res, 0.1, 2.0); |
} else { | ||
var res = Number(params.customResolutionScale); | ||
res = Cesium.Math.clamp(res, 0.1, 8.0); | ||
res = !isNaN(res) ? res : 1.0; |
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.
This line should go above the clamp.
if (params.useDevicePixelResolution) { | ||
viewer.resolutionScale = 1.0 / window.devicePixelRatio; | ||
} else { | ||
var res = Number(params.customResolutionScale); |
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.
Better to unabbreviate, rename to resolutionScale
.
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
|
||
var params = { |
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.
This object is usually called viewModel
.
fixed latest problem |
Thanks @IanLilleyT |
Fixes #8102
This sandcastle example lets you set a custom resolution scale or use the device pixel resolution.