add offset / scrolling + clipboard support

This commit is contained in:
2025-09-27 21:13:00 -04:00
parent 95f049acb4
commit 5445008528
16 changed files with 386 additions and 99 deletions

View File

@@ -3,7 +3,7 @@ use ui::{
layout::Vec2,
};
use winit::{
event::{MouseButton, WindowEvent},
event::{MouseButton, MouseScrollDelta, WindowEvent},
keyboard::{Key, NamedKey},
};
@@ -32,6 +32,13 @@ impl Input {
_ => (),
}
}
WindowEvent::MouseWheel { delta, .. } => {
let delta = match *delta {
MouseScrollDelta::LineDelta(x, y) => Vec2::new(x, y),
MouseScrollDelta::PixelDelta(pos) => Vec2::new(pos.x as f32, pos.y as f32),
};
self.cursor.scroll_delta = delta;
}
WindowEvent::CursorLeft { .. } => {
self.cursor.exists = false;
self.modifiers.clear();
@@ -56,7 +63,7 @@ impl Input {
}
pub fn end_frame(&mut self) {
self.cursor.buttons.end_frame();
self.cursor.end_frame();
}
}