Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Matthieu-LAURENT39
Copy link
Contributor

This adds an animation to the selection outline, shifting the outline to the right to give a rotating look.
This should close #1521.

@Matthieu-LAURENT39 Matthieu-LAURENT39 force-pushed the animated-selection-outline branch from 28a69c2 to 23a6979 Compare October 31, 2025 12:04
@Matthieu-LAURENT39 Matthieu-LAURENT39 force-pushed the animated-selection-outline branch from 23a6979 to d8e4964 Compare October 31, 2025 12:05
int maxY = int.MinValue;
bool hasPoint = false;

foreach (var polygon in document.Selection.SelectionPolygons) {
Copy link
Member

Choose a reason for hiding this comment

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

Can this use DocumentSelection.GetBounds() to reuse some existing code? There are also some methods on the rectangle classes for inflating with padding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed, that simplifies the function a lot, thanks for pointing that out

document.Workspace.CanvasInvalidated += OnCanvasInvalidated;

// Timer for selection outline animation
selection_animation_timer_id = GLib.Functions.TimeoutAdd (GLib.Constants.PRIORITY_DEFAULT, 80, SelectionAnimationTick);
Copy link
Member

Choose a reason for hiding this comment

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

If you have multiple tabs open, is the timer tick going to cause any wasteful work / redrawing for the tabs that aren't being shown?

Copy link
Contributor Author

@Matthieu-LAURENT39 Matthieu-LAURENT39 Nov 8, 2025

Choose a reason for hiding this comment

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

I tried to do some tests to check if the having many tabs open with active selections slowed down the process, but it was pretty inconclusive. I wonder if GTK doesn't redraw the invalidated area because it knows it's not rendered.
Still, I added an extra check to make the tick do nothing on non-active tabs, just in case.

@cameronwhite
Copy link
Member

Thanks! Those changes look good to me 👍

@cameronwhite cameronwhite merged commit 62f3a97 into PintaProject:master Nov 11, 2025
7 checks passed
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.

Emphasize selected area

2 participants