parent
62795909d8
commit
01429d72cd
3 changed files with 36 additions and 37 deletions
|
|
@ -762,7 +762,7 @@ where
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
_ => mouse::Cursor::Unavailable,
|
_ => cursor.levitate(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let had_input_method = shell.input_method().is_enabled();
|
let had_input_method = shell.input_method().is_enabled();
|
||||||
|
|
@ -1178,35 +1178,33 @@ where
|
||||||
let (mouse_over_y_scrollbar, mouse_over_x_scrollbar) =
|
let (mouse_over_y_scrollbar, mouse_over_x_scrollbar) =
|
||||||
scrollbars.is_mouse_over(cursor);
|
scrollbars.is_mouse_over(cursor);
|
||||||
|
|
||||||
if (mouse_over_x_scrollbar || mouse_over_y_scrollbar)
|
if state.scrollers_grabbed() {
|
||||||
|| state.scrollers_grabbed()
|
return mouse::Interaction::None;
|
||||||
{
|
|
||||||
mouse::Interaction::None
|
|
||||||
} else {
|
|
||||||
let translation =
|
|
||||||
state.translation(self.direction, bounds, content_bounds);
|
|
||||||
|
|
||||||
let cursor = match cursor_over_scrollable {
|
|
||||||
Some(cursor_position)
|
|
||||||
if !(mouse_over_x_scrollbar || mouse_over_y_scrollbar) =>
|
|
||||||
{
|
|
||||||
mouse::Cursor::Available(cursor_position + translation)
|
|
||||||
}
|
|
||||||
_ => mouse::Cursor::Unavailable,
|
|
||||||
};
|
|
||||||
|
|
||||||
self.content.as_widget().mouse_interaction(
|
|
||||||
&tree.children[0],
|
|
||||||
content_layout,
|
|
||||||
cursor,
|
|
||||||
&Rectangle {
|
|
||||||
y: bounds.y + translation.y,
|
|
||||||
x: bounds.x + translation.x,
|
|
||||||
..bounds
|
|
||||||
},
|
|
||||||
renderer,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let translation =
|
||||||
|
state.translation(self.direction, bounds, content_bounds);
|
||||||
|
|
||||||
|
let cursor = match cursor_over_scrollable {
|
||||||
|
Some(cursor_position)
|
||||||
|
if !(mouse_over_x_scrollbar || mouse_over_y_scrollbar) =>
|
||||||
|
{
|
||||||
|
mouse::Cursor::Available(cursor_position + translation)
|
||||||
|
}
|
||||||
|
_ => cursor.levitate(),
|
||||||
|
};
|
||||||
|
|
||||||
|
self.content.as_widget().mouse_interaction(
|
||||||
|
&tree.children[0],
|
||||||
|
content_layout,
|
||||||
|
cursor,
|
||||||
|
&Rectangle {
|
||||||
|
y: bounds.y + translation.y,
|
||||||
|
x: bounds.x + translation.x,
|
||||||
|
..bounds
|
||||||
|
},
|
||||||
|
renderer,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn overlay<'b>(
|
fn overlay<'b>(
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,11 @@ where
|
||||||
Event::Mouse(mouse::Event::CursorMoved { .. })
|
Event::Mouse(mouse::Event::CursorMoved { .. })
|
||||||
| Event::Touch(touch::Event::FingerMoved { .. }) => {
|
| Event::Touch(touch::Event::FingerMoved { .. }) => {
|
||||||
if state.is_dragging {
|
if state.is_dragging {
|
||||||
let _ = cursor.position().and_then(locate).map(change);
|
let _ = cursor
|
||||||
|
.land()
|
||||||
|
.position()
|
||||||
|
.and_then(locate)
|
||||||
|
.map(change);
|
||||||
|
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
|
|
@ -527,12 +531,10 @@ where
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
) -> mouse::Interaction {
|
) -> mouse::Interaction {
|
||||||
let state = tree.state.downcast_ref::<State>();
|
let state = tree.state.downcast_ref::<State>();
|
||||||
let bounds = layout.bounds();
|
|
||||||
let is_mouse_over = cursor.is_over(bounds);
|
|
||||||
|
|
||||||
if state.is_dragging {
|
if state.is_dragging {
|
||||||
mouse::Interaction::Grabbing
|
mouse::Interaction::Grabbing
|
||||||
} else if is_mouse_over {
|
} else if cursor.is_over(layout.bounds()) {
|
||||||
mouse::Interaction::Grab
|
mouse::Interaction::Grab
|
||||||
} else {
|
} else {
|
||||||
mouse::Interaction::default()
|
mouse::Interaction::default()
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,8 @@ where
|
||||||
Event::Mouse(mouse::Event::CursorMoved { .. })
|
Event::Mouse(mouse::Event::CursorMoved { .. })
|
||||||
| Event::Touch(touch::Event::FingerMoved { .. }) => {
|
| Event::Touch(touch::Event::FingerMoved { .. }) => {
|
||||||
if is_dragging {
|
if is_dragging {
|
||||||
let _ = cursor.position().and_then(locate).map(change);
|
let _ =
|
||||||
|
cursor.land().position().and_then(locate).map(change);
|
||||||
|
|
||||||
shell.capture_event();
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
|
|
@ -522,12 +523,10 @@ where
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
) -> mouse::Interaction {
|
) -> mouse::Interaction {
|
||||||
let state = tree.state.downcast_ref::<State>();
|
let state = tree.state.downcast_ref::<State>();
|
||||||
let bounds = layout.bounds();
|
|
||||||
let is_mouse_over = cursor.is_over(bounds);
|
|
||||||
|
|
||||||
if state.is_dragging {
|
if state.is_dragging {
|
||||||
mouse::Interaction::Grabbing
|
mouse::Interaction::Grabbing
|
||||||
} else if is_mouse_over {
|
} else if cursor.is_over(layout.bounds()) {
|
||||||
mouse::Interaction::Grab
|
mouse::Interaction::Grab
|
||||||
} else {
|
} else {
|
||||||
mouse::Interaction::default()
|
mouse::Interaction::default()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue