From 63b424afcb948e9eb72559f6c8f1e6e19a48abf6 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Mon, 12 Jul 2021 14:35:37 -0400 Subject: [PATCH] Fix RackWidget::requestModulePos() after Rect::intersects() was made inclusive. --- src/app/RackWidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index 4415dbd7..01be52e1 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -437,7 +437,8 @@ void RackWidget::removeModule(ModuleWidget* m) { bool RackWidget::requestModulePos(ModuleWidget* mw, math::Vec pos) { // Check intersection with other modules math::Rect mwBox = math::Rect(pos, mw->box.size); - mwBox.size.x -= 0.01; + // Since `Rect::intersects()` is inclusive, subtract an infinitesimal from the size. + mwBox.size = mwBox.size.minus(math::Vec(0.01, 0.01)); for (widget::Widget* w2 : moduleContainer->children) { // Don't intersect with self if (mw == w2) @@ -447,7 +448,7 @@ bool RackWidget::requestModulePos(ModuleWidget* mw, math::Vec pos) { continue; // Check intersection math::Rect w2Box = w2->box; - w2Box.size.x -= 0.01; + w2Box.size = w2Box.size.minus(math::Vec(0.01, 0.01)); if (mwBox.intersects(w2Box)) return false; }