private void SetDrag_INTERNAL(Vector2 delta) { var k = (this.GetLayoutRoot() as RectTransform).sizeDelta.x / Screen.width; if (this.preferences.IsDragViewportRestricted() == true) { var screenRect = WindowSystem.GetScreenRect(); var rect = this.GetRect(); rect.center += delta; if (rect.xMin <= screenRect.xMin) { delta.x += screenRect.xMin - rect.xMin; } if (rect.yMin - rect.height <= screenRect.yMin) { delta.y += screenRect.yMin - (rect.yMin - rect.height); } if (rect.xMax >= screenRect.xMax) { delta.x += screenRect.xMax - rect.xMax; } if (rect.yMax - rect.height >= screenRect.yMax) { delta.y += screenRect.yMax - (rect.yMax - rect.height); } } this.MoveLayout(delta * k); }