Get basic mouse_down and mouse_up working

This commit is contained in:
Nathan Sobo 2023-08-16 22:21:27 -06:00
parent 187d78011c
commit 812d3f6af6
10 changed files with 175 additions and 82 deletions

View file

@ -5,7 +5,7 @@ use element::Element;
use frame::frame;
use gpui::{
geometry::{rect::RectF, vector::vec2f},
platform::WindowOptions,
platform::{MouseButton, WindowOptions},
};
use log::LevelFilter;
use simplelog::SimpleLogger;
@ -49,7 +49,12 @@ fn playground<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
.h_full()
.w_half()
.fill(theme.success(0.5))
.child(button().label("Hello").click(|_, _, _| (println!("hey!"))))
.child(
button()
.label("Hello")
.mouse_up(MouseButton::Left, |_, _, _| (println!("up!")))
.mouse_down(MouseButton::Left, |_, _, _| (println!("down!"))),
)
}
// todo!()