UI: Fix Scrollbar overlaps sidebar on zoom #108295

Open
Harley Acheson wants to merge 2 commits from Harley/blender:CatScroll into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

When zooming an area with panel category tabs, the vertical scroll bar
can be placed in a position that overlaps the tabs.


This is offered as a simpler alternative to #106014. This is actually the same solution, but done more succinctly so should be easier to review. Our hope is to get this into 3.6 as a bug fix.

image

When zooming an area with panel category tabs, the vertical scroll bar can be placed in a position that overlaps the tabs. --- This is offered as a simpler alternative to #106014. This is actually the same solution, but done more succinctly so should be easier to review. Our hope is to get this into 3.6 as a bug fix. ![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
Poster
Collaborator

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?
Poster
Collaborator

@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) {

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`.
Poster
Collaborator

@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.

Reviewers

Pablo Vazquez was requested for review 2023-05-25 23:02:48 +02:00
Campbell Barton requested changes 2023-05-26 05:53:43 +02:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
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
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
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
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
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
There is no content yet.