Make it easier to grab the handle of a floating scroll bar (#4754)
Should solve https://github.com/rerun-io/rerun/issues/6700
This commit is contained in:
parent
770c82a3f3
commit
f0e2bd8b00
|
|
@ -966,17 +966,22 @@ impl Prepared {
|
||||||
// top/bottom of a horizontal scroll (d==0).
|
// top/bottom of a horizontal scroll (d==0).
|
||||||
// left/rigth of a vertical scroll (d==1).
|
// left/rigth of a vertical scroll (d==1).
|
||||||
let mut cross = if scroll_style.floating {
|
let mut cross = if scroll_style.floating {
|
||||||
|
// The bounding rect of a fully visible bar.
|
||||||
|
// When we hover this area, we should show the full bar:
|
||||||
let max_bar_rect = if d == 0 {
|
let max_bar_rect = if d == 0 {
|
||||||
outer_rect.with_min_y(outer_rect.max.y - scroll_style.allocated_width())
|
outer_rect.with_min_y(outer_rect.max.y - outer_margin - scroll_style.bar_width)
|
||||||
} else {
|
} else {
|
||||||
outer_rect.with_min_x(outer_rect.max.x - scroll_style.allocated_width())
|
outer_rect.with_min_x(outer_rect.max.x - outer_margin - scroll_style.bar_width)
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_hovering_bar_area = is_hovering_outer_rect
|
let is_hovering_bar_area = is_hovering_outer_rect
|
||||||
&& ui.rect_contains_pointer(max_bar_rect)
|
&& ui.rect_contains_pointer(max_bar_rect)
|
||||||
|| state.scroll_bar_interaction[d];
|
|| state.scroll_bar_interaction[d];
|
||||||
|
|
||||||
let is_hovering_bar_area_t = ui
|
let is_hovering_bar_area_t = ui
|
||||||
.ctx()
|
.ctx()
|
||||||
.animate_bool_responsive(id.with((d, "bar_hover")), is_hovering_bar_area);
|
.animate_bool_responsive(id.with((d, "bar_hover")), is_hovering_bar_area);
|
||||||
|
|
||||||
let width = show_factor
|
let width = show_factor
|
||||||
* lerp(
|
* lerp(
|
||||||
scroll_style.floating_width..=scroll_style.bar_width,
|
scroll_style.floating_width..=scroll_style.bar_width,
|
||||||
|
|
|
||||||
|
|
@ -1163,9 +1163,9 @@ impl Default for Spacing {
|
||||||
impl Default for Interaction {
|
impl Default for Interaction {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
interact_radius: 5.0,
|
||||||
resize_grab_radius_side: 5.0,
|
resize_grab_radius_side: 5.0,
|
||||||
resize_grab_radius_corner: 10.0,
|
resize_grab_radius_corner: 10.0,
|
||||||
interact_radius: 5.0,
|
|
||||||
show_tooltips_only_when_still: true,
|
show_tooltips_only_when_still: true,
|
||||||
tooltip_delay: 0.5,
|
tooltip_delay: 0.5,
|
||||||
tooltip_grace_time: 0.2,
|
tooltip_grace_time: 0.2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue