private void OnPressBackground(GameObject go, bool isPressed) { mCam = UICamera.currentCamera; Reposition(UICamera.lastTouchPosition); if (!isPressed) { onDragFinished?.Invoke(); } }
private void shape_MouseUp(object sender, MouseButtonEventArgs e) { if (Entered) { OnDragFinished?.Invoke(); Entered = false; } }
private void LateUpdate() { if (repositionClipping) { repositionClipping = false; mCalculatedBounds = false; SetDragAmount(relativePositionOnReset.x, relativePositionOnReset.y, true); } if (Application.isPlaying) { var deltaTime = UpdateRealTimeDelta(); if (showScrollBars != ShowCondition.Always) { var shouldMoveVertically = false; var shouldMoveHorizontally = false; if (showScrollBars != ShowCondition.WhenDragging || mDragID != -10 || mMomentum.magnitude > 0.01f) { shouldMoveVertically = this.shouldMoveVertically; shouldMoveHorizontally = this.shouldMoveHorizontally; } if (verticalScrollBar != null) { var num2 = verticalScrollBar.alpha + (!shouldMoveVertically ? -deltaTime * 3f : deltaTime * 6f); num2 = Mathf.Clamp01(num2); if (verticalScrollBar.alpha != num2) { verticalScrollBar.alpha = num2; } } if (horizontalScrollBar != null) { var num3 = horizontalScrollBar.alpha + (!shouldMoveHorizontally ? -deltaTime * 3f : deltaTime * 6f); num3 = Mathf.Clamp01(num3); if (horizontalScrollBar.alpha != num3) { horizontalScrollBar.alpha = num3; } } } if (mShouldMove && !mPressed) { mMomentum -= scale * (mScroll * 0.05f); if (mMomentum.magnitude > 0.0001f) { mScroll = NGUIMath.SpringLerp(mScroll, 0f, 20f, deltaTime); var absolute = NGUIMath.SpringDampen(ref mMomentum, 9f, deltaTime); MoveAbsolute(absolute); if (restrictWithinPanel && mPanel.clipping != UIDrawCall.Clipping.None) { RestrictWithinBounds(false); } if (mMomentum.magnitude < 0.0001f) { onDragFinished?.Invoke(); } return; } mScroll = 0f; mMomentum = Vector3.zero; } else { mScroll = 0f; } NGUIMath.SpringDampen(ref mMomentum, 9f, deltaTime); } }