fix(geometry/with_rtree): Do not remove only-modified dots when applying edit

This fixes a panic when undoing some bands.

180952c94f1c7c56c2ce5d2bdd3ab672aa0ccfec did not fix this problem
because we did not stop removing modified dots.
This commit is contained in:
Mikolaj Wielgus 2025-07-17 12:39:19 +02:00
parent d6a82d5264
commit 2f4dac223c
1 changed files with 6 additions and 1 deletions

View File

@ -563,7 +563,12 @@ impl<
for (dot, (maybe_old_data, maybe_new_data)) in &edit.dots { for (dot, (maybe_old_data, maybe_new_data)) in &edit.dots {
if let (Some(_), Some(weight)) = (maybe_old_data, maybe_new_data) { if let (Some(_), Some(weight)) = (maybe_old_data, maybe_new_data) {
self.modify_dot(*dot, |geometry, dot| { self.modify_dot(*dot, |geometry, dot| {
geometry.remove_primitive(dot.into()); // Note that we do not remove the dot. This is because doing
// so removes its edges, which we would have to restore
// afterwards. So it's easier to only update the weight.
// Despite this method's name, it actually does not add the
// dot, it updates it.
geometry geometry
.add_dot_at_index(GenericIndex::<DW>::new(dot.petgraph_index()), *weight); .add_dot_at_index(GenericIndex::<DW>::new(dot.petgraph_index()), *weight);
}) })