Highlighting selection bounds on rulers#1723
Conversation
| if (selection_start < selection_end) { | ||
|
|
||
| // Convert selection coordinates to ruler widget coordinates | ||
| double p1 = (selection_start - Lower) * (settings.EffectiveSize.Width / (Upper - Lower)); |
There was a problem hiding this comment.
Maybe there should be a helper function for this conversion, since it also happens for the marker position?
| double p1 = (selection_start - Lower) * (settings.EffectiveSize.Width / (Upper - Lower)); | ||
| double p2 = (selection_end - Lower) * (settings.EffectiveSize.Width / (Upper - Lower)); | ||
|
|
||
| cr.SetSourceRgba (0.5, 0.7, 1.0, 0.5); // Semi-transparent blue |
There was a problem hiding this comment.
How does it look with the same color that's used for selections on the canvas?
|
You are right @cameronwhite, although the selection bounds are a As for the selection color, I think the one I chose is more similar to Paint.NET's. Not that Pinta has to copy its features, but it's worth noting for context. The color you suggested is on commit bccde34 and it looks like this: Pinta_5k3ds041x6.mp4On a different, but related note, looking through the code, I found that the public readonly record struct RectangleD (
double X,
double Y,
double Width,
double Height)
{
// ...
public readonly RectangleI ToInt ()
=> new (
(int) Math.Floor (X),
(int) Math.Floor (Y),
(int) Math.Ceiling (Width),
(int) Math.Ceiling (Height));
// ...
}I think this could be unclear or misleading. Maybe we should add an |
|
Thanks! The original color looks better, but maybe we can make it a more subtle (e.g. a bit more transparent perhaps?) We could actually use https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.StyleManager.get_accent_color_rgba.html to get the exact same color, but I'm not sure if we want that since the accent color can vary based on system settings (https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/css-variables.html#accent-colors), and I think this should stay blue to match the selection. Using the same blue color could be worth trying though
|
|
@cameronwhite now the color is more similar to Adwaita's accent color. I normalized the channels to a range of 0-1, rounded it to two decimal places, and set an alpha of 0.25.
|
|
Thanks! That colour looks good to me 👍 |







Addresses #1094
For multiple selections I'd like to highlight the different bounds separately, but I think this will do for now.
pinta_rule_highlighting.mp4