public static void SetWindowSize(WindowComponent windowComponent, int width, int height) { if (width >= 0) { windowComponent.WindowWidget.width = (int)Mathf.Min(width, MaxWindowSize.x); } if (height >= 0) { windowComponent.WindowWidget.height = (int)Mathf.Min(height, MaxWindowSize.y); } var bounds = GameObjectUtil.GetDragObjectBounds(windowComponent.ControlBar.DragObject); windowComponent.ControlBar.DragObject.panelRegion.ConstrainTargetToBounds(windowComponent.transform, ref bounds, true); }
public static void KeepWindowInsideScreen(WindowComponent windowComponent) { var bounds = GameObjectUtil.GetDragObjectBounds(windowComponent.ControlBar.DragObject); windowComponent.ControlBar.DragObject.panelRegion.ConstrainTargetToBounds(windowComponent.transform, ref bounds, true); }