UI: Improve region resize edge detection for transparent regions #109753

Merged
Julian Eisel merged 4 commits from JulianEisel/blender:temp-region-resize-edge-offset-fix into main 2023-07-10 12:53:48 +02:00
Member

For overlapping regions, we currently offset the edge for resizing
regions a bit towards the contents. This makes sense for example in the
sidebar, where the region background is fully transparent by default,
and users expect the edge to be where the visible contents begin. This
was an issue in #104831 for two reasons:

  • Although the region overlaps, we decided to make it fully opaque by
    default. The offset is still applied, making the edge detection feel
    broken.
  • The offset would also be applied to header-like regions, where there
    is not much padding between the edge and the content. So the edge to
    resize the region would overlap buttons.

2 changes to address this:

  • Only apply the offset if the region background is transparent-ish,
    with a rather arbitrary alpha threshold.
  • Do not apply the offset for header-like regions.
For overlapping regions, we currently offset the edge for resizing regions a bit towards the contents. This makes sense for example in the sidebar, where the region background is fully transparent by default, and users expect the edge to be where the visible contents begin. This was an issue in #104831 for two reasons: - Although the region overlaps, we decided to make it fully opaque by default. The offset is still applied, making the edge detection feel broken. - The offset would also be applied to header-like regions, where there is not much padding between the edge and the content. So the edge to resize the region would overlap buttons. 2 changes to address this: - Only apply the offset if the region background is transparent-ish, with a rather arbitrary alpha threshold. - Do not apply the offset for header-like regions.
Julian Eisel added 1 commit 2023-07-05 17:41:24 +02:00
fb511f312f UI: Improve region resize edge detection for transparent regions
For overlapping regions, we currently offset the edge for resizing
regions a bit towards the contents. This makes sense for example in the
sidebar, where the region background is fully transparent by default,
and users expect the edge to be where the visible contents begin. This
was an issue in #104831 for two reasons:
- Although the region overlaps, we decided to make it fully opaque by
  default. The offset is still applied, making the edge detection feel
  broken.
- The offset would also be applied to header-like regions, where there
  is not much padding between the edge and the content. So the edge to
  resize the region would overlap buttons.

2 changes to address this:
- Only apply the offset if the region background is transparent-ish,
  with a rather arbitrary alpha threshold.
- Do not apply the offset for header-like regions.
Julian Eisel added 1 commit 2023-07-05 17:44:49 +02:00
Julian Eisel requested review from Campbell Barton 2023-07-05 17:50:08 +02:00
Campbell Barton approved these changes 2023-07-07 09:37:46 +02:00
@ -933,0 +935,4 @@
* less than 50 on a [0-255] scale (rather arbitrary threshold). Assumes the region uses #TH_BACK
* for its background.
*/
static bool region_back_is_barely_visible(const ScrArea *area, const ARegion *region)

Naming: region_back_is_barely_visible reads a bit strangely, something may be invisible because of it's size/placement.

region_background_is_transparent the doc-string can note that a threshold is used. Or the name could be expanded to include that but I don't think it's necessary.

Naming: `region_back_is_barely_visible` reads a bit strangely, something may be invisible because of it's size/placement. `region_background_is_transparent` the doc-string can note that a threshold is used. Or the name could be expanded to include that but I don't think it's necessary.
JulianEisel marked this conversation as resolved
@ -940,0 +960,4 @@
(region->overlap && region_back_is_barely_visible(area, region) &&
/* Header-like regions are usually thin and there's not much padding around them, applying
* an offset would make the edge overlap buttons.*/
!RGN_TYPE_IS_HEADER_ANY(region->regiontype)) ?

picky would check !RGN_TYPE_IS_HEADER_ANY(region->regiontype) before region_back_is_barely_visible as UI_Theme_Store / UI_Theme_Restore is heavier than this check.

*picky* would check `!RGN_TYPE_IS_HEADER_ANY(region->regiontype)` before `region_back_is_barely_visible` as `UI_Theme_Store` / `UI_Theme_Restore` is heavier than this check.
JulianEisel marked this conversation as resolved
Julian Eisel added 2 commits 2023-07-10 12:52:32 +02:00
Julian Eisel merged commit d94edda4fd into main 2023-07-10 12:53:48 +02:00
Julian Eisel deleted branch temp-region-resize-edge-offset-fix 2023-07-10 12:53:49 +02:00
Sign in to join this conversation.
No reviewers
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
2 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#109753
No description provided.