Skip to content

Commit

Permalink
交互细节优化
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyiqian committed Apr 22, 2024
1 parent f2fb28f commit 278d7e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ internal class MatrixHelper(private val stockChart: IStockChart) {
scrollMatrix.reset()
}

/**
* 处理开始触摸
*/
fun handleTouchDown(){
scroller.forceFinished(true)
}

/**
* 处理开始双指缩放
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ class StockChart @JvmOverloads constructor(context: Context, attrs: AttributeSet
inner class TouchHelperCallBack :
TouchHelper.CallBack {

override fun onTouchDown() {
matrixHelper.handleTouchDown()
}

override fun onTouchScaleBegin(focusX: Float) {
if (getConfig().scaleAble) {
requestDisallowInterceptTouchEvent(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ internal class TouchHelper(private val stockChart: IStockChart, private val call
// 不在允许的触摸范围
return false
}
callBack.onTouchDown()
}
MotionEvent.ACTION_MOVE -> {
if (isLongPressing && event.getPointerId(event.actionIndex) == inLongPressingPointerId) {
Expand Down Expand Up @@ -169,6 +170,11 @@ internal class TouchHelper(private val stockChart: IStockChart, private val call

interface CallBack {

/**
* 触摸开始
*/
fun onTouchDown()

/**
* 开始双指缩放
*/
Expand Down

0 comments on commit 278d7e0

Please sign in to comment.