Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(composer): focus picker #1101

Merged
merged 12 commits into from
Sep 8, 2024
Merged

feat(composer): focus picker #1101

merged 12 commits into from
Sep 8, 2024

Conversation

GeopJr
Copy link
Owner

@GeopJr GeopJr commented Sep 6, 2024

The focus picker

Mastodon allows you to pick the thumbnail focus of your attachments. It's based on https://github.com/jonom/jquery-focuspoint#1-calculate-your-images-focus-point

The focus point is communicated in the form of coordinates:

image

(0,0) being the center of the image, (1,1) the top right corner and (-1,-1) the bottom left one

The FocusPicker widget is responsible for displaying an image and moving the picker but also for calculating this mess.

API coordinates <=> width, height coordinates

007

The width,height coordinates have to be recalculated when the window gets resized (etc) so it stays in place as the image also gets resized

Mastodon also does this thing where you can focus outside of the image - even though the actual coordinates are image size based, as seen in its preview:

image

Enough talk, demo:

Screencast.from.2024-09-06.06-11-00.mp4

Notice how it stays in position between resizing, plus it stays in the limits of the image

TODO:

  • Finish the dialog
  • Accessibility (probably a scale for keyboard navigation)
  • Sends the coordinates to the API
  • Re-use the coordinates on edit (will probably have to make the pos_x/y props public or a helper function)
  • Select an actual good looking picker and make it circular
  • Hide picker overflow on bottom and right (shouldnt be visible outside the picture)

fix: #173

@GeopJr GeopJr marked this pull request as ready for review September 8, 2024 00:40
@GeopJr
Copy link
Owner Author

GeopJr commented Sep 8, 2024

I think it's almost done, not really sure about the picker anymore but 🤷

This needs fixing too:

image

Screencast.from.2024-09-08.03-42-30.mp4

@GeopJr GeopJr merged commit ed3f9f9 into main Sep 8, 2024
5 checks passed
@GeopJr GeopJr deleted the feat/composer/focus-picker branch September 8, 2024 01:00
rmader added a commit to rmader/Tuba that referenced this pull request Sep 11, 2024
@GeopJr
Copy link
Owner Author

GeopJr commented Sep 24, 2024

@rmader is there something broken with the focus picker? (curious about the above revert 😅)

@rmader
Copy link
Contributor

rmader commented Sep 24, 2024

@rmader is there something broken with the focus picker? (curious about the above revert 😅)

Hehe, well spotted :P And sorry for the noise, should have removed the commit message. Something in the patch breaks for me on Fedora 40 (with gtk+libadwaita from git) - I assume some vala bug or so. I've switched to Fedora 41 now and here everything builds fine.

@GeopJr
Copy link
Owner Author

GeopJr commented Sep 24, 2024

No worries about the noise! I assume it was the AudioVisualizer's adw 1.6 accent colors, I guess-worked how the binding should look like on release but I was wrong (actually I'm right and the bindings are incomplete but I'm not going to argue (accent_color_rgba should have been a property, instead I have to call the getter get_accent_color_rgba()))

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.

[Request]: Ability to specify the focal point of each image being attached when posting a status / toot
2 participants