From 22aaf801be765f277d89f083da3addcbb680cbbd Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Tue, 7 Jun 2022 14:14:22 +1200 Subject: [PATCH] use matrix CreateTransform (#8687) --- Content.Client/Viewport/ScalingViewport.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Content.Client/Viewport/ScalingViewport.cs b/Content.Client/Viewport/ScalingViewport.cs index 63f7f65de1..d920444bbd 100644 --- a/Content.Client/Viewport/ScalingViewport.cs +++ b/Content.Client/Viewport/ScalingViewport.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Robust.Client.Graphics; using Robust.Client.Input; @@ -276,14 +276,11 @@ namespace Content.Client.Viewport var drawBox = GetDrawBox(); 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. return Matrix3.Identity; - var scale = Matrix3.CreateScale(scaleFactor); - var translate = Matrix3.CreateTranslation(GlobalPixelPosition + drawBox.TopLeft); - - return scale * translate; + return Matrix3.CreateTransform(GlobalPixelPosition + drawBox.TopLeft, 0, scaleFactor); } private void EnsureViewportCreated()