use matrix CreateTransform (#8687)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
@@ -276,14 +276,11 @@ namespace Content.Client.Viewport
|
|||||||
var drawBox = GetDrawBox();
|
var drawBox = GetDrawBox();
|
||||||
var scaleFactor = drawBox.Size / (Vector2) _viewport!.Size;
|
var scaleFactor = drawBox.Size / (Vector2) _viewport!.Size;
|
||||||
|
|
||||||
if (scaleFactor == (0, 0))
|
if (scaleFactor.X == 0 || scaleFactor.Y == 0)
|
||||||
// Basically a nonsense scenario, at least make sure to return something that can be inverted.
|
// Basically a nonsense scenario, at least make sure to return something that can be inverted.
|
||||||
return Matrix3.Identity;
|
return Matrix3.Identity;
|
||||||
|
|
||||||
var scale = Matrix3.CreateScale(scaleFactor);
|
return Matrix3.CreateTransform(GlobalPixelPosition + drawBox.TopLeft, 0, scaleFactor);
|
||||||
var translate = Matrix3.CreateTranslation(GlobalPixelPosition + drawBox.TopLeft);
|
|
||||||
|
|
||||||
return scale * translate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EnsureViewportCreated()
|
private void EnsureViewportCreated()
|
||||||
|
|||||||
Reference in New Issue
Block a user