diff --git a/src/components/node/NodeImageSlideBlock/index.tsx b/src/components/node/NodeImageSlideBlock/index.tsx index 20df25b1..e4e846a6 100644 --- a/src/components/node/NodeImageSlideBlock/index.tsx +++ b/src/components/node/NodeImageSlideBlock/index.tsx @@ -79,15 +79,16 @@ const NodeImageSlideBlock: FC = ({ 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));