mirror of
https://github.com/Stone-Red-Code/StoneRed.LogicSimulator.git
synced 2026-09-04 00:56:23 +02:00
Fix placement of gates when pressing shift
This commit is contained in:
@@ -227,7 +227,12 @@ internal class WorldScreen : SrlsScreen<Grid>
|
|||||||
|
|
||||||
if (selectedLogicGate is not null)
|
if (selectedLogicGate is not null)
|
||||||
{
|
{
|
||||||
if (mouseState.IsButtonDown(MouseButton.Left) && !mouseOverGate && !srls.Desktop.IsMouseOverGUI)
|
Vector2 position = camera.ScreenToWorld(mouseState.Position.ToVector2());
|
||||||
|
position = new Vector2(position.X - RealMod(position.X, 100 * srls.Scale), position.Y - RealMod(position.Y, 100 * srls.Scale));
|
||||||
|
|
||||||
|
selectedLogicGate.WorldData.Position = position;
|
||||||
|
|
||||||
|
if (mouseState.WasButtonJustDown(MouseButton.Left) && !mouseOverGate && !srls.Desktop.IsMouseOverGUI)
|
||||||
{
|
{
|
||||||
selectedLogicGate.WorldData.Position /= srls.Scale;
|
selectedLogicGate.WorldData.Position /= srls.Scale;
|
||||||
simulator.AddLogicGate(selectedLogicGate);
|
simulator.AddLogicGate(selectedLogicGate);
|
||||||
@@ -241,13 +246,6 @@ internal class WorldScreen : SrlsScreen<Grid>
|
|||||||
UnSelectLogicGate();
|
UnSelectLogicGate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Vector2 position = camera.ScreenToWorld(mouseState.Position.ToVector2());
|
|
||||||
position = new Vector2(position.X - RealMod(position.X, 100 * srls.Scale), position.Y - RealMod(position.Y, 100 * srls.Scale));
|
|
||||||
|
|
||||||
selectedLogicGate.WorldData.Position = position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyboardState.IsKeyDown(Keys.C))
|
if (keyboardState.IsKeyDown(Keys.C))
|
||||||
|
|||||||
Reference in New Issue
Block a user