Skip to content

borders: disable frame line controls when border geometry prevents it - #22108

Merged
TurboGit merged 2 commits into
darktable-org:masterfrom
masterpiga:borders_ui
Sep 1, 2026
Merged

borders: disable frame line controls when border geometry prevents it#22108
TurboGit merged 2 commits into
darktable-org:masterfrom
masterpiga:borders_ui

Conversation

@masterpiga

@masterpiga masterpiga commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

A small but significant UX improvement in the borders module.

The frame line width is proportional to the minimum border width across all four sides (MIN(border_size_l, border_size_r, border_size_t, border_size_b)). When border size is 0 or when horizontal/vertical offset is set to an extreme value (0.0 or 1.0), one or more side borders are absent, collapsing the minimum border width to 0 and preventing the frame line from rendering.

This PR:

  1. Disables frame line width, offset, and color controls when border geometry prevents the frame line from being visible.
  2. Dynamically updates their tooltips to explain the exact adjustment needed (e.g., "increase border size to enable the frame line", "decrease horizontal offset to enable the frame line").
  3. Restores default tooltips and sensitivity when geometry allows a valid frame line.

Tested:

  • Verified dynamic sensitivity and contextual tooltip updates in darkroom across various combinations of border size, horizontal offset, and vertical offset.

Co-authored with Gemini.

Note that this is stacked on top of #22107, which has a fix for a borders-related crash.

EDIT: also fixed centering of the frame line, as requested by @TurboGit in the comments.

@masterpiga masterpiga added this to the 5.8 milestone Sep 1, 2026
@masterpiga masterpiga added priority: low core features work as expected, only secondary/optional features don't scope: UI user interface and interactions feature: exists Requested functionality is already available, possibly via plugin labels Sep 1, 2026
@masterpiga
masterpiga force-pushed the borders_ui branch 2 times, most recently from 6f7ce00 to 52bf239 Compare September 1, 2026 15:34
@TurboGit

TurboGit commented Sep 1, 2026

Copy link
Copy Markdown
Member

As we are at UI fixed on border, an issue I have found while checking this PR:

Border size 5%, horiz offet 50%, vert offset 50%, aspect square:

image

All good the red line is at then center of the left/right border (horiz 50%).

Now, lets change border size only to 2%, see that the red border is not anymore on the center:

image

I bet some kind of float precision.

@masterpiga

Copy link
Copy Markdown
Collaborator Author

Yup, you were right. Fixed in the added commit.

image

The frame line width is proportional to the minimum border width across
all four sides. When border size is 0 or when horizontal/vertical
offsets are set to extreme values (0.0 or 1.0), the minimum border
width collapses to 0, making the frame line invisible.

Disable frame line width, offset, and color controls when geometry
prevents the frame line from rendering, and update their tooltips to
explain the required adjustment.
Frame line boundary coordinates previously subtracted 1 to represent
inclusive pixel indices, but were assigned directly to half-open interval
endpoints (fl_right, border_right, fl_bot, border_bot). This caused the
inner border on the right and bottom sides to be 1 pixel narrower and the
outer border 1 pixel wider, noticeably shifting the frame line off-center
at smaller border sizes and downscaled preview resolutions.
Define the bottom-right frame coordinates as exclusive upper bounds,
matching CPU slice lengths and OpenCL bounding box expectations, and
use roundf() on fractional offset and size products.

@TurboGit TurboGit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@TurboGit
TurboGit merged commit 3b2afa4 into darktable-org:master Sep 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: exists Requested functionality is already available, possibly via plugin priority: low core features work as expected, only secondary/optional features don't scope: UI user interface and interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants