kozan_core/events/
ui_event.rs1use kozan_macros::Event;
6
7#[derive(Debug, Clone, Event)]
12#[event()]
13#[non_exhaustive]
14pub struct ScrollEvent {
15 pub scroll_x: f32,
17 pub scroll_y: f32,
19}
20
21#[derive(Debug, Clone, Event)]
26#[event()]
27#[non_exhaustive]
28pub struct ResizeEvent {
29 pub width: f32,
31 pub height: f32,
33}
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38 use crate::events::{Bubbles, Cancelable, Event};
39
40 #[test]
41 fn scroll_event_does_not_bubble() {
42 let evt = ScrollEvent {
43 scroll_x: 0.0,
44 scroll_y: 150.0,
45 };
46 assert_eq!(evt.bubbles(), Bubbles::No);
47 assert_eq!(evt.cancelable(), Cancelable::No);
48 }
49
50 #[test]
51 fn resize_event_does_not_bubble() {
52 let evt = ResizeEvent {
53 width: 1920.0,
54 height: 1080.0,
55 };
56 assert_eq!(evt.bubbles(), Bubbles::No);
57 assert_eq!(evt.cancelable(), Cancelable::No);
58 }
59}