keyboard works
This commit is contained in:
@@ -296,8 +296,14 @@ impl Layout {
|
||||
},
|
||||
)?;
|
||||
let root_size = self.tree.layout(self.root_node).unwrap().size;
|
||||
log::debug!(
|
||||
"content size {:.0}x{:.0} → {:.0}x{:.0}",
|
||||
self.content_size.x,
|
||||
self.content_size.y,
|
||||
root_size.width,
|
||||
root_size.height
|
||||
);
|
||||
self.content_size = vec2(root_size.width, root_size.height);
|
||||
log::error!("ContentSize: {:?}", self.content_size);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -297,15 +297,18 @@ impl WidgetState {
|
||||
) -> EventResult {
|
||||
let hovered = event.test_mouse_within_transform(params.transform_stack.get());
|
||||
|
||||
// buttons don't need to be tracked separately as long as we stick to VR use.
|
||||
let mut pressed_changed_button = None;
|
||||
let mut hovered_changed = false;
|
||||
|
||||
match &event {
|
||||
Event::MouseDown(e) => {
|
||||
pressed_changed_button = self
|
||||
.data
|
||||
.set_device_pressed(e.device, true)
|
||||
.then_some(e.button);
|
||||
if hovered {
|
||||
pressed_changed_button = self
|
||||
.data
|
||||
.set_device_pressed(e.device, true)
|
||||
.then_some(e.button);
|
||||
}
|
||||
}
|
||||
Event::MouseUp(e) => {
|
||||
pressed_changed_button = self
|
||||
@@ -314,7 +317,7 @@ impl WidgetState {
|
||||
.then_some(e.button);
|
||||
}
|
||||
Event::MouseWheel(e) => {
|
||||
if self.process_wheel(params, e) {
|
||||
if hovered && self.process_wheel(params, e) {
|
||||
return EventResult::Consumed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user