Skip to content

feat(Status): move thread lines to snapshoting#1315

Merged
GeopJr merged 1 commit intomainfrom
feat/status/thread-line-snapshoting
Jan 31, 2025
Merged

feat(Status): move thread lines to snapshoting#1315
GeopJr merged 1 commit intomainfrom
feat/status/thread-line-snapshoting

Conversation

@GeopJr
Copy link
Owner

@GeopJr GeopJr commented Jan 31, 2025

fix: #633

This should improve performance a bit too.

Here's how thread lines used to work:

  • Tootle

Thread line was a single GtkImage that changed its alignment and margins based on the ROLE (start, middle, end)

  • Tuba before this PR

I had experimented with different approaches without completely moving away from Tootle's and ended up with one GtkImage for the line above the avatar and one for below. They changed visibility based on ROLE (start = bottom visible, middle = both visible, end = top visible)

Now there were two GtkImages when it should be none. The pos over Tootle's approach was better alignment and easier to maintain than guessing margins.

  • Tuba after this PR

Using snapshoting, it draws a line based on the ROLE and the avatar's position.

It should be faster and have better alignment as we control how and where it gets drawn.

There are comments describing the maths and thought process but the gist is:

  • get avatar's point based on the status widget
  • increase its x position by the avatar's width / 2 + the thread line width / 2, this way the thread line will be drawn exactly at the center of the avatar
  • based on the role calculate the thread line height, but increase it a bit or start at a negative value so it fills the whole status (border and all) because it looks better that way
  • set opacity, get color from widget, push pop
  • redraw when needed

@GeopJr GeopJr merged commit 62b8dc0 into main Jan 31, 2025
3 of 5 checks passed
@GeopJr GeopJr deleted the feat/status/thread-line-snapshoting branch January 31, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: When opening a post's thread, GtkImage reported min height -17 (or -16), but sizes must be >= 0

1 participant