1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

fixed minimum image height

This commit is contained in:
Fedor Katurov 2019-11-08 12:27:17 +07:00
parent 2267340578
commit 19442e25ef

View file

@ -79,15 +79,16 @@ const NodeImageSlideBlock: FC<IProps> = ({ node, is_loading, updateLayout }) =>
if (!wrap || !wrap.current) return;
const { width } = wrap.current.getBoundingClientRect();
const fallback = (width * 9) / 16;
if (is_loading) return setHeight((width * 9) / 16);
if (is_loading) return setHeight(fallback);
const selected = Math.abs(-offset / width);
if (!heights[Math.round(selected)]) return setHeight((width * 9) / 16);
if (!heights[Math.round(selected)]) return setHeight(fallback);
const prev = Math.max(heights[Math.floor(selected)] || 320, 320);
const next = Math.max(heights[Math.ceil(selected)] || 320, 320);
const prev = Math.max(heights[Math.floor(selected)] || fallback, fallback);
const next = Math.max(heights[Math.ceil(selected)] || fallback, fallback);
const now = prev - (prev - next) * (selected % 1);
if (current !== Math.round(selected)) setCurrent(Math.round(selected));