Commit 616ef937 authored by Malay Keshav's avatar Malay Keshav Committed by Commit Bot

Use accurate zoom factor to compute logical resolution

The logical resolution that we display on the display settings page uses
the rounded zoom factor value to do its computation. This gives an
inaccurate logical resolution text. This also results in us being unable
to tag the correct native resolution in the UI.

The rounded number is also used to set the display zoom of the display
which causes problems when the native resolution can only be reached by
a non rounded zoom factor value like in the case of a 1.6 DSF device.

Bug: 853020
Change-Id: Iba7c70c214ba57f8b21bcac72ebc0e86caeff878
Component: Display settings, display size slider
Reviewed-on: https://chromium-review.googlesource.com/1101936
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567708}
parent 7d11104f
......@@ -318,7 +318,7 @@ Polymer({
* @private
*/
getSelectedDisplayZoom_: function(selectedDisplay) {
const selectedZoom = selectedDisplay.displayZoomFactor * 100;
const selectedZoom = selectedDisplay.displayZoomFactor;
let closestMatch = this.zoomValues_[0].value;
let minimumDiff = Math.abs(closestMatch - selectedZoom);
......@@ -344,9 +344,9 @@ Polymer({
let zoomValues = [];
for (let i = 0; i < selectedDisplay.availableDisplayZoomFactors.length;
i++) {
const value =
Math.round(selectedDisplay.availableDisplayZoomFactors[i] * 100);
const label = this.i18n('displayZoomValue', value.toString());
const value = selectedDisplay.availableDisplayZoomFactors[i];
const label =
this.i18n('displayZoomValue', Math.round(value * 100).toString());
zoomValues.push({value: value, label: label});
}
return zoomValues;
......@@ -391,7 +391,7 @@ Polymer({
this.set('selectedModePref_.value', this.currentSelectedModeIndex_);
this.updateLogicalResolutionText_(
/** @type {number} */ (this.selectedZoomPref_.value) / 100.0);
/** @type {number} */ (this.selectedZoomPref_.value));
},
/**
......@@ -630,8 +630,7 @@ Polymer({
* @private
*/
onDisplaySizeSliderDrag_: function(e) {
this.updateLogicalResolutionText_(
/** @type {number} */ (e.detail.value) / 100.0);
this.updateLogicalResolutionText_(/** @type {number} */ (e.detail.value));
},
/**
......@@ -741,7 +740,7 @@ Polymer({
/** @type {!chrome.system.display.DisplayProperties} */ const properties = {
displayZoomFactor:
/** @type {number} */ (this.selectedZoomPref_.value) / 100.0
/** @type {number} */ (this.selectedZoomPref_.value)
};
settings.display.systemDisplayApi.setDisplayProperties(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment