pub struct Areas {
areas: IdMap<AreaState>,
order: Vec<LayerId>,
visible_last_frame: HashSet<LayerId>,
visible_current_frame: HashSet<LayerId>,
wants_to_be_on_top: HashSet<LayerId>,
sublayers: HashMap<LayerId, HashSet<LayerId>>,
}
Expand description
Fields§
§areas: IdMap<AreaState>
§order: Vec<LayerId>
Back-to-front. Top is last.
visible_last_frame: HashSet<LayerId>
§visible_current_frame: HashSet<LayerId>
§wants_to_be_on_top: HashSet<LayerId>
When an area want to be on top, it is put in here. At the end of the frame, this is used to reorder the layers. This means if several layers want to be on top, they will keep their relative order. So if you close three windows and then reopen them all in one frame, they will all be sent to the top, but keep their previous internal order.
sublayers: HashMap<LayerId, HashSet<LayerId>>
List of sublayers for each layer
When a layer has sublayers, they are moved directly above it 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 order_map(&self) -> HashMap<LayerId, usize>
pub(crate) fn order_map(&self) -> HashMap<LayerId, usize>
For each layer, which order is it in Self::order
?
pub(crate) fn set_state(&mut self, layer_id: LayerId, state: AreaState)
sourcepub fn layer_id_at(
&self,
pos: Pos2,
layer_transforms: &HashMap<LayerId, TSTransform>
) -> Option<LayerId>
pub fn layer_id_at( &self, pos: Pos2, layer_transforms: &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.