Skip to main content

use_device_pixel_grid

Function use_device_pixel_grid 

Source
pub fn use_device_pixel_grid() -> (Signal<PixelGrid>, Callback<MountedEvent>)
Expand description

The device-pixel grid under the element given the returned onmounted handler, updated for as long as the calling component is mounted.

The element’s layout is watched by a ResizeObserver, which reports the box once it is laid out and again whenever it changes size — the window resized, the page zoomed, or the layout around it moved it. A move to a screen of another density changes the ratio alone, which only a resolution media query reports; that query is re-armed for each new ratio. An element inside a scrolling column also moves without changing size — the column scrolls, or what sits above it in the column grows or shrinks — so the column’s scroll and every change to its content are watched too.