Permalink
Browse files

fix for pos_hint calculation in boxlayout (#706)

  • Loading branch information...
1 parent fe35921 commit 66d0f3336447da146f2ccf34b4b22bb9f16ebf76 @Titousensei Titousensei committed Oct 7, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 kivy/uix/boxlayout.py
View
@@ -149,12 +149,14 @@ def do_layout(self, *largs):
h = shh * (selfh - padding2)
for key, value in c.pos_hint.iteritems():
+ posy = value * (selfh - padding2)
if key == 'y':
- cy = y + value * h
+ cy = y + posy
elif key == 'top':
- cy = y + selfh - value * h
+ cy = y + posy - h
elif key == 'center_y':
- cy = y + selfh / 2. - (value * h)
+ cy = y - h / 2. + posy
+
c.x = cx
c.y = cy
c.width = w
@@ -178,12 +180,13 @@ def do_layout(self, *largs):
w = shw * (selfw - padding2)
for key, value in c.pos_hint.iteritems():
+ posx = value * (selfw - padding2)
if key == 'x':
- cx = x + value * w
+ cx = x + posx
elif key == 'right':
- cx = x + selfw - value * w
+ cx = x + posx - w
elif key == 'center_x':
- cx = x + selfw / 2. - (value * w)
+ cx = x - w / 2. + posx
c.x = cx
c.y = cy

0 comments on commit 66d0f33

Please sign in to comment.