Make a staggered second row of preset icons in the popup palette for large values.
ClosedPublic

Authored by woltherav on Mar 7 2019, 4:04 PM.

Details

Summary

30~ presets in the popup palette current leads to very tiny icons.

This patch adds the ability for a second row of presets to be added, so the icons won't have to be as tiny.


30 preset slots.


21 preset slots.

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
woltherav requested review of this revision.Mar 7 2019, 4:04 PM
woltherav created this revision.

Good idea. I wonder if we can extract this logic and put it in a function to isolate what is going on. There is a lot math stuff going on with this file already, so I am always a little concerned that adding more math stuff is going to make this file even harder to understand if we don't try to organize/comment it more.

It would also be nice to add some comment(s) about why we need 2 rows. The reasoning for doing this is hard to figure out just by looking at the code. Something like this would be good in the comments before the logic... "Once we get a lot of presets, the icons get really small. This will make the icons have two rows so the icons can be more legible"... or something similar to that. If someone wants to change it later, that gives them a hint on why this logic was added in the first place.

woltherav updated this revision to Diff 53379.Mar 7 2019, 5:24 PM

Add some comments, fix caching that wasn't happening.

woltherav updated this revision to Diff 53380.Mar 7 2019, 5:31 PM

Remove the qdebug, almost fix the gap, but only at 30 presets.

woltherav updated this revision to Diff 53442.Mar 8 2019, 2:26 PM

Managed to figure out the math for an optimum size:


15


30


22

woltherav updated this revision to Diff 53448.Mar 8 2019, 2:45 PM

Ensure there's a tiny 2 pixel gap between presets so it is not too overwhelming.

yes. Looks nice!

dkazakov accepted this revision.Mar 11 2019, 1:58 PM
dkazakov added a subscriber: dkazakov.

Hi, @woltherav!

The patch looks and works fine. I'm okay with pushing it into master.

The only bug I could find is the absence of margin between internal and outer circles (see screenshot below). Please add a couple of pixels of margin and push! :)

This revision is now accepted and ready to land.Mar 11 2019, 1:58 PM
woltherav edited the summary of this revision. (Show Details)Mar 11 2019, 2:09 PM
This revision was automatically updated to reflect the committed changes.