#[non_exhaustive]pub enum SceneLayer {
Under,
Interleaved,
Over,
}Expand description
Which paint band a lightweight SceneItem sits in, relative to
the heavyweight widget tier.
The band is the leading digit of PaintKey, so it decides both what is
drawn on top and what the pointer picks — one rule, not two.
| band | rank | where it paints |
|---|---|---|
Under | RANK_UNDER | in SceneView::paint, a backdrop beneath every card |
Interleaved | RANK_WIDGET | among the cards, ordered against them by z |
Over | RANK_OVER | in SceneView::post_paint, above every card |
Within a band, set_z orders items among themselves; in
Interleaved that same z is compared against the cards’ z.
§What Interleaved orders against, and what it does not
Cards, and only cards — the heavyweight widget children, which are what the
arena’s child walk contains. It is not an ordering against the other two
bands, and in particular not against Under: the whole of the Under band
is painted inside SceneView::paint, which runs before the first child, so
every Under item is below every interleaved one no matter what the two
zs say. Likewise every Over item is above every interleaved one.
The consequence worth stating outright, because it surprises: in a scene
with no heavyweight children at all, an interleaved item is on top of
everything. There is nothing in the child walk for it to sit between, and
its z is compared against an empty set. A lightweight-only page that wants
ink under some of its content wants Under plus a z, or wants the content
it is drawing on to be cards.
§Why Interleaved is not free
Under and Over cost nothing: the render walker offers a paint position
before and after a node’s child subtree, and those are the two bands. There
is no third position between two children, so an interleaved item is
painted by a node of its own that the view materialises and slots into the
z-sorted child list.
That node is paint only. It is
event_pass_through,
so the pointer still resolves through the lightweight hit snapshot exactly
as it does for the other two bands, and it is left out of
SceneView::accessibility_children, so the item keeps the same synthetic
SyntheticKind::SceneItem
node it had in Under — same off-screen culling, same reparenting, same
rotor category. Choosing this band changes what the item is painted
between and nothing else.
What it does cost is one arena node per interleaved item. Ink is the case
this exists for (“this stroke is above note A and below note B”), and a
page of ink wants a GroupItem per layer rather
than a band per stroke — see docs/ink.md.
#[non_exhaustive]: this enum has now grown a variant once, and the reason
it could is that the render walker’s two paint positions were never the
whole answer. A downstream match gets a _ arm today rather than a break
the next time.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Under
Painted under the heavyweight widget children (the default).
Interleaved
Painted among the heavyweight widget children, ordered against them
by z — and against nothing else: still above every Under item and
below every Over one, and on top of everything in a scene that has no
heavyweight children. See the type docs for that and for what it costs.
Over
Painted over the heavyweight widget children.
Trait Implementations§
Source§impl Clone for SceneLayer
impl Clone for SceneLayer
Source§fn clone(&self) -> SceneLayer
fn clone(&self) -> SceneLayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SceneLayer
Source§impl Debug for SceneLayer
impl Debug for SceneLayer
Source§impl Default for SceneLayer
impl Default for SceneLayer
Source§fn default() -> SceneLayer
fn default() -> SceneLayer
impl Eq for SceneLayer
Source§impl PartialEq for SceneLayer
impl PartialEq for SceneLayer
impl StructuralPartialEq for SceneLayer
Auto Trait Implementations§
impl Freeze for SceneLayer
impl RefUnwindSafe for SceneLayer
impl Send for SceneLayer
impl Sync for SceneLayer
impl Unpin for SceneLayer
impl UnsafeUnpin for SceneLayer
impl UnwindSafe for SceneLayer
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more