Improve keyboard 3d view movement
Working to make scale control revert to custom if scaled
This commit is contained in:
parent
39a55139a9
commit
6b030b8a28
3 changed files with 41 additions and 24 deletions
|
|
@ -30,13 +30,10 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.VectorMath;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
@ -129,8 +126,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.X = value / UntransformedChildren.GetAxisAlignedBoundingBox().XSize;
|
||||
FixIfLockedProportions(0);
|
||||
FixIfLockedProportions(0, value / UntransformedChildren.GetAxisAlignedBoundingBox().XSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +141,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.Y = value / UntransformedChildren.GetAxisAlignedBoundingBox().YSize;
|
||||
FixIfLockedProportions(1);
|
||||
FixIfLockedProportions(1, value / UntransformedChildren.GetAxisAlignedBoundingBox().YSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +156,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.Z = value / UntransformedChildren.GetAxisAlignedBoundingBox().ZSize;
|
||||
FixIfLockedProportions(2);
|
||||
FixIfLockedProportions(2, value / UntransformedChildren.GetAxisAlignedBoundingBox().ZSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +171,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.X = value / 100;
|
||||
FixIfLockedProportions(0);
|
||||
FixIfLockedProportions(0, value / 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,8 +186,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.Y = value / 100;
|
||||
FixIfLockedProportions(1);
|
||||
FixIfLockedProportions(1, value / 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -209,21 +201,29 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
|
||||
set
|
||||
{
|
||||
ScaleRatio.Z = value / 100;
|
||||
FixIfLockedProportions(2);
|
||||
FixIfLockedProportions(2, value / 100);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ScaleLocked => LockProportions && ScaleType == ScaleTypes.Custom;
|
||||
|
||||
private void FixIfLockedProportions(int index)
|
||||
private void FixIfLockedProportions(int index, double newScale)
|
||||
{
|
||||
if (LockProportions
|
||||
&& ScaleType == ScaleTypes.Custom)
|
||||
if (Math.Abs(newScale - ScaleRatio[index]) > .001)
|
||||
{
|
||||
ScaleRatio[(index + 1) % 3] = ScaleRatio[index];
|
||||
ScaleRatio[(index + 2) % 3] = ScaleRatio[index];
|
||||
Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues));
|
||||
ScaleRatio[index] = newScale;
|
||||
if (ScaleType != ScaleTypes.Custom)
|
||||
{
|
||||
ScaleType = ScaleTypes.Custom;
|
||||
Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues));
|
||||
}
|
||||
|
||||
if (LockProportions)
|
||||
{
|
||||
ScaleRatio[(index + 1) % 3] = ScaleRatio[index];
|
||||
ScaleRatio[(index + 2) % 3] = ScaleRatio[index];
|
||||
Invalidate(new InvalidateArgs(null, InvalidateType.DisplayValues));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue