diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt index a9db71ea63..016fdb554a 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/badcase/biz/AIDataCollectWindow.kt @@ -43,6 +43,7 @@ import record_cache.RecordPanelOuterClass import java.lang.StringBuilder import java.util.* import kotlin.collections.ArrayList +import kotlin.math.absoluteValue /** * @author XuXinChao @@ -82,8 +83,6 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener private lateinit var mFloatLayout: View private var mInViewX = 0f private var mInViewY = 0f - private var mDownInScreenX = 0f - private var mDownInScreenY = 0f private var mInScreenX = 0f private var mInScreenY = 0f @@ -262,15 +261,18 @@ class AIDataCollectWindow constructor(activity: Activity) : View.OnTouchListener mInViewX = motionEvent.x mInViewY = motionEvent.y // 获取相对屏幕的坐标,即以屏幕左上角为原点 - mDownInScreenX = motionEvent.rawX - mDownInScreenY = motionEvent.rawY mInScreenX = motionEvent.rawX mInScreenY = motionEvent.rawY + mWindowParams!!.x = (mInScreenX - mInViewX).toInt() + mWindowParams!!.y = (mInScreenY - mInViewY).toInt() } MotionEvent.ACTION_MOVE -> { // 更新浮动窗口位置参数 mInScreenX = motionEvent.rawX mInScreenY = motionEvent.rawY + if(((mInScreenX - mInViewX)-mWindowParams!!.x).absoluteValue>150 || ((mInScreenY - mInViewY)-mWindowParams!!.y).absoluteValue>150){ + return true + } mWindowParams!!.x = (mInScreenX - mInViewX).toInt() mWindowParams!!.y = (mInScreenY - mInViewY).toInt() // 手指移动的时候更新小悬浮窗的位置