Don't allocate interactive bounds

This commit is contained in:
Nathan Sobo 2023-12-14 11:28:52 -07:00
parent 1ae25f52a1
commit 0d30b698a4
2 changed files with 8 additions and 20 deletions

View file

@ -46,29 +46,17 @@ const ACTIVE_DRAG_Z_INDEX: u8 = 1;
pub struct StackingOrder {
#[deref]
#[deref_mut]
z_indices: Arc<SmallVec<[u8; 8]>>,
z_indices: SmallVec<[u8; 32]>,
}
impl Default for StackingOrder {
fn default() -> Self {
StackingOrder {
z_indices: Arc::new(SmallVec::new()),
z_indices: SmallVec::new(),
}
}
}
impl StackingOrder {
/// Pushes a new z-index onto the stacking order.
pub fn push(&mut self, z_index: u8) {
Arc::make_mut(&mut self.z_indices).push(z_index);
}
/// Pops the last z-index off the stacking order.
pub fn pop(&mut self) {
Arc::make_mut(&mut self.z_indices).pop();
}
}
/// Represents the two different phases when dispatching events.
#[derive(Default, Copy, Clone, Debug, Eq, PartialEq)]
pub enum DispatchPhase {