mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
fixed minimum image height
This commit is contained in:
parent
2267340578
commit
19442e25ef
1 changed files with 5 additions and 4 deletions
|
@ -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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue