mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
moo
This commit is contained in:
parent
dcda9cdab3
commit
15693e1ca8
1 changed files with 15 additions and 16 deletions
|
@ -76,7 +76,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
private const float GRIP_SIZE = 9.0f;
|
private const float GRIP_SIZE = 9.0f;
|
||||||
private const float ZERO_SIZE_ADDITION = 20.0f;
|
private const float ZERO_SIZE_ADDITION = 20.0f;
|
||||||
private const byte RECTANGLE_ALPHA = 60;
|
private const byte RECTANGLE_ALPHA = 60;
|
||||||
private const byte EXTENSION_LINE_ALPHA = 200;
|
private const byte EXTENSION_LINE_ALPHA = 150;
|
||||||
private readonly Cursor[] RESIZE_CURSORS = { Cursors.SizeNS, Cursors.SizeNWSE, Cursors.SizeWE, Cursors.SizeNESW };
|
private readonly Cursor[] RESIZE_CURSORS = { Cursors.SizeNS, Cursors.SizeNWSE, Cursors.SizeWE, Cursors.SizeNESW };
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -342,7 +342,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(snaptonearest)
|
if(snaptonearest)
|
||||||
{
|
{
|
||||||
float vrange = VerticesMode.VERTEX_HIGHLIGHT_RANGE / renderer.Scale;
|
float vrange = VerticesMode.VERTEX_HIGHLIGHT_RANGE / renderer.Scale;
|
||||||
|
|
||||||
// Try the nearest vertex
|
// Try the nearest vertex
|
||||||
Vertex nv = MapSet.NearestVertexSquareRange(unselectedvertices, snappedmappos, vrange);
|
Vertex nv = MapSet.NearestVertexSquareRange(unselectedvertices, snappedmappos, vrange);
|
||||||
if(nv != null)
|
if(nv != null)
|
||||||
|
@ -351,34 +351,33 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
dosnaptogrid = false;
|
dosnaptogrid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snap to grid?
|
// Snap to grid?
|
||||||
if(dosnaptogrid)
|
if(dosnaptogrid)
|
||||||
{
|
{
|
||||||
// Aligned to grid
|
// Aligned to grid
|
||||||
snappedmappos = General.Map.Grid.SnappedToGrid(snappedmappos);
|
snappedmappos = General.Map.Grid.SnappedToGrid(snappedmappos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep corner position
|
// Keep corner position
|
||||||
Vector2D oldcorner = corners[stickcorner];
|
Vector2D oldcorner = corners[stickcorner];
|
||||||
|
|
||||||
// Change size with the scale from the ruler
|
// Change size with the scale from the ruler
|
||||||
float scale = resizeaxis.GetNearestOnLine(snappedmappos);
|
float scale = resizeaxis.GetNearestOnLine(snappedmappos);
|
||||||
size = (basesize * resizefilter) * scale + size * (1.0f - resizefilter);
|
size = (basesize * resizefilter) * scale + size * (1.0f - resizefilter);
|
||||||
|
|
||||||
// Adjust corner position
|
// Adjust corner position
|
||||||
Vector2D newcorner = TransformedPoint(originalcorners[stickcorner]);
|
Vector2D newcorner = TransformedPoint(originalcorners[stickcorner]);
|
||||||
offset -= newcorner - oldcorner;
|
offset -= newcorner - oldcorner;
|
||||||
|
|
||||||
// Snappedmappos is outside the edgevector of our rectangle?
|
// Show the extension line so that the user knows what it is aligning to
|
||||||
// Then show the extension line so that the user knows what it is aligning to
|
|
||||||
Vector2D sizefiltered = (size * resizefilter);
|
Vector2D sizefiltered = (size * resizefilter);
|
||||||
float sizelength = sizefiltered.x + sizefiltered.y;
|
float sizelength = sizefiltered.x + sizefiltered.y;
|
||||||
Line2D edgeline = new Line2D(resizeaxis.v1 + resizevector * sizelength, resizeaxis.v1 + resizevector * sizelength - edgevector);
|
Line2D edgeline = new Line2D(resizeaxis.v1 + resizevector * sizelength, resizeaxis.v1 + resizevector * sizelength - edgevector);
|
||||||
float nearestonedge = edgeline.GetNearestOnLine(snappedmappos);
|
float nearestonedge = edgeline.GetNearestOnLine(snappedmappos);
|
||||||
if(nearestonedge > 0.5f)
|
if(nearestonedge > 0.5f)
|
||||||
extensionline = new Line2D(edgeline.v1, snappedmappos);
|
extensionline = new Line2D(edgeline.v1, snappedmappos);
|
||||||
else if(nearestonedge < 0.5f)
|
else
|
||||||
extensionline = new Line2D(edgeline.v2, snappedmappos);
|
extensionline = new Line2D(edgeline.v2, snappedmappos);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
@ -394,7 +393,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
Vector2D center = offset + size * 0.5f;
|
Vector2D center = offset + size * 0.5f;
|
||||||
Vector2D delta = snappedmappos - center;
|
Vector2D delta = snappedmappos - center;
|
||||||
rotation = delta.GetAngle() - rotategripangle;
|
rotation = delta.GetAngle() - rotategripangle;
|
||||||
|
|
||||||
// Snap rotation to grip?
|
// Snap rotation to grip?
|
||||||
if(dosnaptogrid)
|
if(dosnaptogrid)
|
||||||
{
|
{
|
||||||
|
@ -580,7 +579,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Events
|
#region ================== Events
|
||||||
|
|
||||||
// Mode engages
|
// Mode engages
|
||||||
public override void OnEngage()
|
public override void OnEngage()
|
||||||
{
|
{
|
||||||
|
@ -906,11 +905,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
renderer.RenderLine(corners[1], corners[2], 4, rectcolor, true);
|
renderer.RenderLine(corners[1], corners[2], 4, rectcolor, true);
|
||||||
renderer.RenderLine(corners[2], corners[3], 4, rectcolor, true);
|
renderer.RenderLine(corners[2], corners[3], 4, rectcolor, true);
|
||||||
renderer.RenderLine(corners[3], corners[0], 4, rectcolor, true);
|
renderer.RenderLine(corners[3], corners[0], 4, rectcolor, true);
|
||||||
|
|
||||||
// Extension line
|
// Extension line
|
||||||
if(extensionline.GetLengthSq() > 0.0f)
|
if(extensionline.GetLengthSq() > 0.0f)
|
||||||
renderer.RenderLine(extensionline.v1, extensionline.v2, 1, General.Colors.Indication.WithAlpha(EXTENSION_LINE_ALPHA), true);
|
renderer.RenderLine(extensionline.v1, extensionline.v2, 1, General.Colors.Indication.WithAlpha(EXTENSION_LINE_ALPHA), true);
|
||||||
|
|
||||||
// Grips
|
// Grips
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -1096,13 +1095,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
protected override void OnEndSelect()
|
protected override void OnEndSelect()
|
||||||
{
|
{
|
||||||
base.OnEndSelect();
|
base.OnEndSelect();
|
||||||
|
|
||||||
// Remove extension line
|
// Remove extension line
|
||||||
extensionline = new Line2D();
|
extensionline = new Line2D();
|
||||||
|
|
||||||
// No modifying mode
|
// No modifying mode
|
||||||
mode = ModifyMode.None;
|
mode = ModifyMode.None;
|
||||||
|
|
||||||
// Redraw
|
// Redraw
|
||||||
General.Interface.RedrawDisplay();
|
General.Interface.RedrawDisplay();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue