Skip to content

Commit 26e1124

Browse files
committed
fix: getDevicePixelRatio will return 0 on Linux resulting in no minimap
1 parent 1894eb5 commit 26e1124

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/minimap.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,14 @@ export default class Minimap {
860860
* @returns {number} The devicePixelRatio in the Minimap
861861
*/
862862
getDevicePixelRatio() {
863-
return this.getDevicePixelRatioRounding() ? Math.floor(devicePixelRatio) : devicePixelRatio
863+
if (this.getDevicePixelRatioRounding()) {
864+
if (devicePixelRatio >= 0.5) {
865+
return Math.round(devicePixelRatio)
866+
} else {
867+
return Math.round(devicePixelRatio * 10) / 10
868+
}
869+
}
870+
return devicePixelRatio
864871
}
865872

866873
/**

0 commit comments

Comments
 (0)