mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
- Insert action in Vertices, Lines and Sectors mode now inserts a vertex that also snaps to geometry and grid, when preferred
- Undo now works for insertactions
This commit is contained in:
parent
88124438aa
commit
9854653465
4 changed files with 7 additions and 51 deletions
|
@ -523,30 +523,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// This creates a new vertex at the mouse position
|
||||
[BeginAction("insertitem", BaseAction = true)]
|
||||
public virtual void InsertVertex()
|
||||
{
|
||||
// Mouse in window?
|
||||
if(mouseinside)
|
||||
{
|
||||
// Create vertex at mouse position
|
||||
Vertex v = General.Map.Map.CreateVertex(mousemappos);
|
||||
|
||||
// Snap to grid enabled?
|
||||
if(General.Interface.SnapToGrid)
|
||||
{
|
||||
// Snap to grid
|
||||
v.SnapToGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Snap to map format accuracy
|
||||
v.SnapToAccuracy();
|
||||
}
|
||||
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
public virtual void InsertVertexAction() { VerticesMode.InsertVertex(mousemappos, renderer.Scale); }
|
||||
|
||||
[BeginAction("deleteitem", BaseAction = true)]
|
||||
public void DeleteItem()
|
||||
|
|
|
@ -675,30 +675,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// This creates a new vertex at the mouse position
|
||||
[BeginAction("insertitem", BaseAction = true)]
|
||||
public virtual void InsertVertex()
|
||||
{
|
||||
// Mouse in window?
|
||||
if(mouseinside)
|
||||
{
|
||||
// Create vertex at mouse position
|
||||
Vertex v = General.Map.Map.CreateVertex(mousemappos);
|
||||
|
||||
// Snap to grid enabled?
|
||||
if(General.Interface.SnapToGrid)
|
||||
{
|
||||
// Snap to grid
|
||||
v.SnapToGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Snap to map format accuracy
|
||||
v.SnapToAccuracy();
|
||||
}
|
||||
|
||||
// Redraw screen
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
}
|
||||
public virtual void InsertVertexAction() { VerticesMode.InsertVertex(mousemappos, renderer.Scale); }
|
||||
|
||||
[BeginAction("makedoor")]
|
||||
public void MakeDoor()
|
||||
|
|
|
@ -510,6 +510,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(mouseinside)
|
||||
{
|
||||
// Insert new thing
|
||||
General.Map.UndoRedo.CreateUndo("Insert thing");
|
||||
InsertThing(mousemappos);
|
||||
|
||||
// Redraw screen
|
||||
|
|
|
@ -446,13 +446,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// This creates a new vertex at the mouse position
|
||||
[BeginAction("insertitem", BaseAction = true)]
|
||||
public virtual void InsertVertex()
|
||||
public virtual void InsertVertexAction() { VerticesMode.InsertVertex(mousemappos, renderer.Scale); }
|
||||
public static void InsertVertex(Vector2D mousemappos, float rendererscale)
|
||||
{
|
||||
bool snaptogrid = General.Interface.ShiftState ^ General.Interface.SnapToGrid;
|
||||
bool snaptonearest = General.Interface.CtrlState ^ General.Interface.AutoMerge;
|
||||
|
||||
// Mouse in window?
|
||||
if(mouseinside)
|
||||
if(General.Interface.MouseInDisplay)
|
||||
{
|
||||
Vector2D insertpos;
|
||||
Linedef l = null;
|
||||
|
@ -461,7 +462,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.UndoRedo.CreateUndo("Insert vertex");
|
||||
|
||||
// Snap to geometry?
|
||||
l = General.Map.Map.NearestLinedefRange(mousemappos, LINEDEF_SPLIT_RANGE / renderer.Scale);
|
||||
l = General.Map.Map.NearestLinedefRange(mousemappos, LINEDEF_SPLIT_RANGE / rendererscale);
|
||||
if(snaptonearest && (l != null))
|
||||
{
|
||||
// Snip to grid also?
|
||||
|
|
Loading…
Reference in a new issue