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

Fix image DPI #4867

Merged
merged 1 commit into from
May 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ class Controller {
*/
getMetadataLegendImage_(layerName, dpi = 72) {
const groupNode = findGroupByLayerNodeName(this.currentThemes_, layerName);
let found_dpi = dpi;
let node;
if (groupNode && groupNode.children) {
node = findObjectByName(groupNode.children, layerName);
Expand All @@ -1332,21 +1333,22 @@ class Controller {
let dist = Number.MAX_VALUE;
if (legendImage) {
dist = Math.abs(Math.log(72 / dpi));
found_dpi = 72;
}
if (hiDPILegendImages) {
for (const str_dpi in hiDPILegendImages) {
const new_dpi = parseFloat(str_dpi);
const new_dist = Math.abs(Math.log(new_dpi / dpi));
if (new_dist < dist) {
dist = new_dist;
dpi = new_dpi;
found_dpi = new_dpi;
legendImage = hiDPILegendImages[str_dpi];
}
}
}
return {
'url': legendImage,
'dpi': dpi,
url: legendImage,
dpi: found_dpi,
};
}

Expand Down