Fix again

master
Mark 2024-01-25 22:10:33 -08:00
parent e6512d83fa
commit 9eb528f993
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 8 additions and 8 deletions

View File

@ -117,9 +117,11 @@ impl Planet {
self.reflow(planet, state); self.reflow(planet, state);
} }
self.button.step(input, state); self.button
self.landscape.step(input, state); .step(input, state, Some(self.frame.get_rect(input)));
self.frame.step(input, state); self.landscape
.step(input, state, Some(self.frame.get_rect(input)));
self.frame.step(input, state, None);
// Draw elements // Draw elements
self.button self.button

View File

@ -39,16 +39,14 @@ impl UiSprite {
}; };
} }
pub fn step(&mut self, input: &RenderInput, state: &RenderState) { pub fn step(&mut self, input: &RenderInput, state: &RenderState, parent: Option<SpriteRect>) {
if self.contains_mouse(input, state, Some(self.get_rect(input))) if self.contains_mouse(input, state, parent)
&& !self.has_mouse && !self.has_mouse
&& self.on_mouse_enter.is_some() && self.on_mouse_enter.is_some()
{ {
self.has_mouse = true; self.has_mouse = true;
self.anim.jump_to(input.ct, self.on_mouse_enter.unwrap()) self.anim.jump_to(input.ct, self.on_mouse_enter.unwrap())
} } else if !self.contains_mouse(input, state, parent)
if !self.contains_mouse(input, state, Some(self.get_rect(input)))
&& self.has_mouse && self.has_mouse
&& self.on_mouse_leave.is_some() && self.on_mouse_leave.is_some()
{ {