mirror of
https://github.com/danbulant/mangui
synced 2026-07-08 12:20:34 +00:00
fix offset calculations
This commit is contained in:
parent
c785b36442
commit
ef22786b66
1 changed files with 7 additions and 1 deletions
|
|
@ -177,6 +177,12 @@ pub fn run_event_loop(root_node: SharedNode) -> ! {
|
||||||
|
|
||||||
match path {
|
match path {
|
||||||
Some(path) => {
|
Some(path) => {
|
||||||
|
let target_layout = context.node_layout.get(path.last().unwrap());
|
||||||
|
let target_layout = match target_layout {
|
||||||
|
Some(target_layout) => target_layout,
|
||||||
|
None => { return; }
|
||||||
|
};
|
||||||
|
let target_layout = context.taffy.layout(target_layout.to_owned()).unwrap();
|
||||||
let mevent = MouseEvent {
|
let mevent = MouseEvent {
|
||||||
button: Some(button),
|
button: Some(button),
|
||||||
buttons: mouse_value.buttons,
|
buttons: mouse_value.buttons,
|
||||||
|
|
@ -184,7 +190,7 @@ pub fn run_event_loop(root_node: SharedNode) -> ! {
|
||||||
movement: Location::new(0., 0.),
|
movement: Location::new(0., 0.),
|
||||||
device: device_id,
|
device: device_id,
|
||||||
modifiers,
|
modifiers,
|
||||||
offset: Location::new(0., 0.)
|
offset: location - target_layout.location.into()
|
||||||
};
|
};
|
||||||
let event = NodeEvent {
|
let event = NodeEvent {
|
||||||
target: path.last().unwrap().clone(),
|
target: path.last().unwrap().clone(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue