From 60f246ece2a088a802759975f68745f29bef8deb Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Tue, 17 Dec 2024 06:41:18 -0300 Subject: Fix sticky blocks at the top of blocks and pages (#5581) Co-authored-by: Laurenz --- .../issue-5296-block-sticky-in-block-at-top.png | Bin 0 -> 277 bytes ...e-5296-block-sticky-spaced-from-top-of-page.png | Bin 0 -> 277 bytes ...block-sticky-weakly-spaced-from-top-of-page.png | Bin 0 -> 236 bytes tests/suite/layout/container.typ | 25 +++++++++++++++++++++ 4 files changed, 25 insertions(+) create mode 100644 tests/ref/issue-5296-block-sticky-in-block-at-top.png create mode 100644 tests/ref/issue-5296-block-sticky-spaced-from-top-of-page.png create mode 100644 tests/ref/issue-5296-block-sticky-weakly-spaced-from-top-of-page.png (limited to 'tests') diff --git a/tests/ref/issue-5296-block-sticky-in-block-at-top.png b/tests/ref/issue-5296-block-sticky-in-block-at-top.png new file mode 100644 index 00000000..ad0ace76 Binary files /dev/null and b/tests/ref/issue-5296-block-sticky-in-block-at-top.png differ diff --git a/tests/ref/issue-5296-block-sticky-spaced-from-top-of-page.png b/tests/ref/issue-5296-block-sticky-spaced-from-top-of-page.png new file mode 100644 index 00000000..ad0ace76 Binary files /dev/null and b/tests/ref/issue-5296-block-sticky-spaced-from-top-of-page.png differ diff --git a/tests/ref/issue-5296-block-sticky-weakly-spaced-from-top-of-page.png b/tests/ref/issue-5296-block-sticky-weakly-spaced-from-top-of-page.png new file mode 100644 index 00000000..9bcdbe56 Binary files /dev/null and b/tests/ref/issue-5296-block-sticky-weakly-spaced-from-top-of-page.png differ diff --git a/tests/suite/layout/container.typ b/tests/suite/layout/container.typ index 799300f0..9948a00e 100644 --- a/tests/suite/layout/container.typ +++ b/tests/suite/layout/container.typ @@ -279,3 +279,28 @@ First! // Test box in 100% width block. #block(width: 100%, fill: red, box("a box")) #block(width: 100%, fill: red, [#box("a box") #box()]) + +--- issue-5296-block-sticky-in-block-at-top --- +#set page(height: 3cm) +#v(1.6cm) +#block(height: 2cm, breakable: true)[ + #block(sticky: true)[*A*] + + b +] + +--- issue-5296-block-sticky-spaced-from-top-of-page --- +#set page(height: 3cm) +#v(2cm) + +#block(sticky: true)[*A*] + +b + +--- issue-5296-block-sticky-weakly-spaced-from-top-of-page --- +#set page(height: 3cm) +#v(2cm, weak: true) + +#block(sticky: true)[*A*] + +b -- cgit v1.2.3