diff --git a/crates/engine/src/tools.rs b/crates/engine/src/tools.rs index 78c6ed35..19440fb3 100644 --- a/crates/engine/src/tools.rs +++ b/crates/engine/src/tools.rs @@ -149,9 +149,9 @@ enum Drag { enter_text: Option<(ShapeId, Point)>, }, Resize { - id: ShapeId, + ids: Vec, handle: u8, - orig: Xfrm, + origs: Vec<(ShapeId, Xfrm)>, start: Point, }, LineEnd { diff --git a/crates/engine/src/tools/drag.rs b/crates/engine/src/tools/drag.rs index 21aac4f3..5660a09a 100644 --- a/crates/engine/src/tools/drag.rs +++ b/crates/engine/src/tools/drag.rs @@ -26,10 +26,14 @@ impl Session { Drag::Move { ids, start, origs, moved, duplicate, enter_text } => { return self.drag_move(MoveDrag { ids, start, origs, moved, duplicate, enter_text }, p, mods, tol); } - Drag::Resize { id, handle, orig, start } => { - let nx = resize_box(&orig, handle, p - start, mods.shift || self.is_picture(id), mods.alt); - let nx = self.snap_resize(nx, &orig, handle, id, tol); - self.set_xfrm(id, nx)?; + Drag::Resize { ids, handle, origs, start } => { + if ids.len() >= 1 { + for (id, o) in &origs { + let nx = resize_box(&o, handle, p - start, mods.shift || self.is_picture(*id), mods.alt); + let nx = self.snap_resize(nx, &o, handle, *id, tol); + self.set_xfrm(*id, nx)?; + } + } } Drag::LineEnd { id, end, orig } => { let a = orig.affine(); diff --git a/crates/engine/src/tools/pointer.rs b/crates/engine/src/tools/pointer.rs index bee8f320..0a399970 100644 --- a/crates/engine/src/tools/pointer.rs +++ b/crates/engine/src/tools/pointer.rs @@ -302,9 +302,10 @@ impl Session { Some(Hit::TableColumn { id, col }) => self.begin_table_border(id, true, col, p)?, Some(Hit::TableRow { id, row }) => self.begin_table_border(id, false, row, p)?, Some(Hit::Resize { id, handle }) => { - let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); + let ids: Vec = if st.selection.shapes.contains(&id) { st.selection.shapes.clone() } else { vec![id] }; + let origs: Vec<(ShapeId, Xfrm)> = ids.iter().filter_map(|i| st.shape(*i).map(|s| (*i, xfrm_of(&st.doc, &st.selection, s)))).collect(); self.begin("Size"); - self.tool.drag = Some(Drag::Resize { id, handle, orig, start: p }); + self.tool.drag = Some(Drag::Resize { ids, handle, origs, start: p }); } Some(Hit::LineEnd { id, end }) => { let orig = st.shape(id).map(|s| xfrm_of(&st.doc, &st.selection, s)).unwrap_or_default(); @@ -559,10 +560,12 @@ impl Session { out = self.add_ink(points)?; } } - Some(Drag::Resize { id, .. }) => { + Some(Drag::Resize { ids, .. }) => { self.commit(); - let _ = cmd::text::fit_text_box(self, id); - self.refit_after_resize(id)?; + for id in ids { + let _ = cmd::text::fit_text_box(self, id); + self.refit_after_resize(id)?; + } } Some(Drag::TextSelect { before, .. }) => { out = self.paint_if_selection_changed(before, out)?;