Skip to content

Commit

Permalink
Editor: when changing room background size, reset the Edges too
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Feb 8, 2025
1 parent 81aa959 commit e644e19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Editor/AGS.Editor/Panes/Room/RoomSettingsEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ private void ImportBackground(int bgIndex)
}
if (doImport)
{
if (Factory.GUIController.ShowQuestion("The new background is a different size to the old one. If you import it, all your regions, hotspots and walkable areas will be cleared. Do you want to proceed?") != DialogResult.Yes)
if (Factory.GUIController.ShowQuestion("The new background is a different size to the old one. If you import it, all your regions, hotspots and walkable areas will be cleared, and edges reset to defaults. Do you want to proceed?") != DialogResult.Yes)
{
doImport = false;
}
Expand Down Expand Up @@ -629,11 +629,11 @@ private void ImportBackground(int bgIndex)

private void OnRoomSizeChanged()
{
// Clamp room edges to the new size
_room.LeftEdgeX = MathExtra.Clamp(_room.LeftEdgeX, 0, _room.Width - 2);
_room.RightEdgeX = MathExtra.Clamp(_room.RightEdgeX, _room.LeftEdgeX + 1, _room.Width - 1);
_room.TopEdgeY = MathExtra.Clamp(_room.TopEdgeY, 0, _room.Height - 2);
_room.BottomEdgeY = MathExtra.Clamp(_room.BottomEdgeY, _room.TopEdgeY + 1, _room.Height - 1);
// Reset room edges to the defaults at the new size
_room.LeftEdgeX = 0;
_room.RightEdgeX = _room.Width - 1;
_room.TopEdgeY = 0;
_room.BottomEdgeY = _room.Height - 1;
}

private void btnChangeImage_Click(object sender, EventArgs e)
Expand Down

0 comments on commit e644e19

Please sign in to comment.