Making fit to bounds recalculate aabb when matrix changes
issue: MatterHackers/MCCentral#3831 Fit to bounds has bad rotation axis' after being moved
This commit is contained in:
parent
e80f773cb9
commit
d1d71f9603
4 changed files with 13 additions and 6 deletions
|
|
@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
public double Width { get; set; }
|
||||
public double Depth { get; set; }
|
||||
public double Diameter { get; set; }
|
||||
public double Height { get; set; }
|
||||
public double Height { get; set; }
|
||||
|
||||
[Description("Set the rules for how to maintain the part while scaling.")]
|
||||
public MaintainRatio MaintainRatio { get; set; } = MaintainRatio.X_Y;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
private Vector3 cacheBounds;
|
||||
|
||||
private Matrix4X4 cacheMatrix;
|
||||
private Matrix4X4 cacheParentMatrix;
|
||||
private Matrix4X4 cacheThisMatrix;
|
||||
|
||||
public FitToBoundsObject3D_2()
|
||||
{
|
||||
|
|
@ -110,7 +111,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
if (Children.Count == 2)
|
||||
{
|
||||
if (cacheMatrix != matrix
|
||||
if (cacheParentMatrix != matrix
|
||||
|| cacheThisMatrix != Matrix
|
||||
|| cacheBounds != boundsSize)
|
||||
{
|
||||
using (FitBounds.RebuildLock())
|
||||
|
|
@ -119,7 +121,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
cacheAabb = base.GetAxisAlignedBoundingBox(matrix);
|
||||
FitBounds.Visible = false;
|
||||
}
|
||||
cacheMatrix = matrix;
|
||||
cacheParentMatrix = matrix;
|
||||
cacheThisMatrix = Matrix;
|
||||
cacheBounds = boundsSize;
|
||||
}
|
||||
|
||||
|
|
@ -144,6 +147,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
{
|
||||
Rebuild(null);
|
||||
}
|
||||
else if(invalidateType.InvalidateType == InvalidateType.Matrix)
|
||||
{
|
||||
cacheThisMatrix = Matrix4X4.Identity;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnInvalidate(invalidateType);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit a294e67725162baedc55a40570d197f3f60d6e3c
|
||||
Subproject commit 25566d561cf4431d0d1536c4eb70ae008924233e
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 83a061238145ccde64e2effc10e55468b39b5b8d
|
||||
Subproject commit 222d93bbf054ab869c073b9d8810011b73d3d1af
|
||||
Loading…
Add table
Add a link
Reference in a new issue