Commit f721cee7 authored by Gerard Gascón's avatar Gerard Gascón
Browse files

feat: Added minimum window size

parent 83827004
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -303,37 +303,37 @@ namespace SatorImaging.AppWindowUtility
            if (resizeDirection.x > 0) {
                if (resizeDirection.y > 0) {
                    width = (int)(rect.right - rect.left + deltaX);
                    height = (int)(width / aspectRatio);
                }else if (resizeDirection.y < 0) {
                    width = (int)(rect.right - rect.left + deltaX);
                    height = (int)(width / aspectRatio);
                }else {
                    width = (int)(rect.right - rect.left + deltaX);
                    height = (int)(width / aspectRatio);
                }
                width = Mathf.Max(width, 100);
                height = (int)(width / aspectRatio);
            }else if (resizeDirection.x < 0) {
                if (resizeDirection.y > 0) {
                    x += (int)deltaX;
                    width = rect.right - x;
                    height = (int)(width / aspectRatio);
                }else if (resizeDirection.y < 0) {
                    x += (int)deltaX;
                    width = rect.right - x;
                    height = (int)(width / aspectRatio);
                }else {
                    x += (int)deltaX;
                    width = rect.right - x;
                    height = (int)(width / aspectRatio);
                }
                if (width < 100) x -= 100 - width;
                width = Mathf.Max(width, 100);
                height = (int)(width / aspectRatio);
            } else {
                if (resizeDirection.y > 0) {
                    y += (int)deltaY;
                    height = rect.bottom - y;
                    width = (int)(height * aspectRatio);
                }else if (resizeDirection.y < 0) {
                    height = (int)(rect.bottom - rect.top + deltaY);
                    width = (int)(height * aspectRatio);
                }
                if (height < 150 && resizeDirection.y > 0) y -= 150 - height;
                height = Mathf.Max(height, 150);
                width = (int)(height * aspectRatio);
            }

            WinApi.SetWindowPos(hWnd, IntPtr.Zero, x, y, width, height, WinApi.SetWindowPosFlags.NoFlag);