Improved size detection #67

pull/263/head
Tobias Reich 10 years ago
parent 280e42afd6
commit 2421db7469

2
dist/main.js vendored

File diff suppressed because one or more lines are too long

@ -549,6 +549,7 @@ photo = {
// Default is big
// Small is centered in the middle of the screen
var size = 'big',
scaled = false,
hasMedium = photo.json.medium!=="",
pixelRatio = window.devicePixelRatio,
view = {
@ -556,6 +557,11 @@ photo = {
height: $(window).height()-100
};
// Detect if the photo will be shown scaled,
// because the screen size is smaller than the photo
if (photo.json.width>view.width||
photo.json.width>view.height) scaled = true;
// Calculate pixel ratio of screen
if (pixelRatio!==undefined&&pixelRatio>1) {
view.width = view.width * pixelRatio;
@ -567,9 +573,9 @@ photo = {
if (hasMedium===true&&
(1920>view.width&&1080>view.height)) size = 'medium';
// Medium not available and
// Photo not scaled
// Photo smaller then screen
if (hasMedium===false&&
if (scaled===false&&
(photo.json.width<view.width&&
photo.json.width<view.height)) size = 'small';

Loading…
Cancel
Save