pub struct RevealedOffset {
pub offset: f64,
pub rect: Rect,
}Expand description
Return value for RenderAbstractViewport::get_offset_to_reveal.
It indicates the offset required to reveal an element in a viewport and the
rect position said element would have in the viewport at that offset.
Fields§
§offset: f64Offset for the viewport to reveal a specific element in the viewport.
rect: RectThe Rect in the outer coordinate system of the viewport at which the to-be-revealed
element would be located if the viewport’s offset is set to offset.
A viewport usually has two coordinate systems and works as an adapter between the two:
The inner coordinate system has its origin at the top left corner of the content that moves inside the viewport. The origin of this coordinate system usually moves around relative to the leading edge of the viewport when the viewport offset changes.
The outer coordinate system has its origin at the top left corner of the visible part of the viewport. This origin stays at the same position regardless of the current viewport offset.
Implementations§
Source§impl RevealedOffset
impl RevealedOffset
Sourcepub const fn new(offset: f64, rect: Rect) -> RevealedOffset
pub const fn new(offset: f64, rect: Rect) -> RevealedOffset
Instantiates a return value for RenderAbstractViewport::get_offset_to_reveal.
Sourcepub fn clamp_offset(
leading_edge_offset: RevealedOffset,
trailing_edge_offset: RevealedOffset,
current_offset: f64,
) -> Option<RevealedOffset>
pub fn clamp_offset( leading_edge_offset: RevealedOffset, trailing_edge_offset: RevealedOffset, current_offset: f64, ) -> Option<RevealedOffset>
Determines which provided leading or trailing edge of the viewport will be used for
show_in_viewport, accounting for the size and already visible portion of the render
object that is being revealed.
If the target render object is already fully visible, this returns None.