// ~~ private // ~ Non-Static // ~~ public public void OnDrag(PointerEventData pData) { // If the pointer is off screen, do nothing. if (!pData.IsOnScreen() || locked) { return; } // Get the signs for operations on size and position. Vector4 signs = GetSigns(pData); // Get the absolute delta between pointer position and handle position. Vector2 delta = pData.DeltaPosition(transform.position); float deltaSizeX = delta.x * signs.x; float deltaSizeY = delta.y * signs.y; float deltaPosX = delta.x * signs.z * .5f; float deltaPosY = delta.y * signs.w * .5f; ViewData.InnerWidth += deltaSizeX; ViewData.InnerHeight += deltaSizeY; ViewData.PosX += deltaPosX; ViewData.PosY += deltaPosY; }