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

Set cesium rendering resolution to CSS pixel resolution. #3690

Merged
merged 8 commits into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Change Log
### v7.6.11

* Added a workaround for a bug in Google Chrome v76 and v77 that caused problems with sizing of the bottom dock, such as cutting off the timeline and flickering on and off over the map.
* Set cesium rendering resolution to CSS pixel resolution. This is required because Cesium renders in native device resolution since 1.61.0.

### v7.6.10

Expand Down
9 changes: 9 additions & 0 deletions lib/Models/Cesium.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ var Cesium = function(terria, viewer) {

window.addEventListener("resize", this._boundNotifyRepaintRequired, false);

this._setViewerResolution = () => {
// Force rendering in CSS pixel resolution instead of native device
// resolution which is the default since cesium1.61.0
this.viewer.resolutionScale = 1.0 / window.devicePixelRatio;
};
this._setViewerResolution();
window.addEventListener("resize", this._setViewerResolution, false);

// Force a repaint when the feature info box is closed. Cesium can't close its info box
// when the clock is not ticking, for reasons that are not clear.
if (defined(this.viewer.infoBox)) {
Expand Down Expand Up @@ -420,6 +428,7 @@ Cesium.prototype.destroy = function() {
);

window.removeEventListener("resize", this._boundNotifyRepaintRequired, false);
window.removeEventListener("resize", this._setViewerResolution, false);

loadWithXhr.load = this._originalLoadWithXhr;
TaskProcessor.prototype.scheduleTask = this._originalScheduleTask;
Expand Down