Fix icon padding.
This commit is contained in:
parent
ba4f68ef58
commit
f1fc80b4a8
@ -215,15 +215,15 @@ class _IconBuffer(object):
|
|||||||
return info
|
return info
|
||||||
|
|
||||||
info.size = int(_BADGE_SIZE * icon_width)
|
info.size = int(_BADGE_SIZE * icon_width)
|
||||||
info.attach_x = icon_info.attach_x * icon_width - info.size / 2
|
info.attach_x = int(icon_info.attach_x * icon_width - info.size / 2)
|
||||||
info.attach_y = icon_info.attach_y * icon_height - info.size / 2
|
info.attach_y = int(icon_info.attach_y * icon_height - info.size / 2)
|
||||||
|
|
||||||
if info.attach_x < 0 or info.attach_y < 0:
|
if info.attach_x < 0 or info.attach_y < 0:
|
||||||
info.icon_padding = max(-info.attach_x, -info.attach_y)
|
info.icon_padding = max(-info.attach_x, -info.attach_y)
|
||||||
elif info.attach_x + info.size > icon_width or \
|
elif info.attach_x + info.size > icon_width or \
|
||||||
info.attach_y + info.size > icon_height:
|
info.attach_y + info.size > icon_height:
|
||||||
x_padding = icon_width - info.attach_x - info.size
|
x_padding = info.attach_x + info.size - icon_width
|
||||||
y_padding = icon_height - info.attach_y - info.size
|
y_padding = info.attach_y + info.size - icon_height
|
||||||
info.icon_padding = max(x_padding, y_padding)
|
info.icon_padding = max(x_padding, y_padding)
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
Loading…
Reference in New Issue
Block a user