[Sugar-devel] [PATCH] fix calculation for determining the placement of badges

Walter Bender walter.bender at gmail.com
Thu Aug 18 11:25:53 EDT 2011


On Thu, Aug 18, 2011 at 10:34 AM, Gary Martin
<garycmartin at googlemail.com> wrote:
> On 18 Aug 2011, at 10:01, Walter Bender wrote:
>
>> 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
>>>> icon
>>>> 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.
>>>> Keeping
>>>> it set to 0 and using it as a pixel offsets works as expected. I tested
>>>> this
>>>> 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
>>> example?
>>>
>>> Regards,
>>>   Simon
>>>
>>>
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>
>>>
>>
>> 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?
>
> Perhaps it's just staying with the SVG coordinate system where 0,0 is in the top left corner – I don't remember coming across a design discussion defining the bottom right as the default place for badges, other than as was implemented for badging the APs.
>
> Once the dust settles, perhaps it's time to pulling together a revised HIG document.
>
> --Gary
>
>> -walter
>>
>> --
>> Walter Bender
>> Sugar Labs
>> http://www.sugarlabs.org
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>

Can someone tell me where the mesh view sets the badge position?

thanks.

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list