fix: refresh $.pixelDensityRatio

This commit is contained in:
ronnymikalsen 2021-02-04 13:39:26 +01:00
parent 39811d9300
commit c410b82e65

View File

@ -403,6 +403,21 @@ $.Viewer = function( options ) {
function resize() {
console.log("Windows is resized...");
$.pixelDensityRatio = (function () {
if ( $.supportsCanvas ) {
var context = document.createElement('canvas').getContext('2d');
var devicePixelRatio = window.devicePixelRatio || 1;
var backingStoreRatio = context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return Math.max(devicePixelRatio, 1) / backingStoreRatio;
} else {
return 1;
}
}());
console.log("$.pixelDensityRatio", $.pixelDensityRatio);
_this.world.resetItems();
_this.forceRedraw();
}