Skip to main content

scissor_rect

Function scissor_rect 

Source
fn scissor_rect(clip_rect: Rect, screen: ScreenDescriptor) -> ScissorRect
Available on crate feature egui only.
Expand description

egui’s clip rectangle as a scissor rectangle, in whole pixels.

egui states a clip rectangle in logical points, while a scissor rectangle is in physical pixels, so the rectangle is scaled by the density and rounded to whole pixels — the same conversion egui-wgpu performs. Both edges are then clamped to the target: a clip rectangle may extend past it (a panel scrolled out of view, or a widget larger than the surface), and a scissor rectangle outside the attachment is a validation error rather than a no-op.