[Sugar-devel] [PATCH] fix calculation for determining the placement of badges
walter.bender at gmail.com
Thu Aug 18 05:01:17 EDT 2011
On Thu, Aug 18, 2011 at 4:13 AM, Simon Schampijer <simon at schampijer.de> wrote:
> On 08/17/2011 07:37 PM, Walter Bender wrote:
>> From: Walter Bender<walter.bender at gmail.com>
>> It is my understanding the icon_info.attach_x,y are pixel offsets into the
>> from the lower-left corner. If that is the case, then it should be added
>> rather than multiplied. The other interpretation is that it is a position
>> as percentage. If that is correct, then the default value should be 1.0
>> instead of 0 if the badge is to be put in the lower-left. I did do an
>> experiment with setting attach_x,y to 1.0 and got inconsistent results.
>> it set to 0 and using it as a pixel offsets works as expected. I tested
>> patch with badges on icons on the toolbar and also the network icons in
>> the mesh
>> view and everything seems to render properly.
> So 0,0 is at the left upper corner. You can see this easily by just setting
> info.attach_x and info.attach_y to 0.
> An example is:
> badge-x = int(icon-x=0.97 * icon-width=55 - badge-size=24 / 2)
> badge-y = int(icon-y=0.84 * icon-width=55 - badge-size=24 / 2)
> badge-x will be 41 and badge-y 34 in this case (now.png).
> The simplest I came up with would be:
> badge-x = int(icon-x=0.97 + icon-width=55 - badge-size=24)
> badge-y = int(icon-y=0.84 + icon-width=55 - badge-size=24)
> badge-x will be 31 and badge-y 31, too (simple.png).
> Your proposal would be:
> badge-x = int(icon-x=0.97 + icon-width=55 - badge-size=24 / 2)
> badge-y = int(icon-y=0.84 + icon-width=55 - badge-size=24 / 2)
> badge-x will be 43 and badge-y 43, too (walter.png).
> So I think our current approach is the most sophisticated one because it
> weights in x and y. I think we are good with what we have.
> Can you describe the exact issue you are seeing and maybe paste a simple
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
Where/how is attach_x,y getting set in the code? Why does the default
value not the lower right by default since that is were we position
badges by default?
More information about the Sugar-devel