diff --git a/packages/gallery/src/interface/focus.js b/packages/gallery/src/interface/focus.js index 70c33ca..10e1b78 100644 --- a/packages/gallery/src/interface/focus.js +++ b/packages/gallery/src/interface/focus.js @@ -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 - }; } + return { + height: vh * windowRatio / imageRatio, + width: vh * windowRatio + }; }, [doc, fullViewportSize] );