Don't scale up images that are smaller than the screen.
This commit is contained in:
parent
d84e756ac4
commit
024378e3ae
@ -30,18 +30,22 @@ export function FocusView(vm, params, key, { appbar, appbarView }) {
|
|||||||
({ width: iw, height: ih }, { width: vw, height: vh }) => {
|
({ width: iw, height: ih }, { width: vw, height: vh }) => {
|
||||||
const imageRatio = iw / ih;
|
const imageRatio = iw / ih;
|
||||||
const windowRatio = vw / vh;
|
const windowRatio = vw / vh;
|
||||||
|
if (iw < vw && ih < vh) {
|
||||||
|
return {
|
||||||
|
height: ih,
|
||||||
|
width: iw
|
||||||
|
};
|
||||||
|
}
|
||||||
if (windowRatio > imageRatio) {
|
if (windowRatio > imageRatio) {
|
||||||
return {
|
return {
|
||||||
height: vw / windowRatio,
|
height: vw / windowRatio,
|
||||||
width: vw / windowRatio * imageRatio
|
width: vw / windowRatio * imageRatio
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
height: vh * windowRatio / imageRatio,
|
|
||||||
width: vh * windowRatio
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
height: vh * windowRatio / imageRatio,
|
||||||
|
width: vh * windowRatio
|
||||||
|
};
|
||||||
},
|
},
|
||||||
[doc, fullViewportSize]
|
[doc, fullViewportSize]
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user