[input] fix: hover highlight either scroll or window resize; not both
This commit is contained in:
@@ -181,10 +181,10 @@ impl Prepared {
|
||||
|
||||
// intentionally use same id for inside and outside of handle
|
||||
let interact_id = id.with("vertical");
|
||||
let handle_interact = ui.interact(handle_rect, interact_id, Sense::click_and_drag());
|
||||
let mut interact = ui.interact(handle_rect, interact_id, Sense::click_and_drag());
|
||||
|
||||
if let Some(mouse_pos) = ui.input().mouse.pos {
|
||||
if handle_interact.active {
|
||||
if interact.active {
|
||||
if inner_rect.top() <= mouse_pos.y && mouse_pos.y <= inner_rect.bottom() {
|
||||
state.offset.y +=
|
||||
ui.input().mouse.delta.y * content_size.y / inner_rect.height();
|
||||
@@ -199,6 +199,8 @@ impl Prepared {
|
||||
let mpos_top = mouse_pos.y - handle_rect.height() / 2.0;
|
||||
state.offset.y = remap(mpos_top, top..=bottom, 0.0..=content_size.y);
|
||||
}
|
||||
|
||||
interact = interact.union(scroll_bg_interact);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,8 +214,8 @@ impl Prepared {
|
||||
);
|
||||
|
||||
let style = ui.style();
|
||||
let handle_fill_color = style.interact(&handle_interact).fill_color;
|
||||
let handle_outline = style.interact(&handle_interact).rect_outline;
|
||||
let handle_fill_color = style.interact(&interact).fill_color;
|
||||
let handle_outline = style.interact(&interact).rect_outline;
|
||||
|
||||
ui.add_paint_cmd(paint::PaintCmd::Rect {
|
||||
rect: outer_scroll_rect,
|
||||
|
||||
@@ -168,7 +168,6 @@ impl<'open> Window<'open> {
|
||||
|
||||
let mut area = area.begin(ctx);
|
||||
{
|
||||
// TODO: pick style for frame and title based on interaction
|
||||
let mut frame = frame.begin(&mut area.content_ui);
|
||||
{
|
||||
let ui = &mut frame.content_ui;
|
||||
@@ -211,6 +210,7 @@ impl<'open> Window<'open> {
|
||||
*open = false;
|
||||
}
|
||||
}
|
||||
// TODO: pick style for title based on move interaction
|
||||
title_bar.title_ui(ui);
|
||||
}
|
||||
|
||||
@@ -402,6 +402,11 @@ fn resize_hover(
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.memory().interaction.drag_interest {
|
||||
// Another widget will become active if we drag here
|
||||
return None;
|
||||
}
|
||||
|
||||
let side_interact_radius = 5.0; // TODO: from style
|
||||
let corner_interact_radius = 10.0; // TODO
|
||||
if rect.expand(side_interact_radius).contains(mouse_pos) {
|
||||
|
||||
Reference in New Issue
Block a user