浏览代码

fix mouse interaction with widgets

Evan Almloff 2 年之前
父节点
当前提交
129a67cdc6
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      packages/tui/src/hooks.rs

+ 4 - 1
packages/tui/src/hooks.rs

@@ -287,7 +287,10 @@ impl InnerInputState {
 
         fn prepare_mouse_data(mouse_data: &MouseData, layout: &Layout) -> MouseData {
             let Point { x, y } = layout.location;
-            let node_origin = ClientPoint::new(x.into(), y.into());
+            let node_origin = ClientPoint::new(
+                layout_to_screen_space(x).into(),
+                layout_to_screen_space(y).into(),
+            );
 
             let new_client_coordinates = (mouse_data.client_coordinates() - node_origin)
                 .to_point()