Fixed, Classic modes: Alt-dragging map elements (e.g. "snap to grid increment while dragging" mode) was not working properly.

This commit is contained in:
MaxED 2014-09-30 19:46:33 +00:00
parent b95a059e26
commit fa1a1d42f6
2 changed files with 6 additions and 6 deletions

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
dragitem = MapSet.NearestVertex(selectedverts, dragstartmappos); dragitem = MapSet.NearestVertex(selectedverts, dragstartmappos);
//mxd. Get drag offset //mxd. Get drag offset
dragstartoffset = dragitem.Position - General.Map.Grid.SnappedToGrid(dragitem.Position); dragstartoffset = General.Map.Grid.SnappedToGrid(dragitem.Position) - dragitem.Position;
// Lines to snap to // Lines to snap to
snaptolines = General.Map.Map.LinedefsFromMarkedVertices(true, false, false); snaptolines = General.Map.Map.LinedefsFromMarkedVertices(true, false, false);
@ -316,7 +316,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Snap item to grid increment // Snap item to grid increment
if(snapgridincrement) //mxd if(snapgridincrement) //mxd
{ {
dragitem.Move(General.Map.Grid.SnappedToGrid(dragitem.Position + dragstartoffset) - dragstartoffset); dragitem.Move(General.Map.Grid.SnappedToGrid(dragitem.Position) - dragstartoffset);
} }
else // Or to the grid itself else // Or to the grid itself
{ {

View file

@ -140,7 +140,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
dragitemposition = dragitem.Position; dragitemposition = dragitem.Position;
//mxd. Get drag offset //mxd. Get drag offset
dragstartoffset = dragitemposition - General.Map.Grid.SnappedToGrid(dragitem.Position); dragstartoffset = General.Map.Grid.SnappedToGrid(dragitem.Position) - dragitemposition;
// Keep view information // Keep view information
lastoffsetx = renderer.OffsetX; lastoffsetx = renderer.OffsetX;
@ -216,10 +216,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Move the dragged item // Move the dragged item
dragitem.Move(dragitemposition + offset); dragitem.Move(dragitemposition + offset);
// Snap item to grid increment // Snap item to grid increment (mxd)
if(snapgridincrement) //mxd if(snapgridincrement)
{ {
dragitem.Move(General.Map.Grid.SnappedToGrid(dragitemposition + offset + dragstartoffset) - dragstartoffset); dragitem.Move(General.Map.Grid.SnappedToGrid(dragitemposition + offset) - dragstartoffset);
} }
else // Or to the grid itself else // Or to the grid itself
{ {