commit
7e26026f9c
34 changed files with 238 additions and 160 deletions
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using ClipperLib;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
|
|
@ -157,14 +158,15 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
this.Children.Add(child);
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
using (new CenterAndHeightMaintainer(this))
|
||||
{
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
list.Clear();
|
||||
});
|
||||
{
|
||||
list.Clear();
|
||||
});
|
||||
|
||||
var brailleLetter = new BrailleObject3D()
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
var scaleRatio = Math.Max(letterObject.XSize() / 17, letterObject.ZSize() / 17);
|
||||
if (scaleRatio > 1)
|
||||
{
|
||||
letterObject = new ScaleObject3D(letterObject, 1.0/scaleRatio, 1, 1.0/scaleRatio);
|
||||
letterObject = new ScaleObject3D(letterObject, 1.0 / scaleRatio, 1, 1.0 / scaleRatio);
|
||||
}
|
||||
letterObject = new AlignObject3D(letterObject, FaceAlign.Bottom | FaceAlign.Front, brailleLetter, FaceAlign.Top | FaceAlign.Front, 0, 0, 3.5);
|
||||
letterObject = new SetCenterObject3D(letterObject, brailleLetter.GetCenter(), true, false, false);
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
using (new CenterAndHeightMaintainer(this))
|
||||
{
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
list.Clear();
|
||||
});
|
||||
{
|
||||
list.Clear();
|
||||
});
|
||||
|
||||
var brailleText = TextToEncode;
|
||||
if (UseGrade2)
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@ namespace MatterHackers.MatterControl.Plugins.Lithophane
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var rebuildLocks = this.RebuilLockAll();
|
||||
|
||||
ApplicationController.Instance.Tasks.Execute("Generating Lithophane".Localize(), null, (reporter, cancellationToken) =>
|
||||
{
|
||||
var generatedMesh = Lithophane.Generate(
|
||||
|
|
@ -130,7 +132,11 @@ namespace MatterHackers.MatterControl.Plugins.Lithophane
|
|||
// Apply offset
|
||||
this.Matrix *= Matrix4X4.CreateTranslation(-this.ImageOffset);
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -95,8 +95,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
}
|
||||
});
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.EditableTypes;
|
||||
|
|
@ -87,8 +88,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
});
|
||||
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,8 +127,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
}
|
||||
});
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,14 +223,15 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
list.AddRange(curvedChildren);
|
||||
});
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -283,14 +283,15 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
list.AddRange(curvedChildren);
|
||||
});
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -163,14 +163,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using g3;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl;
|
||||
|
|
@ -138,14 +139,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -345,8 +345,12 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
this.Invalidate(InvalidateType.Properties);
|
||||
}
|
||||
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Path));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Path));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
|
|
@ -109,8 +110,12 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
this.Matrix = oldMatrix;
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,14 +181,15 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
Mesh = null;
|
||||
}
|
||||
|
||||
rebuildLock.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||
rebuildLock.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
// set the mesh to show the path
|
||||
this.Mesh = this.VertexSource.Extrude(Constants.PathPolygonsHeight);
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,8 +196,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
Mesh = mesh;
|
||||
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,8 +97,11 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
// set the mesh to show the path
|
||||
this.Mesh = this.VertexSource.Extrude(Constants.PathPolygonsHeight);
|
||||
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Path));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Path));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using g3;
|
||||
using gs;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
|
|
@ -100,14 +101,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
this.FinalVertices = finalVertices;
|
||||
|
||||
SourceContainer.Visible = false;
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
rebuildLocks.Dispose();
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -341,14 +341,16 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
list.AddRange(twistedChildren);
|
||||
});
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -246,8 +246,12 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
GenerateBase(polygonShape, firstChild.GetAxisAlignedBoundingBox().MinXYZ.Z);
|
||||
}
|
||||
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
|
|
@ -266,6 +265,10 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
if (PositionsHaveBeenSet)
|
||||
{
|
||||
CreateWidgetIfRequired(controlLayer);
|
||||
// always keep the displayed distance the actual world distance
|
||||
var worldStartPosition = LocalStartPosition.Transform(this.WorldMatrix());
|
||||
var worldEndPosition = LocalEndPosition.Transform(this.WorldMatrix());
|
||||
Distance = (worldStartPosition - worldEndPosition).Length;
|
||||
textWidget.Text = Distance.ToString("0.##");
|
||||
containerWidget.Position = center - new Vector2(containerWidget.LocalBounds.Width / 2, containerWidget.LocalBounds.Height / 2);
|
||||
containerWidget.Visible = true;
|
||||
|
|
|
|||
|
|
@ -136,48 +136,50 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
var rebuildLock = RebuildLock();
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
using (new CenterAndHeightMaintainer(this))
|
||||
{
|
||||
using (new CenterAndHeightMaintainer(this))
|
||||
if (string.IsNullOrWhiteSpace(NameToWrite))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(NameToWrite))
|
||||
{
|
||||
Mesh = PlatonicSolids.CreateCube(20, 10, Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mesh = null;
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
list.Clear();
|
||||
|
||||
var offest = 0.0;
|
||||
double pointsToMm = 0.352778;
|
||||
|
||||
foreach (var letter in this.NameToWrite.ToCharArray())
|
||||
{
|
||||
var letterPrinter = new TypeFacePrinter(letter.ToString(), new StyledTypeFace(ApplicationController.GetTypeFace(this.Font), this.PointSize))
|
||||
{
|
||||
ResolutionScale = 10
|
||||
};
|
||||
var scaledLetterPrinter = new VertexSourceApplyTransform(letterPrinter, Affine.NewScaling(pointsToMm));
|
||||
|
||||
list.Add(new Object3D()
|
||||
{
|
||||
Mesh = VertexSourceToMesh.Extrude(scaledLetterPrinter, this.Height),
|
||||
Matrix = Matrix4X4.CreateTranslation(offest, 0, 0),
|
||||
Name = letter.ToString()
|
||||
});
|
||||
|
||||
offest += letterPrinter.GetSize(letter.ToString()).X * pointsToMm;
|
||||
}
|
||||
});
|
||||
}
|
||||
Mesh = PlatonicSolids.CreateCube(20, 10, Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mesh = null;
|
||||
this.Children.Modify(list =>
|
||||
{
|
||||
list.Clear();
|
||||
|
||||
var offest = 0.0;
|
||||
double pointsToMm = 0.352778;
|
||||
|
||||
foreach (var letter in this.NameToWrite.ToCharArray())
|
||||
{
|
||||
var letterPrinter = new TypeFacePrinter(letter.ToString(), new StyledTypeFace(ApplicationController.GetTypeFace(this.Font), this.PointSize))
|
||||
{
|
||||
ResolutionScale = 10
|
||||
};
|
||||
var scaledLetterPrinter = new VertexSourceApplyTransform(letterPrinter, Affine.NewScaling(pointsToMm));
|
||||
|
||||
list.Add(new Object3D()
|
||||
{
|
||||
Mesh = VertexSourceToMesh.Extrude(scaledLetterPrinter, this.Height),
|
||||
Matrix = Matrix4X4.CreateTranslation(offest, 0, 0),
|
||||
Name = letter.ToString()
|
||||
});
|
||||
|
||||
offest += letterPrinter.GetSize(letter.ToString()).X * pointsToMm;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLock.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,7 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
|
|
@ -69,8 +70,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,8 +177,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,8 +188,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,8 +138,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
{
|
||||
}
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
// set the mesh to show the path
|
||||
this.Mesh = this.VertexSource.Extrude(Constants.PathPolygonsHeight);
|
||||
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
rebuildLocks.Dispose();
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Children));
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (MouseCaptured)
|
||||
{
|
||||
Vector2 currentMousePosition = GetMousePosition(mouseEvent);
|
||||
ZeroVelocity();
|
||||
|
||||
CalculateMouseDownPostionAndPlane(mouseEvent.Position);
|
||||
|
|
@ -140,18 +139,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
case TrackBallTransformType.Rotation:
|
||||
CurrentTrackingType = TrackBallTransformType.Rotation;
|
||||
StartRotateAroundOrigin(currentMousePosition);
|
||||
StartRotateAroundOrigin(mouseEvent.Position);
|
||||
break;
|
||||
|
||||
case TrackBallTransformType.Translation:
|
||||
CurrentTrackingType = TrackBallTransformType.Translation;
|
||||
mouseDownPosition = currentMousePosition;
|
||||
mouseDownPosition = mouseEvent.Position;
|
||||
break;
|
||||
|
||||
case TrackBallTransformType.Scale:
|
||||
CurrentTrackingType = TrackBallTransformType.Scale;
|
||||
mouseDownPosition = currentMousePosition;
|
||||
lastScaleMousePosition = currentMousePosition;
|
||||
mouseDownPosition = mouseEvent.Position;
|
||||
lastScaleMousePosition = mouseEvent.Position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +160,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (CurrentTrackingType == TrackBallTransformType.None)
|
||||
{
|
||||
CurrentTrackingType = TrackBallTransformType.Translation;
|
||||
mouseDownPosition = currentMousePosition;
|
||||
mouseDownPosition = mouseEvent.Position;
|
||||
}
|
||||
}
|
||||
else if (mouseEvent.Button == MouseButtons.Right)
|
||||
|
|
@ -169,7 +168,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
if (CurrentTrackingType == TrackBallTransformType.None)
|
||||
{
|
||||
CurrentTrackingType = TrackBallTransformType.Rotation;
|
||||
StartRotateAroundOrigin(currentMousePosition);
|
||||
StartRotateAroundOrigin(mouseEvent.Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -179,20 +178,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
base.OnMouseMove(mouseEvent);
|
||||
|
||||
Vector2 currentMousePosition = GetMousePosition(mouseEvent);
|
||||
|
||||
if (CurrentTrackingType == TrackBallTransformType.Rotation)
|
||||
{
|
||||
motionQueue.AddMoveToMotionQueue(currentMousePosition, UiThread.CurrentTimerMs);
|
||||
DoRotateAroundOrigin(currentMousePosition);
|
||||
motionQueue.AddMoveToMotionQueue(mouseEvent.Position, UiThread.CurrentTimerMs);
|
||||
DoRotateAroundOrigin(mouseEvent.Position);
|
||||
}
|
||||
else if (CurrentTrackingType == TrackBallTransformType.Translation)
|
||||
{
|
||||
Translate(currentMousePosition);
|
||||
Translate(mouseEvent.Position);
|
||||
}
|
||||
else if (CurrentTrackingType == TrackBallTransformType.Scale)
|
||||
{
|
||||
Vector2 mouseDelta = currentMousePosition - lastScaleMousePosition;
|
||||
Vector2 mouseDelta = mouseEvent.Position - lastScaleMousePosition;
|
||||
double zoomDelta = 1;
|
||||
if (mouseDelta.Y < 0)
|
||||
{
|
||||
|
|
@ -204,7 +201,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
|
||||
ZoomToWorldPosition(mouseDownWorldPosition, zoomDelta);
|
||||
lastScaleMousePosition = currentMousePosition;
|
||||
lastScaleMousePosition = mouseEvent.Position;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -311,6 +308,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ZeroVelocity();
|
||||
}
|
||||
|
||||
mouseDownPosition = mousePosition;
|
||||
|
||||
isRotating = true;
|
||||
|
||||
rotateVec = -mouseDownWorldPosition - bedCenter;
|
||||
|
|
@ -420,21 +419,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
}
|
||||
|
||||
private Vector2 GetMousePosition(MouseEventArgs mouseEvent)
|
||||
{
|
||||
Vector2 currentMousePosition;
|
||||
if (mouseEvent.NumPositions == 1)
|
||||
{
|
||||
currentMousePosition.X = mouseEvent.X;
|
||||
currentMousePosition.Y = mouseEvent.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentMousePosition = (mouseEvent.GetPosition(1) + mouseEvent.GetPosition(0)) / 2;
|
||||
}
|
||||
return currentMousePosition;
|
||||
}
|
||||
|
||||
private Vector3 IntersectPlane(Vector3 planeNormal, Vector3 rayOrigin, Vector3 rayDirection)
|
||||
{
|
||||
var d = Vector3Ex.Dot(planeNormal, rayDirection);
|
||||
|
|
|
|||
|
|
@ -226,8 +226,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
base.OnMouseDown(mouseEvent);
|
||||
|
||||
// store the mouse down so we can check of up if we should move to the clicked spot or we have rotated the cube
|
||||
mouseDownPosition = mouseEvent.Position;
|
||||
trackballTumbleWidgetExtended.StartRotateAroundOrigin(mouseDownPosition);
|
||||
trackballTumbleWidgetExtended.StartRotateAroundOrigin(mouseEvent.Position);
|
||||
}
|
||||
|
||||
public override void OnMouseMove(MouseEventArgs mouseEvent)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit c18b1765176074dd5cc00bb594c43150933d46bb
|
||||
Subproject commit 7399a6188f36a3b79abd0dc800bd40fe944eb20b
|
||||
Loading…
Add table
Add a link
Reference in a new issue