From 330223335d7bc0858cf8b4b0861651bc4a768cb1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 3 Apr 2021 11:45:14 +0100 Subject: [PATCH] organise: Swap piece and bbox This will make the sort work nicely. Signed-off-by: Ian Jackson --- src/organise.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/organise.rs b/src/organise.rs index 91af5b6f..23ddbf07 100644 --- a/src/organise.rs +++ b/src/organise.rs @@ -82,7 +82,7 @@ impl Attempt { #[throws(InternalError)] fn try_layout(region: &Rect, - pieces: &IndexVec, + pieces: &IndexVec, att: Attempt) -> Option> { let mut out = default(); @@ -96,7 +96,7 @@ fn try_layout(region: &Rect, // Everything below n_y is overwriteable // Everything below and to the right of cur is overwriteable - for (piece, bbox) in pieces { + for (bbox, piece) in pieces { let place = 'placed: loop { for xi in 0..3 { let place = (cur - att.tl(&bbox)?)?; @@ -166,7 +166,7 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, opname: &str, if let Some(bbox) = want!( Ok = ipc.show(vis).bbox_approx(), ?piece ); then { Some(( - (piece, bbox), + (bbox, piece), gpc.zlevel.clone()) ) } @@ -175,7 +175,7 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, opname: &str, } }).unzip::< _,_, - IndexVec, + IndexVec, IndexVec, >(); @@ -207,7 +207,7 @@ pub fn ui_operation(a: &mut ApiPieceOpArgs<'_>, opname: &str, let updates = { let mut updates = Vec::with_capacity(pieces.len()); - for ((piece, _bbox), pos, zlevel) in izip!(pieces, layout, zlevels) { + for ((_bbox, piece), pos, zlevel) in izip!(pieces, layout, zlevels) { want_let!{ Some(gpc) = gs.pieces.get_mut(piece); else continue; } gpc.pos = pos; gpc.zlevel = zlevel; -- 2.30.2