public virtual void OnDrag(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) { return; } if (!this.IsActive()) { return; } Vector2 a; if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(this.viewRect, eventData.position, eventData.pressEventCamera, out a)) { return; } this.UpdateBounds(true); Vector2 b = a - this.m_PointerStartLocalCursor; Vector2 vector = this.m_ContentStartPosition + b; Vector2 b2 = this.CalculateOffset(vector - this.m_Content.anchoredPosition); vector += b2; if (this.m_MovementType == LoopScrollRect.MovementType.Elastic) { if (b2.x != 0f) { vector.x -= LoopScrollRect.RubberDelta(b2.x, this.m_ViewBounds.size.x); } if (b2.y != 0f) { vector.y -= LoopScrollRect.RubberDelta(b2.y, this.m_ViewBounds.size.y); } } this.SetContentAnchoredPosition(vector); }