Skip to main content

Module media_placeholder

Module media_placeholder 

Source
Expand description

The space a picture will take, held while it loads.

A note’s image arrives after the note does. If its row grew when it did, everything below would jump. MediaPlaceholder takes the room the picture will take once it is there, when the note says how large the picture is (NIP-92 imeta), so the row is the same height before and after.

A picture is shown as wide as the room there is for it, from one edge to the other, and as tall as that makes it; but never larger than it is: one narrower than the room keeps its own size. shown_size is that rule, for the placeholder, the picture and the estimate of a row’s height alike.

Structs§

MediaPlaceholder
A quiet rounded box where a picture is about to be.

Functions§

shown_size
How large a picture is shown, given its size in pixels and the width there is for it: scaled down to that width, as tall as that makes it, and never scaled up.