Skip locatables

This commit is contained in:
Laurenz 2025-07-16 15:17:41 +02:00
parent 70386c10f7
commit 34116cddf6

View File

@ -10,7 +10,7 @@ use typst_utils::NonZeroExt;
use crate::diag::{bail, StrResult}; use crate::diag::{bail, StrResult};
use crate::foundations::{Content, Label, Repr, Selector}; use crate::foundations::{Content, Label, Repr, Selector};
use crate::introspection::{Location, Tag}; use crate::introspection::{Locatable, Location, Tag};
use crate::layout::{Frame, FrameItem, Point, Position, Transform}; use crate::layout::{Frame, FrameItem, Point, Position, Transform};
use crate::model::Numbering; use crate::model::Numbering;
@ -422,9 +422,11 @@ impl IntrospectorBuilder {
) { ) {
match tag { match tag {
Tag::Start(elem) => { Tag::Start(elem) => {
let loc = elem.location().unwrap(); if elem.can::<dyn Locatable>() {
if self.seen.insert(loc) { let loc = elem.location().unwrap();
sink.push((elem.clone(), position)); if self.seen.insert(loc) {
sink.push((elem.clone(), position));
}
} }
} }
Tag::End(loc, key) => { Tag::End(loc, key) => {