From 8aa49e1f5be7774edc9783f9d964da346e17436f Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 28 Sep 2024 18:14:34 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=EF=BC=8C#672,=E8=93=9D?= =?utf8?q?=E7=89=99=E8=80=B3=E6=9C=BA=E7=95=8C=E9=9D=A2=E9=80=80=E5=87=BA?= =?utf8?q?=EF=BC=8C=E7=A8=8D=E5=BE=AE=E5=8F=B3=E6=BB=91=E5=B0=B1=E9=80=80?= =?utf8?q?=E5=87=BA=E4=BA=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../bluetooth/include/BluetoothPresenter.h | 4 +++- .../bluetooth/src/BluetoothPresenter.cpp | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h index e6c7e1037..50303a5dd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:01 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-04 15:43:50 + * @LastEditTime: 2024-09-28 18:06:32 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h */ @@ -44,6 +44,7 @@ public: ~BluetoothPresenter(); bool OnClick(UIView &view, const ClickEvent &event) override; static BluetoothPresenter *GetInstance(); + bool OnDrag(UIView& view, const DragEvent& event) override; bool OnDragEnd(UIView& view, const DragEvent& event) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; void OnStart() override; @@ -60,6 +61,7 @@ public: void ClickConnfailBackButton(void); private: BluetoothModel *bluetoothMode_{nullptr}; + bool X_DRAG_FLAG{false}; }; } // namespace OHOS #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp index 9d6b02e17..aa5f2ff2a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp @@ -190,10 +190,25 @@ void BluetoothPresenter::ClickConnfailBackButton(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClickConnfailBackButton ConnectRemoteDevice retVal = %d", retVal); } -bool BluetoothPresenter::OnDragEnd(UIView& view, const DragEvent& event) +bool BluetoothPresenter::OnDrag(UIView& view, const DragEvent& event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { + int16_t deltaX; + int16_t deltaY; + deltaX = event.GetDeltaX(); + deltaY = event.GetDeltaY(); + if (MATH_ABS(deltaX) >= MATH_ABS(deltaY) && MATH_ABS(deltaX) > 30) { + X_DRAG_FLAG = true; + } + } + return true; +} + +bool BluetoothPresenter::OnDragEnd(UIView& view, const DragEvent& event) +{ + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG) { view_->DropView(view); + X_DRAG_FLAG = false; } return true; } -- 2.17.1