Add retina detection
This commit is contained in:
parent
3e2fbcee20
commit
e731640e5f
1 changed files with 3 additions and 0 deletions
3
Utils.ts
3
Utils.ts
|
@ -98,6 +98,9 @@ export class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isRetina() : boolean{
|
public static isRetina() : boolean{
|
||||||
|
if(UIElement.runningFromConsole){
|
||||||
|
return;
|
||||||
|
}
|
||||||
// The cause for this line of code: https://github.com/pietervdvn/MapComplete/issues/115
|
// The cause for this line of code: https://github.com/pietervdvn/MapComplete/issues/115
|
||||||
// See https://stackoverflow.com/questions/19689715/what-is-the-best-way-to-detect-retina-support-on-a-device-using-javascript
|
// See https://stackoverflow.com/questions/19689715/what-is-the-best-way-to-detect-retina-support-on-a-device-using-javascript
|
||||||
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio >= 2));
|
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio >= 2));
|
||||||
|
|
Loading…
Reference in a new issue