Center align shortcut badges when iconSize < 48

Authored by trmdi on Mar 30 2019, 6:28 PM.



When iconSize is not big enough, center aligned shortcut badges look better than top-left aligned ones.

BUG: 406037

Test Plan
  • When iconSize < 48: shortcut badges are center aligned
  • When iconSize >= 48: they are top-left aligned

For example, with iconSize = 32:


Diff Detail

R878 Latte Dock
No Linters Available
No Unit Test Coverage
Build Status
Buildable 10269
Build 10287: arc lint + arc unit
trmdi created this revision.Mar 30 2019, 6:28 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 30 2019, 6:28 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
trmdi requested review of this revision.Mar 30 2019, 6:28 PM
trmdi edited the test plan for this revision. (Show Details)Mar 30 2019, 6:41 PM

Checking the Badge height didn't work out well?

trmdi added a comment.Mar 30 2019, 7:11 PM

Checking the Badge height didn't work out well?

I think checking the iconSize is enough. Because:

  • when iconSize >= 60, height = 0.4 * iconSize -> no need to center align badges
  • when iconSize < 60, height is always = 24, so the only condition that need to be checked is iconSize.

What is the problem with that?

Oh, 0.4*60=24

No problem, it just was too clever!

  1. Please set 58px. instead of 48px. for the checks
  2. Please add a relevant comment why 58px. was chosen for the ckeck. 58px=23px so it is oversized when 24px. are applied

afterwards it is ready to go...

trmdi added a comment.EditedMar 31 2019, 4:18 AM

Can you explain more about the number 58? What does "58=23" mean?
I choose 48 because I think it is the minimum size that top-left aligning still looks good.

From mathematical point of view, 58px. Is the first icon value that breaks the visual size we want for Badge, best fit is Badge to be 40% of height, but for 58px. is the first time that this is 41% going up to 50% when icon size 48px.

But you are right icon sizes 48-58 the top left alignment should look acceptable...

So, forget 1 just do 2 add a comment describing the 48px. produce a badge of 50% iconsize and above that is not acceptable for top left and we prefer a center alignment.

trmdi updated this revision to Diff 55107.Mar 31 2019, 6:31 AM

Add comments

mvourlakos accepted this revision as: mvourlakos.Mar 31 2019, 6:34 AM
This revision is now accepted and ready to land.Mar 31 2019, 6:34 AM
This revision was automatically updated to reflect the committed changes.