pub struct Areas {
areas: IdMap<AreaState>,
visible_areas_last_frame: HashSet<LayerId>,
visible_areas_current_frame: HashSet<LayerId>,
order: Vec<LayerId>,
order_map: HashMap<LayerId, usize>,
wants_to_be_on_top: HashSet<LayerId>,
sublayers: HashMap<LayerId, HashSet<LayerId>>,
}
Expand description
Fields§
§areas: IdMap<AreaState>
§visible_areas_last_frame: HashSet<LayerId>
§visible_areas_current_frame: HashSet<LayerId>
§order: Vec<LayerId>
Back-to-front, top is last.
order_map: HashMap<LayerId, usize>
Inverse of Self::order
, calculated at the end of the frame.
wants_to_be_on_top: HashSet<LayerId>
When an area wants to be on top, it is assigned here. This is used to reorder the layers at the end of the frame. If several layers want to be on top, they will keep their relative order. This means closing three windows and then reopening them all in one frame results in them being sent to the top and keeping their previous internal order.
sublayers: HashMap<LayerId, HashSet<LayerId>>
The sublayers that each layer has.
The parent sublayer is moved directly above the child sublayers in the ordering.
Implementations§
source§impl Areas
impl Areas
pub(crate) fn count(&self) -> usize
pub(crate) fn get(&self, id: Id) -> Option<&AreaState>
sourcepub(crate) fn compare_order(&self, a: LayerId, b: LayerId) -> Ordering
pub(crate) fn compare_order(&self, a: LayerId, b: LayerId) -> Ordering
Compare the order of two layers, based on the order list from last frame.
May return std::cmp::Ordering::Equal
if the layers are not in the order list.
pub(crate) fn set_state(&mut self, layer_id: LayerId, state: AreaState)
sourcepub fn layer_id_at(
&self,
pos: Pos2,
layer_to_global: &HashMap<LayerId, TSTransform>,
) -> Option<LayerId>
pub fn layer_id_at( &self, pos: Pos2, layer_to_global: &HashMap<LayerId, TSTransform>, ) -> Option<LayerId>
Top-most layer at the given position.
pub fn visible_last_frame(&self, layer_id: &LayerId) -> bool
pub fn is_visible(&self, layer_id: &LayerId) -> bool
pub fn visible_layer_ids(&self) -> HashSet<LayerId>
pub(crate) fn visible_windows( &self, ) -> impl Iterator<Item = (LayerId, &AreaState)>
pub fn move_to_top(&mut self, layer_id: LayerId)
sourcepub fn set_sublayer(&mut self, parent: LayerId, child: LayerId)
pub fn set_sublayer(&mut self, parent: LayerId, child: LayerId)
Mark the child
layer as a sublayer of parent
.
Sublayers are moved directly above the parent layer at the end of the frame. This is mainly intended for adding a new Area inside a Window.
This currently only supports one level of nesting. If parent
is a sublayer of another
layer, the behavior is unspecified.
The two layers must have the same LayerId::order
.
pub fn top_layer_id(&self, order: Order) -> Option<LayerId>
sourcepub fn parent_layer(&self, layer_id: LayerId) -> Option<LayerId>
pub fn parent_layer(&self, layer_id: LayerId) -> Option<LayerId>
If this layer is the sublayer of another layer, return the parent.
sourcepub fn child_layers(
&self,
layer_id: LayerId,
) -> impl Iterator<Item = LayerId> + '_
pub fn child_layers( &self, layer_id: LayerId, ) -> impl Iterator<Item = LayerId> + '_
All the child layers of this layer.
pub(crate) fn is_sublayer(&self, layer: &LayerId) -> bool
pub(crate) fn end_pass(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Areas
impl RefUnwindSafe for Areas
impl Send for Areas
impl Sync for Areas
impl Unpin for Areas
impl UnwindSafe for Areas
Blanket Implementations§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)