Skip to content

Commit 84f1762

Browse files
authored
Merge pull request #65 from Neradoc/patch-1
Missing int conversions on cell_anchor_point math
2 parents 48b512a + 46d158c commit 84f1762

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_displayio_layout/layouts/grid_layout.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ def _layout_cells(self):
176176
cell["content"].anchored_position = (
177177
int(grid_position_x * self._width / grid_size_x)
178178
+ self.cell_padding
179-
+ (cell["cell_anchor_point"][0] * _measured_width),
179+
+ int(cell["cell_anchor_point"][0] * _measured_width),
180180
int(grid_position_y * self._height / grid_size_y)
181181
+ self.cell_padding
182-
+ (cell["cell_anchor_point"][1] * _measured_height),
182+
+ int(cell["cell_anchor_point"][1] * _measured_height),
183183
)
184184

185185
self.append(cell["content"])
@@ -236,29 +236,29 @@ def _layout_cells(self):
236236
cell["content"].anchored_position[1]
237237
+ _measured_height
238238
+ self.cell_padding
239-
- (cell["cell_anchor_point"][1] * _measured_height)
239+
- int(cell["cell_anchor_point"][1] * _measured_height)
240240
) - 1
241241
_bottom_line_loc_x = (
242242
cell["content"].anchored_position[0]
243243
- self.cell_padding
244-
- (cell["cell_anchor_point"][0] * _measured_width)
244+
- int(cell["cell_anchor_point"][0] * _measured_width)
245245
)
246246

247247
_top_line_loc_y = (
248248
cell["content"].anchored_position[1]
249249
- self.cell_padding
250-
- (cell["cell_anchor_point"][1] * _measured_height)
250+
- int(cell["cell_anchor_point"][1] * _measured_height)
251251
)
252252
_top_line_loc_x = (
253253
cell["content"].anchored_position[0]
254254
- self.cell_padding
255-
- (cell["cell_anchor_point"][0] * _measured_width)
255+
- int(cell["cell_anchor_point"][0] * _measured_width)
256256
)
257257

258258
_right_line_loc_y = (
259259
cell["content"].anchored_position[1]
260260
- self.cell_padding
261-
- (cell["cell_anchor_point"][1] * _measured_height)
261+
- int(cell["cell_anchor_point"][1] * _measured_height)
262262
)
263263
_right_line_loc_x = (
264264
(
@@ -267,7 +267,7 @@ def _layout_cells(self):
267267
+ self.cell_padding
268268
)
269269
- 1
270-
- (cell["cell_anchor_point"][0] * _measured_width)
270+
- int(cell["cell_anchor_point"][0] * _measured_width)
271271
)
272272

273273
_horizontal_divider_line = displayio.Shape(

0 commit comments

Comments
 (0)