Land Explorer in HomeCamp with boot loading, journal UI, and CDN publish tooling.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ namespace AOT.UI
|
||||
{
|
||||
RectTransform _rect;
|
||||
Vector2 _position;
|
||||
Vector2 _offsetMin, _offsetMax;
|
||||
bool _captured;
|
||||
static readonly float[] NativeInsets = new float[4];
|
||||
static int _frame = -1;
|
||||
@@ -29,13 +30,19 @@ namespace AOT.UI
|
||||
{
|
||||
_rect = (RectTransform)transform;
|
||||
_position = _rect.anchoredPosition;
|
||||
_offsetMin = _rect.offsetMin;
|
||||
_offsetMax = _rect.offsetMax;
|
||||
_captured = true;
|
||||
Apply(CurrentInsets());
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
if (_captured && _rect != null) _rect.anchoredPosition = _position;
|
||||
if (_captured && _rect != null)
|
||||
{
|
||||
_rect.offsetMin = _offsetMin;
|
||||
_rect.offsetMax = _offsetMax;
|
||||
}
|
||||
_captured = false;
|
||||
}
|
||||
|
||||
@@ -44,6 +51,14 @@ namespace AOT.UI
|
||||
void Apply(Vector4 inset)
|
||||
{
|
||||
if (!_captured || !(_rect.parent is RectTransform parent)) return;
|
||||
// Full-screen authored containers shrink to the safe rectangle. Edge
|
||||
// layouts retain the original offset behavior used by the camp HUD.
|
||||
if (_rect.anchorMin == Vector2.zero && _rect.anchorMax == Vector2.one)
|
||||
{
|
||||
_rect.offsetMin = _offsetMin + new Vector2(parent.rect.width * inset.x, parent.rect.height * inset.y);
|
||||
_rect.offsetMax = _offsetMax - new Vector2(parent.rect.width * inset.z, parent.rect.height * inset.w);
|
||||
return;
|
||||
}
|
||||
Vector2 delta = Vector2.zero;
|
||||
if (Mathf.Approximately(_rect.anchorMin.y, 1) && Mathf.Approximately(_rect.anchorMax.y, 1))
|
||||
delta.y = -parent.rect.height * inset.w;
|
||||
|
||||
Reference in New Issue
Block a user