Minor VSS/HSS bugfixes and enhancements, resolving #114
parent
ec31c8b5d6
commit
f89702ddc6
|
@ -37,6 +37,7 @@ namespace UnityEngine.UI.Extensions
|
|||
_screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime);
|
||||
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f)
|
||||
{
|
||||
_screensContainer.localPosition = _lerp_target;
|
||||
_lerp = false;
|
||||
EndScreenChange();
|
||||
}
|
||||
|
@ -192,6 +193,16 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InitialiseChildObjects();
|
||||
DistributePages();
|
||||
if (MaskArea) UpdateVisible();
|
||||
|
||||
if(JumpOnEnable) SetScrollContainerPosition();
|
||||
GoToScreen(StartingScreen);
|
||||
}
|
||||
|
||||
#region Interfaces
|
||||
/// <summary>
|
||||
/// Release screen to swipe
|
||||
|
|
|
@ -90,6 +90,9 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
[Tooltip("By default the container will lerp to the start when enabled in the scene, this option overrides this and forces it to simply jump without lerping")]
|
||||
public bool JumpOnEnable = false;
|
||||
|
||||
[Tooltip("(Experimental)\nBy default, child array objects will use the parent transform\nHowever you can disable this for some interesting effects")]
|
||||
public bool UseParentTransform = true;
|
||||
|
||||
|
@ -127,6 +130,18 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
|
||||
_screensContainer = _scroll_rect.content;
|
||||
|
||||
InitialiseChildObjects();
|
||||
|
||||
if (NextButton)
|
||||
NextButton.GetComponent<Button>().onClick.AddListener(() => { NextScreen(); });
|
||||
|
||||
if (PrevButton)
|
||||
PrevButton.GetComponent<Button>().onClick.AddListener(() => { PreviousScreen(); });
|
||||
}
|
||||
|
||||
internal void InitialiseChildObjects()
|
||||
{
|
||||
if (ChildObjects != null && ChildObjects.Length > 0)
|
||||
{
|
||||
if (_screensContainer.transform.childCount > 0)
|
||||
|
@ -141,12 +156,6 @@ namespace UnityEngine.UI.Extensions
|
|||
{
|
||||
InitialiseChildObjectsFromScene();
|
||||
}
|
||||
|
||||
if (NextButton)
|
||||
NextButton.GetComponent<Button>().onClick.AddListener(() => { NextScreen(); });
|
||||
|
||||
if (PrevButton)
|
||||
PrevButton.GetComponent<Button>().onClick.AddListener(() => { PreviousScreen(); });
|
||||
}
|
||||
|
||||
internal void InitialiseChildObjectsFromScene()
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace UnityEngine.UI.Extensions
|
|||
_screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime);
|
||||
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f)
|
||||
{
|
||||
_screensContainer.localPosition = _lerp_target;
|
||||
_lerp = false;
|
||||
EndScreenChange();
|
||||
}
|
||||
|
@ -192,6 +193,16 @@ namespace UnityEngine.UI.Extensions
|
|||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InitialiseChildObjects();
|
||||
DistributePages();
|
||||
if (MaskArea) UpdateVisible();
|
||||
|
||||
if (JumpOnEnable) SetScrollContainerPosition();
|
||||
GoToScreen(StartingScreen);
|
||||
}
|
||||
|
||||
#region Interfaces
|
||||
/// <summary>
|
||||
/// Release screen to swipe
|
||||
|
|
Loading…
Reference in New Issue