Calculate the position of the menu near the cog properly

Instead of magic numbers, use a proper calculation according
to the elements' positions.

Bug: 49471
Change-Id: I9093b2c684f557e9e562762b7ef25ced37b8848b
Merge "Calculate the position of the menu near the cog properly"