|
@@ -437,7 +437,8 @@ void RackWidget::removeModule(ModuleWidget* m) { |
|
|
bool RackWidget::requestModulePos(ModuleWidget* mw, math::Vec pos) { |
|
|
bool RackWidget::requestModulePos(ModuleWidget* mw, math::Vec pos) { |
|
|
// Check intersection with other modules |
|
|
// Check intersection with other modules |
|
|
math::Rect mwBox = math::Rect(pos, mw->box.size); |
|
|
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) { |
|
|
for (widget::Widget* w2 : moduleContainer->children) { |
|
|
// Don't intersect with self |
|
|
// Don't intersect with self |
|
|
if (mw == w2) |
|
|
if (mw == w2) |
|
@@ -447,7 +448,7 @@ bool RackWidget::requestModulePos(ModuleWidget* mw, math::Vec pos) { |
|
|
continue; |
|
|
continue; |
|
|
// Check intersection |
|
|
// Check intersection |
|
|
math::Rect w2Box = w2->box; |
|
|
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)) |
|
|
if (mwBox.intersects(w2Box)) |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|