Don't scale up images that are smaller than the screen.

This commit is contained in:
Timothy Farrell 2018-01-04 13:58:21 -06:00
parent d84e756ac4
commit 024378e3ae

View File

@ -30,18 +30,22 @@ export function FocusView(vm, params, key, { appbar, appbarView }) {
({ width: iw, height: ih }, { width: vw, height: vh }) => {
const imageRatio = iw / ih;
const windowRatio = vw / vh;
if (iw < vw && ih < vh) {
return {
height: ih,
width: iw
};
}
if (windowRatio > imageRatio) {
return {
height: vw / windowRatio,
width: vw / windowRatio * imageRatio
};
} else {
}
return {
height: vh * windowRatio / imageRatio,
width: vh * windowRatio
};
}
},
[doc, fullViewportSize]
);