Skip to content

Commit bb3bebc

Browse files
committed
backport retina support
1 parent e4862c7 commit bb3bebc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

inst/www/opencpu-0.4.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
var Location;
256256
var pngwidth;
257257
var pngheight;
258+
var ratio = window.devicePixelRatio || 1;
258259

259260
var plotdiv = $('<div />').attr({
260261
style: "width: 100%; height:100%; min-width: 100px; min-height: 100px; position:relative; background-repeat:no-repeat; background-size: 100% 100%;"
@@ -283,7 +284,7 @@
283284
if(!Location) return;
284285
pngwidth = plotdiv.width();
285286
pngheight = plotdiv.height();
286-
plotdiv.css("background-image", "url(" + Location + "graphics/last/png?width=" + pngwidth + "&height=" + pngheight + ")");
287+
plotdiv.css("background-image", "url(" + Location + "graphics/last/png?width=" + pngwidth * ratio + "&height=" + pngheight * ratio + "&res=" + 72 * ratio + ")");
287288
}
288289

289290
function setlocation(newloc){

0 commit comments

Comments
 (0)