mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00

Removed the drop and create from the ComponentVTable: since we are not using VBox<ComponentVTable>, this simplifies a bit the code of the interpreter and everything else. But there is still a lot of changes everywhere to support that the Component is pinned. This is just for the component. Which would be required if later we want to access the properties as Pin<Property<_>>. But we have not yet ability to do projections
29 lines
748 B
Rust
29 lines
748 B
Rust
/*! Module handling mouse events
|
|
|
|
TODO: Keyboard events
|
|
*/
|
|
|
|
use crate::abi::datastructures::MouseEvent;
|
|
use crate::ComponentRefPin;
|
|
use euclid::default::Vector2D;
|
|
|
|
pub fn process_mouse_event(component: ComponentRefPin, event: MouseEvent) {
|
|
let offset = Vector2D::new(0., 0.);
|
|
|
|
crate::item_tree::visit_items(
|
|
component,
|
|
|context, item, offset| {
|
|
let geom = item.geometry(context);
|
|
let geom = geom.translate(*offset);
|
|
|
|
if geom.contains(event.pos) {
|
|
let mut event2 = event.clone();
|
|
event2.pos -= geom.origin.to_vector();
|
|
item.input_event(event2, context);
|
|
}
|
|
|
|
geom.origin.to_vector()
|
|
},
|
|
offset,
|
|
);
|
|
}
|