mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Fix float overlap (#3507)
This commit is contained in:
parent
ae31640c0a
commit
ba531c371e
@ -253,7 +253,7 @@ impl<'a> FlowLayouter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(first) = lines.first() {
|
if let Some(first) = lines.first() {
|
||||||
if !self.regions.size.y.fits(first.height()) && !self.regions.in_last() {
|
while !self.regions.size.y.fits(first.height()) && !self.regions.in_last() {
|
||||||
let carry: Vec<_> = self.items.drain(sticky..).collect();
|
let carry: Vec<_> = self.items.drain(sticky..).collect();
|
||||||
self.finish_region(engine, false)?;
|
self.finish_region(engine, false)?;
|
||||||
for item in carry {
|
for item in carry {
|
||||||
@ -400,7 +400,7 @@ impl<'a> FlowLayouter<'a> {
|
|||||||
FlowItem::Fractional(_) => {}
|
FlowItem::Fractional(_) => {}
|
||||||
FlowItem::Frame { ref frame, movable, .. } => {
|
FlowItem::Frame { ref frame, movable, .. } => {
|
||||||
let height = frame.height();
|
let height = frame.height();
|
||||||
if !self.regions.size.y.fits(height) && !self.regions.in_last() {
|
while !self.regions.size.y.fits(height) && !self.regions.in_last() {
|
||||||
self.finish_region(engine, false)?;
|
self.finish_region(engine, false)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ impl<'a> FlowLayouter<'a> {
|
|||||||
self.initial = self.regions.size;
|
self.initial = self.regions.size;
|
||||||
self.has_footnotes = false;
|
self.has_footnotes = false;
|
||||||
|
|
||||||
// Try to place floats.
|
// Try to place floats into the next region.
|
||||||
for item in std::mem::take(&mut self.pending_floats) {
|
for item in std::mem::take(&mut self.pending_floats) {
|
||||||
self.layout_item(engine, item)?;
|
self.layout_item(engine, item)?;
|
||||||
}
|
}
|
||||||
|
BIN
tests/ref/bugs/2595-float-overlap.png
Normal file
BIN
tests/ref/bugs/2595-float-overlap.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
13
tests/typ/bugs/2595-float-overlap.typ
Normal file
13
tests/typ/bugs/2595-float-overlap.typ
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#set page(height: 80pt)
|
||||||
|
|
||||||
|
Start.
|
||||||
|
|
||||||
|
#place(auto, float: true, [
|
||||||
|
#block(height: 100%, width: 100%, fill: aqua)
|
||||||
|
])
|
||||||
|
|
||||||
|
#place(auto, float: true, [
|
||||||
|
#block(height: 100%, width: 100%, fill: red)
|
||||||
|
])
|
||||||
|
|
||||||
|
#lorem(20)
|
@ -1,4 +1,4 @@
|
|||||||
#set page(height: 170pt)
|
#set page(height: 180pt)
|
||||||
#set figure(placement: auto)
|
#set figure(placement: auto)
|
||||||
|
|
||||||
#figure(
|
#figure(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user