using System.Runtime.CompilerServices; using UnityEngine; namespace SatorImaging.AppWindowUtility { public static class ResizeHelper { public static Vector2 GetDirection(Vector2 mousePosition, Vector2 screenSize) { float widthPercentage = mousePosition.x / screenSize.x; float heightPercentage = mousePosition.y / screenSize.y; const float marginHeightPercentage = 30f / 1920f; const float marginWidthPercentage = 30f / 1280f; if (widthPercentage < marginWidthPercentage) { if (heightPercentage > 1 - marginHeightPercentage) return new Vector2(-1, 1); if (heightPercentage < marginHeightPercentage) return new Vector2(-1, -1); return new Vector2(-1, 0); } if (widthPercentage > 1 - marginWidthPercentage) { if (heightPercentage > 1 - marginHeightPercentage) return new Vector2(1, 1); if (heightPercentage < marginHeightPercentage) return new Vector2(1, -1); return new Vector2(1, 0); } if (heightPercentage > 1 - marginHeightPercentage) return new Vector2(0, 1); if (heightPercentage < marginHeightPercentage) return new Vector2(0, -1); return Vector2.zero; } } }