DetailsPanel now stretches horizontally in Portrait mode and vertically in Landscape mode
This commit is contained in:
@@ -211,8 +211,8 @@ GameObject:
|
|||||||
- component: {fileID: 224250538007241578}
|
- component: {fileID: 224250538007241578}
|
||||||
- component: {fileID: 222458038700812966}
|
- component: {fileID: 222458038700812966}
|
||||||
- component: {fileID: 114213177184435094}
|
- component: {fileID: 114213177184435094}
|
||||||
- component: {fileID: 111894107479966502}
|
|
||||||
- component: {fileID: 114451700018395534}
|
- component: {fileID: 114451700018395534}
|
||||||
|
- component: {fileID: 111859617734083424}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: DetailsPanel
|
m_Name: DetailsPanel
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -451,7 +451,7 @@ GameObject:
|
|||||||
- component: {fileID: 222281876000192902}
|
- component: {fileID: 222281876000192902}
|
||||||
- component: {fileID: 114850943686386882}
|
- component: {fileID: 114850943686386882}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: ScrollContainer
|
m_Name: TextScrollContainer
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -690,7 +690,7 @@ Animator:
|
|||||||
m_WarningMessage:
|
m_WarningMessage:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
--- !u!111 &111894107479966502
|
--- !u!111 &111859617734083424
|
||||||
Animation:
|
Animation:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
@@ -1529,8 +1529,8 @@ MonoBehaviour:
|
|||||||
m_TargetGraphic: {fileID: 114013157313467306}
|
m_TargetGraphic: {fileID: 114013157313467306}
|
||||||
m_HandleRect: {fileID: 224126681634059420}
|
m_HandleRect: {fileID: 224126681634059420}
|
||||||
m_Direction: 2
|
m_Direction: 2
|
||||||
m_Value: 0.5
|
m_Value: 0.49999964
|
||||||
m_Size: 0.49794
|
m_Size: 0.7254501
|
||||||
m_NumberOfSteps: 0
|
m_NumberOfSteps: 0
|
||||||
m_OnValueChanged:
|
m_OnValueChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
@@ -1827,7 +1827,7 @@ MonoBehaviour:
|
|||||||
spaceCount: 174
|
spaceCount: 174
|
||||||
wordCount: 174
|
wordCount: 174
|
||||||
linkCount: 0
|
linkCount: 0
|
||||||
lineCount: 29
|
lineCount: 24
|
||||||
pageCount: 1
|
pageCount: 1
|
||||||
materialCount: 1
|
materialCount: 1
|
||||||
m_havePropertiesChanged: 1
|
m_havePropertiesChanged: 1
|
||||||
@@ -2332,7 +2332,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 25, y: 25}
|
m_AnchoredPosition: {x: 25, y: 25}
|
||||||
m_SizeDelta: {x: 460, y: 375}
|
m_SizeDelta: {x: 550, y: 450}
|
||||||
m_Pivot: {x: 0, y: 0}
|
m_Pivot: {x: 0, y: 0}
|
||||||
--- !u!224 &224251385334151864
|
--- !u!224 &224251385334151864
|
||||||
RectTransform:
|
RectTransform:
|
||||||
@@ -2368,7 +2368,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: -0.000030517578}
|
m_AnchoredPosition: {x: 0, y: -0.000015258789}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!224 &224272151730405692
|
--- !u!224 &224272151730405692
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace RothenburgAR.Exhibition
|
|||||||
outlineRenderer.SetPosition(7, topRight);
|
outlineRenderer.SetPosition(7, topRight);
|
||||||
outlineRenderer.SetPosition(8, topLeft);
|
outlineRenderer.SetPosition(8, topLeft);
|
||||||
|
|
||||||
outlineRenderer.numCornerVertices = 1;
|
outlineRenderer.numCornerVertices = 2;
|
||||||
outlineRenderer.numCapVertices = 1;
|
outlineRenderer.numCapVertices = 1;
|
||||||
|
|
||||||
outlineRenderer.alignment = LineAlignment.Local;
|
outlineRenderer.alignment = LineAlignment.Local;
|
||||||
|
|||||||
@@ -18,9 +18,53 @@ namespace RothenburgAR.UI
|
|||||||
public GameObject IconLoading;
|
public GameObject IconLoading;
|
||||||
public GameObject Icon3D;
|
public GameObject Icon3D;
|
||||||
|
|
||||||
|
private float initialHeight;
|
||||||
|
private float initialWidth;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
|
DisplayManager.Instance.AddOrientationChangeListener(SetSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
SetSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
DisplayManager.Instance.RemoveOrientationChangeListener(SetSize);
|
||||||
|
RemoveModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetSize()
|
||||||
|
{
|
||||||
|
var transform = GetComponent<RectTransform>();
|
||||||
|
var border = 0f;
|
||||||
|
|
||||||
|
initialWidth = initialWidth == 0
|
||||||
|
? transform.offsetMax.x
|
||||||
|
: initialWidth;
|
||||||
|
|
||||||
|
initialHeight = initialHeight == 0
|
||||||
|
? transform.offsetMax.y
|
||||||
|
: initialHeight;
|
||||||
|
|
||||||
|
if (Screen.orientation == ScreenOrientation.Portrait)
|
||||||
|
{
|
||||||
|
// stretch horizontally
|
||||||
|
transform.anchorMax = new Vector2(1, 0);
|
||||||
|
transform.offsetMin = new Vector2(border, border);
|
||||||
|
transform.offsetMax = new Vector2(-border, initialHeight);
|
||||||
|
}
|
||||||
|
else //if (Screen.orientation == ScreenOrientation.Landscape) //landscape or default?
|
||||||
|
{
|
||||||
|
// stretch vertically
|
||||||
|
transform.anchorMax = new Vector2(0, 1);
|
||||||
|
transform.offsetMin = new Vector2(border, border);
|
||||||
|
transform.offsetMax = new Vector2(initialWidth, -border);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasModel
|
public bool HasModel
|
||||||
@@ -126,11 +170,13 @@ namespace RothenburgAR.UI
|
|||||||
public void UpdateOpeningAnimation(Vector3 position)
|
public void UpdateOpeningAnimation(Vector3 position)
|
||||||
{
|
{
|
||||||
float duration = .4f;
|
float duration = .4f;
|
||||||
|
StartCoroutine("SetSizeAfterSeconds", duration + .1f);
|
||||||
|
|
||||||
var scale = DisplayManager.Instance.GetComponent<RectTransform>().localScale.x;
|
var scale = DisplayManager.Instance.GetComponent<RectTransform>().localScale.x;
|
||||||
Vector3 screenMiddle = new Vector3(Screen.width / scale, Screen.height / scale, 0) * 0.5f;
|
Vector3 screenMiddle = new Vector3(Screen.width / scale, Screen.height / scale, 0) * 0.5f;
|
||||||
|
|
||||||
Vector3 startPos = Camera.main.WorldToScreenPoint(position) / scale - screenMiddle;
|
Vector3 startPos = Camera.main.WorldToScreenPoint(position) / scale - screenMiddle;
|
||||||
Vector3 endPos = -screenMiddle + new Vector3(25, 25, 0);
|
Vector3 endPos = -screenMiddle;
|
||||||
|
|
||||||
float startScale = 0.05f;
|
float startScale = 0.05f;
|
||||||
float endScale = 1;
|
float endScale = 1;
|
||||||
@@ -139,7 +185,7 @@ namespace RothenburgAR.UI
|
|||||||
var clip = new AnimationClip
|
var clip = new AnimationClip
|
||||||
{
|
{
|
||||||
legacy = true,
|
legacy = true,
|
||||||
name = "DetailsOpen"
|
name = "DetailsOpen",
|
||||||
};
|
};
|
||||||
|
|
||||||
// inTangent and outTangent are the curve's angles to and from this keyframe in radians.
|
// inTangent and outTangent are the curve's angles to and from this keyframe in radians.
|
||||||
@@ -172,6 +218,12 @@ namespace RothenburgAR.UI
|
|||||||
anim.Play(clip.name);
|
anim.Play(clip.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator SetSizeAfterSeconds(float duration)
|
||||||
|
{
|
||||||
|
yield return new WaitForSecondsRealtime(duration);
|
||||||
|
SetSize();
|
||||||
|
}
|
||||||
|
|
||||||
public void OnDetailsPanelDrag(BaseEventData data)
|
public void OnDetailsPanelDrag(BaseEventData data)
|
||||||
{
|
{
|
||||||
DetailsModel.RotateModelByDrag(data as PointerEventData);
|
DetailsModel.RotateModelByDrag(data as PointerEventData);
|
||||||
@@ -186,10 +238,5 @@ namespace RothenburgAR.UI
|
|||||||
{
|
{
|
||||||
DetailsModel.EndRotateModelByDrag(data as PointerEventData);
|
DetailsModel.EndRotateModelByDrag(data as PointerEventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
RemoveModel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user