Browse Source

Respect devicePixelRatio #67

Tobias Reich 9 years ago
parent
commit
877bb11193
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/scripts/photo.js

+ 7 - 0
src/scripts/photo.js

@@ -550,11 +550,18 @@ photo = {
 		// Small is centered in the middle of the screen
 		var size = 'big',
 			hasMedium = photo.json.medium!=="",
+			pixelRatio = window.devicePixelRatio,
 			view = {
 				width: $(window).width()-60,
 				height: $(window).height()-100
 			};
 
+		// Calculate pixel ratio of screen
+		if (pixelRatio!==undefined&&pixelRatio>1) {
+			view.width = view.width * pixelRatio;
+			view.height = view.height * pixelRatio;
+		}
+
 		// Medium available and
 		// Medium still bigger than screen
 		if (hasMedium===true&&