mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
/Last
in PDF should refer to the last _immediate_ children (#3447)
This commit is contained in:
parent
ee2128d115
commit
72d324c5b4
@ -97,7 +97,9 @@ pub(crate) fn write_outline(ctx: &mut PdfContext) -> Option<Ref> {
|
|||||||
ctx.pdf
|
ctx.pdf
|
||||||
.outline(root_id)
|
.outline(root_id)
|
||||||
.first(start_ref)
|
.first(start_ref)
|
||||||
.last(Ref::new(ctx.alloc.get() - 1))
|
.last(Ref::new(
|
||||||
|
ctx.alloc.get() - tree.last().map(|child| child.len() as i32).unwrap_or(1),
|
||||||
|
))
|
||||||
.count(tree.len() as i32);
|
.count(tree.len() as i32);
|
||||||
|
|
||||||
Some(root_id)
|
Some(root_id)
|
||||||
@ -152,10 +154,9 @@ fn write_outline_item(
|
|||||||
outline.prev(prev_rev);
|
outline.prev(prev_rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if !node.children.is_empty() {
|
if let Some(last_immediate_child) = node.children.last() {
|
||||||
let current_child = Ref::new(id.get() + 1);
|
outline.first(Ref::new(id.get() + 1));
|
||||||
outline.first(current_child);
|
outline.last(Ref::new(next_ref.get() - last_immediate_child.len() as i32));
|
||||||
outline.last(Ref::new(next_ref.get() - 1));
|
|
||||||
outline.count(-(node.children.len() as i32));
|
outline.count(-(node.children.len() as i32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user