Add local variables to simplify math.
This commit is contained in:
@@ -649,14 +649,16 @@ namespace FlaxEditor
|
|||||||
{
|
{
|
||||||
var style = Style.Current;
|
var style = Style.Current;
|
||||||
var control = uiControl.Control;
|
var control = uiControl.Control;
|
||||||
|
var rotation = control.Rotation;
|
||||||
|
var rotationInRadians = rotation * Mathf.DegreesToRadians;
|
||||||
var rect = new Rectangle(
|
var rect = new Rectangle(
|
||||||
(pos +
|
(pos +
|
||||||
new Float2(resizeAxis.X * Mathf.Cos(Mathf.DegreesToRadians * control.Rotation) - resizeAxis.Y * Mathf.Sin(Mathf.DegreesToRadians * control.Rotation),
|
new Float2(resizeAxis.X * Mathf.Cos(rotationInRadians) - resizeAxis.Y * Mathf.Sin(rotationInRadians),
|
||||||
resizeAxis.Y * Mathf.Cos(Mathf.DegreesToRadians * control.Rotation) + resizeAxis.X * Mathf.Sin(Mathf.DegreesToRadians * control.Rotation)) * 10 * scale) - size * 0.5f,
|
resizeAxis.Y * Mathf.Cos(rotationInRadians) + resizeAxis.X * Mathf.Sin(rotationInRadians)) * 10 * scale) - size * 0.5f,
|
||||||
size);
|
size);
|
||||||
|
|
||||||
// Find more correct cursor at different angles
|
// Find more correct cursor at different angles
|
||||||
var unwindRotation = Mathf.UnwindDegrees(control.Rotation);
|
var unwindRotation = Mathf.UnwindDegrees(rotation);
|
||||||
if (unwindRotation is (>= 45 and < 135) or (> -135 and <= -45) )
|
if (unwindRotation is (>= 45 and < 135) or (> -135 and <= -45) )
|
||||||
{
|
{
|
||||||
switch (cursor)
|
switch (cursor)
|
||||||
|
|||||||
Reference in New Issue
Block a user