use SlotMap

This commit is contained in:
Aleksander 2026-02-14 16:04:36 +01:00
parent 4fc439abe2
commit 756c42609d
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ use std::{
use anyhow::Context;
use glam::{Affine3A, Vec3, Vec3A};
use slotmap::{HopSlotMap, Key, SecondaryMap};
use slotmap::{Key, SecondaryMap, SlotMap};
use wgui::log::LogErr;
use wlx_common::{
astr_containers::{AStrMap, AStrMapExt},
@ -42,7 +42,7 @@ pub const MAX_OVERLAY_SETS: usize = 6;
pub struct OverlayWindowManager<T> {
wrappers: EditWrapperManager,
overlays: HopSlotMap<OverlayID, OverlayWindowData<T>>,
overlays: SlotMap<OverlayID, OverlayWindowData<T>>,
sets: Vec<OverlayWindowSet>,
global_set: OverlayWindowSet,
/// The set that is currently visible.
@ -65,7 +65,7 @@ where
pub fn new(app: &mut AppState, headless: bool) -> anyhow::Result<Self> {
let mut me = Self {
wrappers: EditWrapperManager::default(),
overlays: HopSlotMap::with_key(),
overlays: SlotMap::<OverlayID, OverlayWindowData<T>>::with_key(),
current_set: Some(0),
restore_set: 0,
sets: vec![OverlayWindowSet::default()],

View File

@ -18,7 +18,7 @@ use crate::{
use anyhow::Context;
use glam::{Vec2, vec2};
use slotmap::{HopSlotMap, SecondaryMap, new_key_type};
use slotmap::{SecondaryMap, SlotMap, new_key_type};
use taffy::{NodeId, TaffyTree, TraversePartialTree};
new_key_type! {
@ -57,7 +57,7 @@ impl WeakWidget {
}
}
pub struct WidgetMap(HopSlotMap<WidgetID, Widget>);
pub struct WidgetMap(SlotMap<WidgetID, Widget>);
pub type WidgetNodeMap = SecondaryMap<WidgetID, taffy::NodeId>;
#[derive(Clone)]
@ -68,7 +68,7 @@ pub struct WidgetPair {
impl WidgetMap {
fn new() -> Self {
Self(HopSlotMap::with_key())
Self(SlotMap::<WidgetID, Widget>::with_key())
}
pub fn get_as<T: 'static>(&self, handle: WidgetID) -> Option<RefMut<'_, T>> {