Scene Gizmo Drag 기능
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Studio.RuntimeGizmo
|
||||
{
|
||||
}
|
||||
|
||||
public class SceneGizmoRenderer : MonoBehaviour, IPointerClickHandler, IDragHandler
|
||||
public class SceneGizmoRenderer : MonoBehaviour, IPointerClickHandler, IDragHandler, IBeginDragHandler
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE || UNITY_WEBGL || UNITY_FACEBOOK || UNITY_WSA || UNITY_WSA_10_0
|
||||
, IPointerEnterHandler, IPointerExitHandler
|
||||
#else
|
||||
@@ -53,6 +53,9 @@ namespace Studio.RuntimeGizmo
|
||||
public ComponentClickedEvent OnComponentClicked { get { return m_onComponentClicked; } }
|
||||
#pragma warning restore 0649
|
||||
|
||||
private Vector2 dragBeginPos;
|
||||
private Vector2 curGizmoPos;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
imageHolderTR = (RectTransform) imageHolder.transform;
|
||||
@@ -96,8 +99,16 @@ namespace Studio.RuntimeGizmo
|
||||
m_onComponentClicked.Invoke( hitComponent );
|
||||
}
|
||||
|
||||
public void OnDrag( PointerEventData eventData )
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
dragBeginPos = eventData.position;
|
||||
curGizmoPos = transform.position;
|
||||
}
|
||||
|
||||
public void OnDrag( PointerEventData eventData)
|
||||
{
|
||||
Vector2 moveOffset = eventData.position - dragBeginPos;
|
||||
transform.position = curGizmoPos + moveOffset;
|
||||
}
|
||||
|
||||
private Vector3 GetNormalizedPointerPosition( PointerEventData eventData )
|
||||
|
||||
Reference in New Issue
Block a user