mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-22 15:41:57 +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 a26544ba955f, which neglected to port the rectangle normalization logic from Simulation::ToolBox.
This commit is contained in:
parent
0c048a9d6e
commit
2cc5d9bbbb
@ -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 });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user