From 29544ffb3c996bf869541db13f7c5216cc1e1e63 Mon Sep 17 00:00:00 2001 From: lanyill Date: Wed, 30 Nov 2022 11:32:54 +0800 Subject: [PATCH] =?UTF-8?q?xcomponent=20xts=E7=94=A8=E4=BE=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E8=A7=A3=E5=86=B3=E8=93=9D=E9=BB=84=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanyill --- .../src/main/cpp/render/plugin_render.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp b/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp index 0cf67d917..9a257be1d 100644 --- a/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp +++ b/arkui/ace_ets_xcomponent/entry/src/main/cpp/render/plugin_render.cpp @@ -37,8 +37,8 @@ double PluginRender::off_x = 0; double PluginRender::off_y = 0; uint32_t PluginRender::toolType_ = 5; uint32_t PluginRender::mousecallback_ = 0; -float PluginRender::tiltX_= 0; -float PluginRender::tiltY_= 0; +float PluginRender::tiltX_ = 0; +float PluginRender::tiltY_ = 0; uint32_t PluginRender::touchType = 4; OH_NativeXComponent_TouchEvent PluginRender::testTouchEvent_; OH_NativeXComponent_MouseEvent PluginRender::testMouseEvent_; @@ -159,7 +159,8 @@ void PluginRender::SetNativeXComponent(OH_NativeXComponent* component) { component_ = component; OH_NativeXComponent_RegisterCallback(component_, &PluginRender::callback_); - uint32_t mousecallback = OH_NativeXComponent_RegisterMouseEventCallback(component_, &PluginRender::mouseEventcallback_); + uint32_t mousecallback = OH_NativeXComponent_RegisterMouseEventCallback(component_, + &PluginRender::mouseEventcallback_); mousecallback_ = mousecallback; } @@ -220,12 +221,12 @@ void PluginRender::DispatchTouchEvent(OH_NativeXComponent* component, void* wind if (ret == OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { testTouchEvent_ = touchEvent_; LOGE("Touch Info : x = %{public}f, y = %{public}f screenx = %{public}f, screeny = %{public}f", - touchEvent_.x, touchEvent_.y, touchEvent_.screenX, touchEvent_.screenY); + touchEvent_.x, touchEvent_.y, touchEvent_.screenX, touchEvent_.screenY); for (uint32_t i = 0; i < touchEvent_.numPoints; i++) { LOGE("Touch Info : dots[%{public}d] id %{public}d x = %{public}f, y = %{public}f", i, - touchEvent_.touchPoints[i].id, touchEvent_.touchPoints[i].x, touchEvent_.touchPoints[i].y); + touchEvent_.touchPoints[i].id, touchEvent_.touchPoints[i].x, touchEvent_.touchPoints[i].y); LOGE("Touch Info : screenx = %{public}f, screeny = %{public}f", - touchEvent_.touchPoints[i].screenX, touchEvent_.touchPoints[i].screenY); + touchEvent_.touchPoints[i].screenX, touchEvent_.touchPoints[i].screenY); OH_NativeXComponent_TouchPointToolType toolType = OH_NativeXComponent_TouchPointToolType::OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN; float tiltX = 123.0; float tiltY = 321.0; @@ -238,7 +239,8 @@ void PluginRender::DispatchTouchEvent(OH_NativeXComponent* component, void* wind toolType_ = toolType; tiltX_ = tiltX; tiltY_ = tiltY; - LOGE("Touch Info : DispatchTouchEvent dots[%{public}d] toolType=%{public}u, tiltX=%{public}f, tiltY=%{public}f", i, toolType, tiltX, tiltY); + LOGE("Touch Info : DispatchTouchEvent dots[%{public}d] toolType=%{public}u, tiltX=%{public}f, tiltY=%{public}f", + i, toolType, tiltX, tiltY); } } else { LOGE("Touch fail"); @@ -264,7 +266,8 @@ napi_value PluginRender::Export(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("TestGetXComponentpointtool_tilty", PluginRender::TestGetXComponentpointtool_tilty), DECLARE_NAPI_FUNCTION("TestGetXComponentpointtool_type", PluginRender::TestGetXComponentpointtool_type), DECLARE_NAPI_FUNCTION("TestGetXComponentpointtool_tiltx", PluginRender::TestGetXComponentpointtool_tiltx), - DECLARE_NAPI_FUNCTION("TestGetXComponent_RegisterMouseEventCallback", PluginRender::TestGetXComponent_RegisterMouseEventCallback), + DECLARE_NAPI_FUNCTION("TestGetXComponent_RegisterMouseEventCallback", + PluginRender::TestGetXComponent_RegisterMouseEventCallback), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); @@ -278,8 +281,8 @@ void PluginRender::DispatchMouseEvent(OH_NativeXComponent* component, void* wind LOGE("----------TestMouse Mouse Info DispatchMouseEvent"); if (ret == OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { testMouseEvent_ = mouseEvent_; - LOGE("TestMouse Mouse Info : x = %{public}f, y = %{public}f screenx = %{public}f, screeny = %{public}f", mouseEvent_.x, mouseEvent_.y, mouseEvent_.screenX, mouseEvent_.screenY); - LOGE("TestMouse Mouse Info : action = %{public}d, button = %{public}d, time = %{public}lld", mouseEvent_.action, mouseEvent_.button, mouseEvent_.timestamp ); + LOGE("TestMouse Mouse Info : x = %{public}f, y = %{public}f screenx = %{public}f, screeny = %{public}f", + mouseEvent_.x, mouseEvent_.y, mouseEvent_.screenX, mouseEvent_.screenY); LOGE("TestMouse Mouse Info : action = %{public}d, button = %{public}d", mouseEvent_.action, mouseEvent_.button); } else { LOGE("Mouse Info fail"); @@ -556,8 +559,6 @@ napi_value PluginRender::TestGetXComponent_RegisterMouseEventCallback(napi_env e LOGE("xclog running PluginRender::TestGetXComponent_RegisterMouseEventCallback"); napi_value callback_; - - NAPI_CALL(env, napi_create_double(env, mousecallback_, &(callback_))); napi_value obj; -- GitLab