fix(render): a loose list holding block references gets the index

This commit is contained in:
Dylan M. Taylor
2026-11-11 22:31:04 +00:00
parent 95d5dcceb0
commit a8a1ecd60b
+7 -2
View File
@@ -222,7 +222,8 @@ pub(crate) fn with_point_view(d: &Drawing, space: &Space, opts: &Options) -> Opt
o
}
/// Loose entity lists shorter than this look layers up by scanning them rather than building an index.
/// Loose entity lists shorter than this, with no block reference (whose contents expand to many
/// objects), look layers up by scanning rather than building an index.
const SMALL_LIST: usize = 64;
/// Build the display list for a set of loose entities (previews, rubber bands).
@@ -236,7 +237,11 @@ pub fn build_entities<'a, I: IntoIterator<Item = &'a Entity>>(d: &Drawing, ents:
} else {
opts
};
let layers = if ents.len() < SMALL_LIST { LayerIndex::linear() } else { LayerIndex::new(d) };
let layers = if ents.len() < SMALL_LIST && !ents.iter().any(|e| matches!(e.kind, EntityKind::Insert(_))) {
LayerIndex::linear()
} else {
LayerIndex::new(d)
};
let mut b = Builder {
list: DisplayList::default(),
opts,