UI: Fix Scrollbar overlaps sidebar on zoom #108295

Merged
Harley Acheson merged 8 commits from Harley/blender:CatScroll into main 2023-06-22 18:56:34 +02:00
Member

When zooming an area with panel category tabs, ensure that the vertical
scroll bar is repositioned to not overlap the tabs.


The central issue is that we don't reposition the scroll actionzones once they are created. In most cases this doesn't matter, but does here where we want a scaled position away from the right edge.

This PR makes it so that AZONE_REGION_SCROLL are hit tested against the area around the scrollbar itself, not the action zone rect. We always move and resize scrollbars properly, so no need to keep a separate rect in sync with them.

image

When zooming an area with panel category tabs, ensure that the vertical scroll bar is repositioned to not overlap the tabs. --- The central issue is that we don't reposition the scroll actionzones once they are created. In most cases this doesn't matter, but does here where we want a scaled position away from the right edge. This PR makes it so that AZONE_REGION_SCROLL are hit tested against the area around the scrollbar itself, not the action zone rect. We always move and resize scrollbars properly, so no need to keep a separate rect in sync with them. ![image](/attachments/fabe6519-17bb-4962-beb6-02f8f9394c6f)
Harley Acheson added 1 commit 2023-05-25 23:00:57 +02:00
55bf1f7e76 UI: Fix Scrollbar overlaps sidebar on zoom
When zooming an area with panel category tabs, the vertical scroll bar
can be placed in a position that overlaps the tabs.
Harley Acheson added this to the User Interface project 2023-05-25 23:02:19 +02:00
Harley Acheson added this to the 3.6 LTS milestone 2023-05-25 23:02:26 +02:00
Harley Acheson requested review from Pablo Vazquez 2023-05-25 23:02:48 +02:00
Harley Acheson requested review from Campbell Barton 2023-05-25 23:04:52 +02:00
Campbell Barton requested changes 2023-05-26 05:53:43 +02:00
Campbell Barton left a comment
Owner

Did you check on handing this when the scroll-bars are initially placed?

The problem with moving the scroll bars while drawing is the action zones might not be updated for event handling, testing the patch it causes flickering opacity & size while dragging.

Did you check on handing this when the scroll-bars are initially placed? The problem with moving the scroll bars while drawing is the action zones might not be updated for event handling, testing the patch it causes flickering opacity & size while dragging.
@ -3137,1 +3139,3 @@
mask.xmax -= UI_PANEL_CATEGORY_MARGIN_WIDTH;
const int category_tabs_width = round_fl_to_int(UI_view2d_scale_get_x(&region->v2d) *
UI_PANEL_CATEGORY_MARGIN_WIDTH);
mask.xmax = mask.xmax - category_tabs_width;

Can still use -=.

Can still use `-=`.
Harley marked this conversation as resolved
@ -3138,0 +3142,4 @@
BLI_rcti_translate(&region->v2d.vert, -category_tabs_width, 0);
/* Adjust the scroller's action zone. */
LISTBASE_FOREACH (AZone *, az, &CTX_wm_area(C)->actionzones) {

It would read more clearly if there was a function to lookup the action zone, e.g.

AZone *az = BKE_area_find_action_zone_by_type(area, region, AZONE_REGION_SCROLL);
if (az) {
  ...
}
It would read more clearly if there was a function to lookup the action zone, e.g. ``` AZone *az = BKE_area_find_action_zone_by_type(area, region, AZONE_REGION_SCROLL); if (az) { ... } ```
Harley marked this conversation as resolved
Harley Acheson added 1 commit 2023-05-26 19:10:13 +02:00
Author
Member

Did you check on handing this when the scroll-bars are initially placed?

I did and found no luck. In this panel draw we call UI_view2d_scrollers_draw_ex with a mask only in this case, but currently calculating the right side without using local zoom. But if corrected the azone is in the wrong spot.

The problem with moving the scroll bars while drawing is the action zones might not be updated for event handling, testing the patch it causes flickering opacity & size while dragging.

I'm not seeing a differing behavior from current while dragging over the scrollbars. I'm just test by dragging an outliner item over it and it seems to look the same as 3.5 while doing so. Are you testing a particular action that looks worse?

> Did you check on handing this when the scroll-bars are initially placed? I did and found no luck. In this panel draw we call UI_view2d_scrollers_draw_ex with a mask only in this case, but currently calculating the right side without using local zoom. But if corrected the azone is in the wrong spot. > The problem with moving the scroll bars while drawing is the action zones might not be updated for event handling, testing the patch it causes flickering opacity & size while dragging. I'm not seeing a differing behavior from current while dragging over the scrollbars. I'm just test by dragging an outliner item over it and it seems to look the same as 3.5 while doing so. Are you testing a particular action that looks worse?
Author
Member

@ideasman42 - testing the patch it causes flickering opacity & size while dragging

Still not sure what you are seeing. When testing I see the same behavior with size and opacity changes while approaching, and while dragging the scrollbar it looks the same to me. Are you describing something different, a different process, or state from the following?

ScrollOffset.gif

> @ideasman42 - testing the patch it causes flickering opacity & size while dragging Still not sure what you are seeing. When testing I see the same behavior with size and opacity changes while approaching, and while dragging the scrollbar it looks the same to me. Are you describing something different, a different process, or state from the following? ![ScrollOffset.gif](/attachments/b8877808-4dba-4ae4-bd11-b4a67a47a524)
Julian Eisel reviewed 2023-06-08 13:06:11 +02:00
@ -3138,0 +3143,4 @@
/* Adjust the scroller's action zone. */
AZone *az = ED_area_actionzone_find_by_type(CTX_wm_area(C), region, AZONE_REGION_SCROLL);
if (az) {
Member

I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me. region_azone_scrollbar_init() sets the azone rectangles, could we do this elsewhere, based on the modified mask rectangle?
We could do it as part of area_actionzone_refresh_xy(), but that might not be called when we need it. Another option is to support dynamically changing rectangles, e.g. there could be a AZone.get_rect() callback instead of Azone.rect.

I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me. `region_azone_scrollbar_init()` sets the azone rectangles, could we do this elsewhere, based on the modified mask rectangle? We could do it as part of `area_actionzone_refresh_xy()`, but that might not be called when we need it. Another option is to support dynamically changing rectangles, e.g. there could be a `AZone.get_rect()` callback instead of `Azone.rect`.
Harley marked this conversation as resolved
Author
Member

@JulianEisel - I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me

Yes, a bit whiffy to me too.

It looks like it might be possible to modify area_actionzone_refresh_xy but might make a bit of a mess. Instead of testing the point against the azone's rect we could (just for AZONE_REGION_SCROLL) test against the az->region->vert (+- V2D_SCROLL_HIDE_WIDTH) instead. That way the azone's rect doesn't have to be changed? Would look weird to treat one type of zone differently though and to ignore its actual position.

> @JulianEisel - I don't like the idea of manipulating action-zones in region drawing code, this has quite a bit of a code smell to me Yes, a bit whiffy to me too. It looks like it _might_ be possible to modify `area_actionzone_refresh_xy` but might make a bit of a mess. Instead of testing the point against the azone's rect we could (just for AZONE_REGION_SCROLL) test against the az->region->vert (+- V2D_SCROLL_HIDE_WIDTH) instead. That way the azone's rect doesn't have to be changed? Would look weird to treat one type of zone differently though and to ignore its actual position.
Harley Acheson changed title from UI: Fix Scrollbar overlaps sidebar on zoom to WIP: UI: Fix Scrollbar overlaps sidebar on zoom 2023-06-21 02:09:59 +02:00
Harley Acheson added 1 commit 2023-06-21 02:12:40 +02:00
Harley Acheson added 1 commit 2023-06-21 02:45:43 +02:00
Harley Acheson added 1 commit 2023-06-21 02:55:07 +02:00
Author
Member

This looks to be a much nicer solution, but needs a bit more testing.

This looks to be a much nicer solution, but needs a bit more testing.
Harley Acheson added 1 commit 2023-06-21 17:19:06 +02:00
Harley Acheson changed title from WIP: UI: Fix Scrollbar overlaps sidebar on zoom to UI: Fix Scrollbar overlaps sidebar on zoom 2023-06-21 17:22:41 +02:00
Campbell Barton approved these changes 2023-06-22 03:57:47 +02:00
@ -1062,7 +1062,6 @@ static void region_azone_scrollbar_init(ScrArea *area,
{
rcti scroller_vert = (direction == AZ_SCROLL_VERT) ? region->v2d.vert : region->v2d.hor;

This can be removed as it's no longer used.

This can be removed as it's no longer used.
Harley marked this conversation as resolved
Julian Eisel approved these changes 2023-06-22 14:50:47 +02:00
Harley Acheson added 1 commit 2023-06-22 18:32:48 +02:00
Harley Acheson added 1 commit 2023-06-22 18:35:31 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
36003b9e0d
Merge branch 'main' into CatScroll
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson merged commit 080a00bda2 into main 2023-06-22 18:56:34 +02:00
Harley Acheson deleted branch CatScroll 2023-06-22 18:56:36 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#108295
No description provided.