Don't allow a Thing's Z position to be scrolled out of bounds in Visual Mode.

This commit is contained in:
MascaraSnake 2016-01-03 00:26:06 +01:00
parent e773c543e5
commit 3e7202000e

View file

@ -772,7 +772,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket)) if((General.Map.UndoRedo.NextUndo == null) || (General.Map.UndoRedo.NextUndo.TicketID != undoticket))
undoticket = mode.CreateUndo("Change thing height"); undoticket = mode.CreateUndo("Change thing height");
Thing.Move(Thing.Position + new Vector3D(0.0f, 0.0f, (info.Hangs ? -amount : amount))); Vector3D newPosition = Thing.Position + new Vector3D(0.0f, 0.0f, (info.Hangs ? -amount : amount));
newPosition.z = General.Clamp(newPosition.z, General.Map.FormatInterface.MinThingHeight, General.Map.FormatInterface.MaxThingHeight);
Thing.Move(newPosition);
mode.SetActionResult("Changed thing height to " + Thing.Position.z + "."); mode.SetActionResult("Changed thing height to " + Thing.Position.z + ".");