Change padding order to match css padding.

This commit is contained in:
Ian Foote 2013-03-24 23:19:00 +00:00
parent bf85852827
commit f53c86e088
3 changed files with 22 additions and 22 deletions

View File

@ -78,11 +78,11 @@ class BoxLayout(Layout):
padding = CssListProperty([0, 0, 0, 0])
'''Padding between layout box and children, in pixels.
padding[0] represents the left padding, padding[1] the right padding,
padding[2] the top padding and padding[3] the bottom padding.
padding[0] represents the top padding, padding[1] the right padding,
padding[2] the bottom padding and padding[3] the left padding.
If padding is given only two arguments, the first will represent left and
right padding, and the second top and bottom padding.
If padding is given only two arguments, the first will represent top and
bottom padding, and the second left and right padding.
If padding is given only one argument, it will represent all four
directions.
@ -122,10 +122,10 @@ class BoxLayout(Layout):
selfy = self.y
selfw = self.width
selfh = self.height
padding_left = self.padding[0]
padding_top = self.padding[0]
padding_right = self.padding[1]
padding_top = self.padding[2]
padding_bottom = self.padding[3]
padding_bottom = self.padding[2]
padding_left = self.padding[3]
spacing = self.spacing
orientation = self.orientation
padding_x = padding_left + padding_right

View File

@ -114,11 +114,11 @@ class GridLayout(Layout):
padding = CssListProperty([0, 0, 0, 0])
'''Padding between layout box and children, in pixels.
padding[0] represents the left padding, padding[1] the right padding,
padding[2] the top padding and padding[3] the bottom padding.
padding[0] represents the top padding, padding[1] the right padding,
padding[2] the bottom padding and padding[3] the left padding.
If padding is given only two arguments, the first will represent left and
right padding, and the second top and bottom padding.
If padding is given only two arguments, the first will represent top and
bottom padding, and the second left and right padding.
If padding is given only one argument, it will represent all four
directions.
@ -344,8 +344,8 @@ class GridLayout(Layout):
i = i - 1
# calculate minimum width/height needed, starting from padding + spacing
padding_x = self.padding[0] + self.padding[1]
padding_y = self.padding[2] + self.padding[3]
padding_x = self.padding[1] + self.padding[3]
padding_y = self.padding[0] + self.padding[2]
spacing = self.spacing
width = padding_x + spacing * (current_cols - 1)
height = padding_y + spacing * (current_rows - 1)
@ -375,8 +375,8 @@ class GridLayout(Layout):
return
# speedup
padding_left = self.padding[0]
padding_top = self.padding[2]
padding_top = self.padding[0]
padding_left = self.padding[3]
spacing = self.spacing
selfx = self.x
selfw = self.width

View File

@ -46,11 +46,11 @@ class StackLayout(Layout):
padding = CssListProperty([0, 0, 0, 0])
'''Padding between layout box and children, in pixels.
padding[0] represents the left padding, padding[1] the right padding,
padding[2] the top padding and padding[3] the bottom padding.
padding[0] represents the top padding, padding[1] the right padding,
padding[2] the bottom padding and padding[3] the left padding.
If padding is given only two arguments, the first will represent left and
right padding, and the second top and bottom padding.
If padding is given only two arguments, the first will represent top and
bottom padding, and the second left and right padding.
If padding is given only one argument, it will represent all four
directions.
@ -130,10 +130,10 @@ class StackLayout(Layout):
selfpos = self.pos
selfsize = self.size
orientation = self.orientation.split('-')
padding_left = self.padding[0]
padding_top = self.padding[0]
padding_right = self.padding[1]
padding_top = self.padding[2]
padding_bottom = self.padding[3]
padding_bottom = self.padding[2]
padding_left = self.padding[3]
padding_x = padding_left + padding_right
padding_y = padding_top + padding_bottom