()
| 715 | } |
| 716 | |
| 717 | private onMouseUp(): void { |
| 718 | if (this.owner.isDisposed) return; |
| 719 | |
| 720 | const stage = Stage.inst; |
| 721 | stage.off('mousemove', this._onMouseMoveHandler, this); |
| 722 | stage.off('mouseup', this._onMouseUpHandler, this); |
| 723 | |
| 724 | if (ScrollPane.draggingPane === this) { |
| 725 | ScrollPane.draggingPane = null; |
| 726 | } |
| 727 | |
| 728 | ScrollPane._gestureFlag = 0; |
| 729 | |
| 730 | if (!this._dragged || !this.touchEffect) { |
| 731 | this._dragged = false; |
| 732 | return; |
| 733 | } |
| 734 | |
| 735 | this._dragged = false; |
| 736 | |
| 737 | this._tweenStartX = this._containerX; |
| 738 | this._tweenStartY = this._containerY; |
| 739 | |
| 740 | let endPosX = this._tweenStartX; |
| 741 | let endPosY = this._tweenStartY; |
| 742 | let flag = false; |
| 743 | |
| 744 | // Check if out of bounds |
| 745 | if (this._containerX > 0) { |
| 746 | endPosX = 0; |
| 747 | flag = true; |
| 748 | } else if (this._containerX < -this._overlapWidth) { |
| 749 | endPosX = -this._overlapWidth; |
| 750 | flag = true; |
| 751 | } |
| 752 | |
| 753 | if (this._containerY > 0) { |
| 754 | endPosY = 0; |
| 755 | flag = true; |
| 756 | } else if (this._containerY < -this._overlapHeight) { |
| 757 | endPosY = -this._overlapHeight; |
| 758 | flag = true; |
| 759 | } |
| 760 | |
| 761 | if (flag) { |
| 762 | this._tweenChangeX = endPosX - this._tweenStartX; |
| 763 | this._tweenChangeY = endPosY - this._tweenStartY; |
| 764 | this._tweenDurationX = TWEEN_TIME_DEFAULT; |
| 765 | this._tweenDurationY = TWEEN_TIME_DEFAULT; |
| 766 | } else { |
| 767 | // Apply inertia |
| 768 | if (!this.inertiaDisabled) { |
| 769 | const frameRate = 60; |
| 770 | const elapsed = ((Date.now() / 1000 - this._lastMoveTime) * frameRate) - 1; |
| 771 | if (elapsed > 1) { |
| 772 | const factor = Math.pow(0.833, elapsed); |
| 773 | this._velocityX *= factor; |
| 774 | this._velocityY *= factor; |
no test coverage detected