UI: Color Picker Positioning #106122

Merged
Harley Acheson merged 1 commits from Harley/blender:PickerPosition into main 2023-04-13 19:45:06 +02:00
Member

If there is not enough space for the Color Picker either above or below
the launching button, adjust the position to fit instead of clipping.


I have noticed some discussion lately about the Color Picker being too small. This PR doesn't address that problem at all, but instead fixes the issue that currently makes it impossible to currently consider making it larger. This is because of the way that we position and clip popup blocks.

Right now we position such a block either above or below the button that launches it, which ever distance is greater. This means that for buttons that are near the middle vertically these blocks cannot be larger than half the window height. Anything greater is simply clipped.

You might have experienced this like the following:

image

This PR adjusts the position of the Color Picker either up or down if there is not enough room. So instead you would see the following when the space is similarly constrained, positioned below the calling button but still usable:

image

If there is not enough space for the Color Picker either above or below the launching button, adjust the position to fit instead of clipping. --- I have noticed some discussion lately about the Color Picker being too small. This PR doesn't address that problem at all, but instead fixes the issue that currently makes it impossible to currently consider making it larger. This is because of the way that we position and clip popup blocks. Right now we position such a block either above or below the button that launches it, which ever distance is greater. This means that for buttons that are near the middle vertically these blocks cannot be larger than half the window height. Anything greater is simply clipped. You might have experienced this like the following: ![image](/attachments/bc19ee35-9763-4236-9739-6a1bf81911f8) This PR adjusts the position of the Color Picker either up or down if there is not enough room. So instead you would see the following when the space is similarly constrained, positioned below the calling button but still usable: ![image](/attachments/507aff28-44f7-45cb-aadb-6a368528f7b8)
Member

That's much nicer!
I ran into this a few times when making changes to themes in the preferences. So it's good to handle this.

It would be nice, if all the corners of the backdrop were rounded, when the color picker is shifted and it doesn't align with the button anymore. At that point it's essentially a floating window.
It's a small thing but in the worst case it can make it look like the color picker belongs to a different button:
unfortunate_alignment.png
It seems like just setting dir1 = UI_DIR_ALL when shifting the color picker works, but I haven't checked too closely if that introduces some weirdness down the line.

That's much nicer! I ran into this a few times when making changes to themes in the preferences. So it's good to handle this. It would be nice, if all the corners of the backdrop were rounded, when the color picker is shifted and it doesn't align with the button anymore. At that point it's essentially a floating window. It's a small thing but in the worst case it can make it look like the color picker belongs to a different button: ![unfortunate_alignment.png](/attachments/83e18941-4635-423e-8d70-644139fe0c1b) It seems like just setting `dir1 = UI_DIR_ALL` when shifting the color picker works, but I haven't checked too closely if that introduces some weirdness down the line.
Author
Member

@lone_noel - all the corners of the backdrop...a floating window.

Oh, I hadn't notice that at all because I had my theme "Roundness" turned down so far. Will take a look. Thanks!

> @lone_noel - all the corners of the backdrop...a floating window. Oh, I hadn't notice that at all because I had my theme "Roundness" turned down so far. Will take a look. Thanks!
Harley Acheson changed title from UI: Color Picker Positioning to WIP: UI: Color Picker Positioning 2023-03-25 14:38:16 +01:00
Harley Acheson force-pushed PickerPosition from 167a28a93f to 3a59308b42 2023-03-25 20:26:15 +01:00 Compare
Harley Acheson changed title from WIP: UI: Color Picker Positioning to UI: Color Picker Positioning 2023-03-25 20:27:24 +01:00
Hans Goudey added this to the User Interface project 2023-03-25 22:02:38 +01:00
Harley Acheson requested review from Campbell Barton 2023-03-28 22:37:44 +02:00
Campbell Barton approved these changes 2023-04-13 08:13:45 +02:00
@ -267,6 +285,7 @@ static void ui_popup_block_position(wmWindow *window,
/* Center over popovers for eg. */
if (block->direction & UI_DIR_CENTER_X) {
offset_x += BLI_rctf_size_x(&butrct) / ((dir2 == UI_DIR_LEFT) ? 2 : -2);
block->direction = UI_DIR_CENTER_Y;

It's not clear why this change is needed - when the repositioning is performed. (should be noted in comment)

It's not clear why this change is needed - when the repositioning is performed. (should be noted in comment)
Harley marked this conversation as resolved

In general having color pickers show in these small windows isn't going to well and could even result in a user clicking twice and accessing the color picker accidentally for e.g. OTOH, this functionality seems like an improvement - something users would prefer - so it seems fine.

In general having color pickers show in these small windows isn't going to well and could even result in a user clicking twice and accessing the color picker accidentally for e.g. OTOH, this functionality seems like an improvement - something users would prefer - so it seems fine.
Harley Acheson force-pushed PickerPosition from 3a59308b42 to acb4a8a957 2023-04-13 19:05:02 +02:00 Compare
Harley Acheson merged commit fa13058fa6 into main 2023-04-13 19:45:06 +02:00
Harley Acheson deleted branch PickerPosition 2023-04-13 19:45:07 +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
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#106122
No description provided.