Skip to content

Commit

Permalink
Merge pull request #5281 from Textualize/fix-grid-offset
Browse files Browse the repository at this point in the history
fix for grid plus offset
  • Loading branch information
willmcgugan authored Nov 24, 2024
2 parents de9897b + 7afdb85 commit df8ffb1
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.87.1] - 2024-11-24

## Fixed

- Fixed offset not being applied to grid layout https://github.com/Textualize/textual/pull/5281

## [0.87.0] - 2024-11-24

Expand Down
10 changes: 7 additions & 3 deletions src/textual/layouts/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,16 @@ def apply_height_limits(widget: Widget, height: int) -> int:
.shrink(margin)
) + offset

widget_styles = widget.styles
placement_offset = (
styles.offset.resolve(cell_size, viewport)
if styles.has_rule("offset")
widget_styles.offset.resolve(cell_size, viewport)
if widget_styles.has_rule("offset")
else NULL_OFFSET
)

absolute = (
widget_styles.has_rule("position") and styles.position == "absolute"
)
add_placement(
_WidgetPlacement(
region,
Expand All @@ -305,7 +309,7 @@ def apply_height_limits(widget: Widget, height: int) -> int:
else margin.grow_maximum(gutter_spacing)
),
widget,
styles.has_rule("position") and styles.position == "absolute",
absolute,
)
)

Expand Down
Loading

0 comments on commit df8ffb1

Please sign in to comment.