Exemplo n.º 1
0
        public void OnResize(BaseEventData data)
        {
            PointerEventData pointer = (PointerEventData)data;

            Vector2 deltaSize = pointer.position - (Vector2)dragGizmo.position;

            deltaSize.y = -deltaSize.y;

            Vector2 newSize = window.sizeDelta + deltaSize / canvas.localScale.x;

            if (newSize.x < fileBrowser.MinWidth)
            {
                newSize.x = fileBrowser.MinWidth;
            }
            if (newSize.y < fileBrowser.MinHeight)
            {
                newSize.y = fileBrowser.MinHeight;
            }

            newSize.x = (int)newSize.x;
            newSize.y = (int)newSize.y;

            deltaSize   = newSize - window.sizeDelta;
            deltaSize.y = -deltaSize.y;

            window.sizeDelta         = newSize;
            window.anchoredPosition += deltaSize * 0.5f;

            listView.OnViewportDimensionsChanged();
        }
Exemplo n.º 2
0
        public void OnResize(BaseEventData data)
        {
            PointerEventData pointer = (PointerEventData)data;

            Vector2 touchPos;

            RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasTR, pointer.position, canvasCam, out touchPos);

            Vector2 delta   = touchPos - initialTouchPos;
            Vector2 newSize = initialSizeDelta + new Vector2(delta.x, -delta.y);

            if (newSize.x < fileBrowser.minWidth)
            {
                newSize.x = fileBrowser.minWidth;
            }
            if (newSize.y < fileBrowser.minHeight)
            {
                newSize.y = fileBrowser.minHeight;
            }

            newSize.x = (int)newSize.x;
            newSize.y = (int)newSize.y;

            delta = newSize - initialSizeDelta;

            window.anchoredPosition = initialAnchoredPos + new Vector2(delta.x * 0.5f, delta.y * -0.5f);
            window.sizeDelta        = newSize;

            listView.OnViewportDimensionsChanged();
        }