|
|
@ -484,8 +484,10 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi |
|
|
|
private fun calcPoints() { |
|
|
|
private fun calcPoints() { |
|
|
|
mTouchX = touchX |
|
|
|
mTouchX = touchX |
|
|
|
mTouchY = touchY |
|
|
|
mTouchY = touchY |
|
|
|
|
|
|
|
|
|
|
|
mMiddleX = (mTouchX + mCornerX) / 2 |
|
|
|
mMiddleX = (mTouchX + mCornerX) / 2 |
|
|
|
mMiddleY = (mTouchY + mCornerY) / 2 |
|
|
|
mMiddleY = (mTouchY + mCornerY) / 2 |
|
|
|
|
|
|
|
|
|
|
|
mBezierControl1.x = |
|
|
|
mBezierControl1.x = |
|
|
|
mMiddleX - (mCornerY - mMiddleY) * (mCornerY - mMiddleY) / (mCornerX - mMiddleX) |
|
|
|
mMiddleX - (mCornerY - mMiddleY) * (mCornerY - mMiddleY) / (mCornerX - mMiddleX) |
|
|
|
mBezierControl1.y = mCornerY.toFloat() |
|
|
|
mBezierControl1.y = mCornerY.toFloat() |
|
|
@ -496,6 +498,7 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / (mCornerY - mMiddleY) |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / (mCornerY - mMiddleY) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mBezierStart1.x = mBezierControl1.x - (mCornerX - mBezierControl1.x) / 2 |
|
|
|
mBezierStart1.x = mBezierControl1.x - (mCornerX - mBezierControl1.x) / 2 |
|
|
|
mBezierStart1.y = mCornerY.toFloat() |
|
|
|
mBezierStart1.y = mCornerY.toFloat() |
|
|
|
//固定左边上下两个点 |
|
|
|
//固定左边上下两个点 |
|
|
@ -504,24 +507,27 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi |
|
|
|
if (mBezierStart1.x < 0) |
|
|
|
if (mBezierStart1.x < 0) |
|
|
|
mBezierStart1.x = viewWidth - mBezierStart1.x |
|
|
|
mBezierStart1.x = viewWidth - mBezierStart1.x |
|
|
|
|
|
|
|
|
|
|
|
val f1: Float = abs(mCornerX - mTouchX) |
|
|
|
val f1 = abs(mCornerX - mTouchX) |
|
|
|
val f2: Float = viewWidth * f1 / mBezierStart1.x |
|
|
|
val f2 = viewWidth * f1 / mBezierStart1.x |
|
|
|
mTouchX = abs(mCornerX - f2) |
|
|
|
mTouchX = abs(mCornerX - f2) |
|
|
|
val f3: Float = abs(mCornerX - mTouchX) * abs(mCornerY - mTouchY) / f1 |
|
|
|
val f3 = abs(mCornerX - mTouchX) * abs(mCornerY - mTouchY) / f1 |
|
|
|
mTouchY = abs(mCornerY - f3) |
|
|
|
mTouchY = abs(mCornerY - f3) |
|
|
|
|
|
|
|
|
|
|
|
mMiddleX = (mTouchX + mCornerX) / 2 |
|
|
|
mMiddleX = (mTouchX + mCornerX) / 2 |
|
|
|
mMiddleY = (mTouchY + mCornerY) / 2 |
|
|
|
mMiddleY = (mTouchY + mCornerY) / 2 |
|
|
|
|
|
|
|
|
|
|
|
mBezierControl1.x = |
|
|
|
mBezierControl1.x = |
|
|
|
mMiddleX - (mCornerY - mMiddleY) * (mCornerY - mMiddleY) / (mCornerX - mMiddleX) |
|
|
|
mMiddleX - (mCornerY - mMiddleY) * (mCornerY - mMiddleY) / (mCornerX - mMiddleX) |
|
|
|
mBezierControl1.y = mCornerY.toFloat() |
|
|
|
mBezierControl1.y = mCornerY.toFloat() |
|
|
|
|
|
|
|
|
|
|
|
mBezierControl2.x = mCornerX.toFloat() |
|
|
|
mBezierControl2.x = mCornerX.toFloat() |
|
|
|
mBezierControl2.y = if ((mCornerY - mMiddleY).toInt() == 0) { |
|
|
|
mBezierControl2.y = if ((mCornerY - mMiddleY).toInt() == 0) { |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / 0.1f |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / 0.1f |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / (mCornerY - mMiddleY) |
|
|
|
mMiddleY - (mCornerX - mMiddleX) * (mCornerX - mMiddleX) / (mCornerY - mMiddleY) |
|
|
|
} |
|
|
|
} |
|
|
|
mBezierStart1.x = (mBezierControl1.x - (mCornerX - mBezierControl1.x) / 2) |
|
|
|
|
|
|
|
|
|
|
|
mBezierStart1.x = mBezierControl1.x - (mCornerX - mBezierControl1.x) / 2 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
mBezierStart2.x = mCornerX.toFloat() |
|
|
|
mBezierStart2.x = mCornerX.toFloat() |
|
|
|