mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 05:30:23 +02:00
Fix tools drawing rectangles with tools not doing anything in some cases
Namely, when those rectangles are not drawn in a top left to bottom right corner order. Broken by a26544ba95
, which neglected to port the rectangle normalization logic from Simulation::ToolBox.
This commit is contained in:
@@ -87,7 +87,9 @@ static void defaultPerformDrawRect(SimTool *tool, Simulation *sim, const Brush &
|
||||
{
|
||||
int brushX = ((position1.X + position2.X) / 2);
|
||||
int brushY = ((position1.Y + position2.Y) / 2);
|
||||
for (auto p : RectBetween(position1, position2))
|
||||
auto tl = ui::Point{ std::min(position1.X, position2.X), std::min(position1.Y, position2.Y) };
|
||||
auto br = ui::Point{ std::max(position1.X, position2.X), std::max(position1.Y, position2.Y) };
|
||||
for (auto p : RectBetween(tl, br))
|
||||
{
|
||||
tool->CallPerform(sim, p, { brushX, brushY });
|
||||
}
|
||||
|
Reference in New Issue
Block a user