diff --git a/output/src/direction.rs b/output/src/direction.rs index 7705af3d..3f6f5dce 100644 --- a/output/src/direction.rs +++ b/output/src/direction.rs @@ -61,11 +61,10 @@ pub trait BspAreas, B: Content> { }).xywh(); match direction { Above | Below => { - let x = ax.min(bx); - let w = (ax+aw).max(bx+bw).minus(x); - let y = ay.min(by); - let h = (ay+ah).max(by+bh).minus(y); - [[ax, ay, aw, ah].into(), [bx, by, bw, bh].into(), [x, y, w, h].into()] + let [x, y, w, h] = outer.center_xy([aw.max(bw), ah.max(bh)]); + let a = [(x + w/2.into()).minus(aw/2.into()), (y + h/2.into()).minus(ah/2.into()), aw, ah]; + let b = [(x + w/2.into()).minus(bw/2.into()), (y + h/2.into()).minus(bh/2.into()), bw, bh]; + [a.into(), b.into(), [x, y, w, h].into()] }, South => { let [x, y, w, h] = outer.center_xy([aw.max(bw), ah + bh]);