4using System.Collections;
15 private Rect screenRect =
new Rect(0,0,0,0);
17 public Vector2
minSize =
new Vector2(100, 100);
18 public Vector2
maxSize =
new Vector2(10000,10000);
24 Vector2 size =
window.sizeDelta;
25 var temp = Screen.width + size.x;
34 screenRect.width = Screen.width;
35 screenRect.height = Screen.height;
38 public void OnDrag(PointerEventData eventData)
42 Debug.LogWarning(
"Window parent is null, cannot drag a null window.");
46 window.position += (Vector3) eventData.delta * .5f;
48 Vector2 flip =
new Vector2(eventData.delta.x, -eventData.delta.y);
52 Rect r = pb_GUIUtility.GetScreenRect(
window);
56 if( w < minSize.x || w >
maxSize.x || (r.x + r.width > screenRect.width) )
58 Vector2 size =
window.sizeDelta;
62 Vector3 pos =
window.position;
63 pos.x -= eventData.delta.x * .5f;
67 if( h < minSize.y || h >
maxSize.y || (r.y - r.height < 0) )
69 Vector2 size =
window.sizeDelta;
73 Vector3 pos =
window.position;
74 pos.y -= eventData.delta.y * .5f;
void OnBeginDrag(PointerEventData eventData)
void OnDrag(PointerEventData eventData)