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.button.step(input, state);
self.landscape.step(input, state);
self.frame.step(input, state);
self.button
.step(input, state, Some(self.frame.get_rect(input)));
self.landscape
.step(input, state, Some(self.frame.get_rect(input)));
self.frame.step(input, state, None);
// Draw elements
self.button

View File

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