Expand description
A group of DrawCall
s.
This is really a pointer to a CxView
(indexed in Cx::views
using View::view_id
),
so you can find more information there.
A View
has a few special features:
- It has its own
Rect
, within which everything is clipped (see also [DrawUniforms
]). This typically gets set by the return value ofCx::end_typed_box
for the [CxLayoutBox
] that is associated with theView
. TODO(JP): Look into decoupling [CxLayoutBox
] fromView
. - It can scroll (but does not have to; again see also [
DrawUniforms
]). - It has its own set of
DrawCall
s, which are isolated from theDrawCall
s of the parentView
.
Fields
view_id: Option<usize>
Implementations
Creates a new, empty View
.
See View::is_overlay
.
Register the View
in the draw tree.
This also creates a new [CxLayoutBox
] with the LayoutSize
that is passed in.
Note that you should not create a View
just in order to get a new
[CxLayoutBox
], since creating a View
is relatively expensive – no
DrawCall
s inside this View
will get merged with ones outside of
it, so adding too many View
s will create too many individual calls to
the GPU.
TODO(JP): Perhaps we should decouple [CxLayoutBox
] and View
altogether?
End the View
, by ending the [CxLayoutBox
]. Returns a ViewArea
that
you can hold onto.
Should only be called if View::begin_view
returned Result::Ok
.
TODO(JP): Is the ViewArea
redundant, since it basically contains the
same information as the View
itself?
Get the Rect
that the [CxLayoutBox
] associated with the View
returned.
TODO(JP): Should we return an Option<Rect>
instead of just
returning a zero-sized Rect
when the View
has never been
drawn yet?
TODO(JP): Doesn’t check if the View::redraw_id
is still up to
date, so we might be returning an outdated Rect
here.
Returns an Area::View
for this View
, or Area::Empty
if the
View
hasn’t been instantiated yet.
Get the current CxView::unsnapped_scroll
if the View
has been
instantiated.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for View
impl UnwindSafe for View
Blanket Implementations
Mutably borrows from an owned value. Read more