update px dependent on resize + move painter data into struct in ui
This commit is contained in:
@@ -169,8 +169,8 @@ impl<Ctx: UiCtx + 'static> SensorCtx for Ctx {
|
||||
|
||||
impl<Ctx: UiCtx + 'static> CursorModule<Ctx> {
|
||||
pub fn run(ctx: &mut Ctx, cursor: &CursorState, window_size: Vec2) {
|
||||
let layers = std::mem::take(&mut ctx.ui().layers);
|
||||
let mut module = std::mem::take(ctx.ui().modules.get_mut::<Self>());
|
||||
let layers = std::mem::take(&mut ctx.ui().data.layers);
|
||||
let mut module = std::mem::take(ctx.ui().data.modules.get_mut::<Self>());
|
||||
|
||||
for i in layers.indices().rev() {
|
||||
let Some(list) = module.active.get_mut(&i) else {
|
||||
@@ -203,10 +203,10 @@ impl<Ctx: UiCtx + 'static> CursorModule<Ctx> {
|
||||
}
|
||||
}
|
||||
|
||||
let ui_mod = ctx.ui().modules.get_mut::<Self>();
|
||||
let ui_mod = ctx.ui().data.modules.get_mut::<Self>();
|
||||
std::mem::swap(ui_mod, &mut module);
|
||||
ui_mod.merge(module);
|
||||
ctx.ui().layers = layers;
|
||||
ctx.ui().data.layers = layers;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user