Fixed, Visual mode: in some cases mouse cursor movement was not clipped to the render area when focusing the editor after Alt-Tabbing from the Visual mode.

Addressed, Line drawing: in some cases extra vertices were created when drawing lines on top of nearly parallel non-cardinal lines.
This commit is contained in:
MaxED 2016-09-06 19:14:49 +00:00
parent 6faa88f981
commit 8333cab783
3 changed files with 30 additions and 3 deletions

View file

@ -57,6 +57,9 @@ namespace CodeImp.DoomBuilder.Geometry
#endregion
#region ================== Constants
//mxd
private const float MINIMUM_INTERSECTION_DISTANCE = 0.25f;
#endregion
@ -979,7 +982,20 @@ namespace CodeImp.DoomBuilder.Geometry
if(side.Line.Line.GetIntersection(measureline, out u))
{
if(float.IsNaN(u) || (u <= 0.0f) || (u >= 1.0f)) continue;
intersections.Add(u);
//mxd. Skip intersection if both start and end of one line are closer than given distance from the other line.
// This allows to avoid creating "unexpected" splits when drawing on top of non-cardinal lines.
//mxd. Check if both ends of measureline are too close to side.Line.Line
bool valid = (side.Line.Line.GetDistanceToLineSq(measureline.v1, true) > MINIMUM_INTERSECTION_DISTANCE ||
side.Line.Line.GetDistanceToLineSq(measureline.v2, true) > MINIMUM_INTERSECTION_DISTANCE);
//mxd. Check if both ends of side.Line.Line are too close to measureline
valid = (valid && (measureline.GetDistanceToLineSq(side.Line.Line.v1, true) > MINIMUM_INTERSECTION_DISTANCE ||
measureline.GetDistanceToLineSq(side.Line.Line.v2, true) > MINIMUM_INTERSECTION_DISTANCE));
// Store inersection
if(valid) intersections.Add(u);
}
processed.Add(side.Line);

View file

@ -276,6 +276,7 @@ namespace CodeImp.DoomBuilder.Windows
toolbarContextMenu.KeyDown += toolbarContextMenu_KeyDown;
toolbarContextMenu.KeyUp += toolbarContextMenu_KeyUp;
linedefcolorpresets.DropDown.MouseLeave += linedefcolorpresets_MouseLeave;
this.MouseCaptureChanged += MainForm_MouseCaptureChanged;
// Apply shortcut keys
ApplyShortcutKeys();
@ -649,6 +650,14 @@ namespace CodeImp.DoomBuilder.Windows
BreakExclusiveMouseInput();
ReleaseAllKeys();
}
//mxd. Looks like in some cases StartMouseExclusive is called before app aquires the mouse
// which results in setting Cursor.Clip not taking effect.
private void MainForm_MouseCaptureChanged(object sender, EventArgs e)
{
if(mouseexclusive && windowactive && mouseinside && Cursor.Clip != display.RectangleToScreen(display.ClientRectangle))
Cursor.Clip = display.RectangleToScreen(display.ClientRectangle);
}
// Window is moved
private void MainForm_Move(object sender, EventArgs e)
@ -1219,7 +1228,9 @@ namespace CodeImp.DoomBuilder.Windows
private void display_MouseEnter(object sender, EventArgs e)
{
mouseinside = true;
if((General.Map != null) && (mouseinput == null) && (General.Editing.Mode != null))
//mxd. Skip when in mouseexclusive (e.g. Visual) mode to avoid mouse disappearing when moving it
// on top of inactive editor window while Visual mode is active
if((General.Map != null) && (mouseinput == null) && (General.Editing.Mode != null) && !mouseexclusive)
{
General.Plugins.OnEditMouseEnter(e);
General.Editing.Mode.OnMouseEnter(e);

View file

@ -491,7 +491,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd
public override void OnResetLocalTextureOffset()
{
if(!General.Map.UDMF)
if(!General.Map.UDMF || !General.Map.Config.UseLocalSidedefTextureOffsets)
{
OnResetTextureOffset();
return;