mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
commit
ccde9527db
@ -906,18 +906,18 @@ void AceContainer::InitializeCallback()
|
||||
};
|
||||
aceView_->RegisterAxisEventCallback(axisEventCallback);
|
||||
|
||||
auto&& keyEventCallback = [context = pipelineContext_, id = instanceId_](const KeyEvent& event) {
|
||||
auto&& nonPointerEventCallback = [context = pipelineContext_, id = instanceId_](const NonPointerEvent& event) {
|
||||
ContainerScope scope(id);
|
||||
bool result = false;
|
||||
context->GetTaskExecutor()->PostSyncTask(
|
||||
[context, event, &result, id]() {
|
||||
[context, &event, &result, id]() {
|
||||
ContainerScope scope(id);
|
||||
result = context->OnKeyEvent(event);
|
||||
result = context->OnNonPointerEvent(event);
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "ArkUIAceContainerKeyEvent", PriorityType::VIP);
|
||||
TaskExecutor::TaskType::UI, "ArkUIAceContainerNonPointerEvent", PriorityType::VIP);
|
||||
return result;
|
||||
};
|
||||
aceView_->RegisterKeyEventCallback(keyEventCallback);
|
||||
aceView_->RegisterNonPointerEventCallback(nonPointerEventCallback);
|
||||
|
||||
auto&& rotationEventCallback = [context = pipelineContext_, id = instanceId_](const RotationEvent& event) {
|
||||
ContainerScope scope(id);
|
||||
@ -1023,7 +1023,7 @@ void AceContainer::InitializeCallback()
|
||||
void AceContainer::InitDragEventCallback()
|
||||
{
|
||||
if (!isFormRender_) {
|
||||
auto&& dragEventCallback = [context = pipelineContext_, id = instanceId_](const PointerEvent& pointerEvent,
|
||||
auto&& dragEventCallback = [context = pipelineContext_, id = instanceId_](const DragPointerEvent& pointerEvent,
|
||||
const DragEventAction& action, const RefPtr<NG::FrameNode>& node) {
|
||||
ContainerScope scope(id);
|
||||
CHECK_NULL_VOID(context);
|
||||
|
@ -14,10 +14,13 @@
|
||||
*/
|
||||
|
||||
#include "adapter/ohos/entrance/ace_view_ohos.h"
|
||||
#include "pointer_event.h"
|
||||
|
||||
#include "adapter/ohos/entrance/ace_container.h"
|
||||
#include "adapter/ohos/entrance/mmi_event_convertor.h"
|
||||
#include "base/log/dump_log.h"
|
||||
#include "core/event/non_pointer_axis_event.h"
|
||||
#include "core/event/non_pointer_event.h"
|
||||
|
||||
namespace OHOS::Ace::Platform {
|
||||
namespace {
|
||||
@ -120,6 +123,9 @@ void AceViewOhos::DispatchTouchEvent(const RefPtr<AceViewOhos>& view,
|
||||
return;
|
||||
}
|
||||
container->SetCurPointerEvent(pointerEvent);
|
||||
if (pointerEvent->GetSourceType() == MMI::PointerEvent::SOURCE_TYPE_JOYSTICK) {
|
||||
view->ProcessNonPointerAxisEvent(pointerEvent);
|
||||
}
|
||||
|
||||
if (pointerEvent->GetSourceType() == MMI::PointerEvent::SOURCE_TYPE_MOUSE) {
|
||||
int32_t toolType = MMI::PointerEvent::TOOL_TYPE_MOUSE;
|
||||
@ -252,6 +258,12 @@ void AceViewOhos::RegisterKeyEventCallback(KeyEventCallback&& callback)
|
||||
keyEventCallback_ = std::move(callback);
|
||||
}
|
||||
|
||||
void AceViewOhos::RegisterNonPointerEventCallback(NonPointerEventCallback&& callback)
|
||||
{
|
||||
ACE_DCHECK(callback);
|
||||
nonPointerEventCallback_ = std::move(callback);
|
||||
}
|
||||
|
||||
void AceViewOhos::RegisterMouseEventCallback(MouseEventCallback&& callback)
|
||||
{
|
||||
ACE_DCHECK(callback);
|
||||
@ -307,7 +319,7 @@ void AceViewOhos::ProcessDragEvent(const std::shared_ptr<MMI::PointerEvent>& poi
|
||||
const RefPtr<OHOS::Ace::NG::FrameNode>& node)
|
||||
{
|
||||
DragEventAction action;
|
||||
PointerEvent event;
|
||||
DragPointerEvent event;
|
||||
ConvertPointerEvent(pointerEvent, event);
|
||||
CHECK_NULL_VOID(dragEventCallback_);
|
||||
int32_t orgAction = pointerEvent->GetPointerAction();
|
||||
@ -341,7 +353,7 @@ void AceViewOhos::ProcessDragEvent(int32_t x, int32_t y, const DragEventAction&
|
||||
const RefPtr<OHOS::Ace::NG::FrameNode>& node)
|
||||
{
|
||||
CHECK_NULL_VOID(dragEventCallback_);
|
||||
dragEventCallback_(PointerEvent(x, y), action, node);
|
||||
dragEventCallback_(DragPointerEvent(x, y), action, node);
|
||||
}
|
||||
|
||||
void AceViewOhos::ProcessMouseEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
@ -408,11 +420,19 @@ void AceViewOhos::ProcessAxisEvent(const std::shared_ptr<MMI::PointerEvent>& poi
|
||||
|
||||
bool AceViewOhos::ProcessKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool isPreIme)
|
||||
{
|
||||
CHECK_NULL_RETURN(keyEventCallback_, false);
|
||||
CHECK_NULL_RETURN(nonPointerEventCallback_, false);
|
||||
KeyEvent event;
|
||||
ConvertKeyEvent(keyEvent, event);
|
||||
event.isPreIme = isPreIme;
|
||||
return keyEventCallback_(event);
|
||||
return nonPointerEventCallback_(event);
|
||||
}
|
||||
|
||||
bool AceViewOhos::ProcessNonPointerAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
|
||||
{
|
||||
CHECK_NULL_RETURN(nonPointerEventCallback_, false);
|
||||
NG::NonPointerAxisEvent event;
|
||||
ConvertNonPointerAxisEvent(pointerEvent, event);
|
||||
return nonPointerEventCallback_(event);
|
||||
}
|
||||
|
||||
const void* AceViewOhos::GetNativeWindowById(uint64_t textureId)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "core/common/thread_model_impl.h"
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
#include "core/event/key_event_recognizer.h"
|
||||
#include "core/event/non_pointer_event.h"
|
||||
|
||||
namespace OHOS::Ace::Platform {
|
||||
|
||||
@ -67,6 +68,7 @@ public:
|
||||
void RegisterTouchEventCallback(TouchEventCallback&& callback) override;
|
||||
void RegisterDragEventCallback(DragEventCallBack&& callback) override;
|
||||
void RegisterKeyEventCallback(KeyEventCallback&& callback) override;
|
||||
void RegisterNonPointerEventCallback(NonPointerEventCallback&& callback) override;
|
||||
void RegisterMouseEventCallback(MouseEventCallback&& callback) override;
|
||||
void RegisterAxisEventCallback(AxisEventCallback&& callback) override;
|
||||
void RegisterRotationEventCallback(RotationEventCallBack&& callback) override;
|
||||
@ -87,6 +89,8 @@ public:
|
||||
|
||||
bool ProcessKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool isPreIme);
|
||||
|
||||
bool ProcessNonPointerAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
|
||||
|
||||
bool ProcessRotationEvent(float rotationValue);
|
||||
|
||||
void ProcessDragEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent,
|
||||
@ -240,6 +244,7 @@ private:
|
||||
int32_t instanceId_ = -1;
|
||||
RefPtr<PlatformResRegister> resRegister_;
|
||||
KeyEventCallback keyEventCallback_;
|
||||
NonPointerEventCallback nonPointerEventCallback_;
|
||||
KeyEventRecognizer keyEventRecognizer_;
|
||||
// mark the touch event's state, HORIZONTAL_STATE: the event should send to platform, VERTICAL_STATE: should not
|
||||
enum class EventState { INITIAL_STATE, HORIZONTAL_STATE, VERTICAL_STATE };
|
||||
|
@ -191,7 +191,7 @@ void DialogContainer::InitializeDragEventCallback()
|
||||
{
|
||||
ACE_DCHECK(aceView_ && taskExecutor_ && pipelineContext_);
|
||||
auto&& dragEventCallback = [context = pipelineContext_, id = instanceId_](
|
||||
const PointerEvent& pointerEvent, const DragEventAction& action,
|
||||
const DragPointerEvent& pointerEvent, const DragEventAction& action,
|
||||
const RefPtr<OHOS::Ace::NG::FrameNode>& node) {
|
||||
ContainerScope scope(id);
|
||||
context->GetTaskExecutor()->PostTask(
|
||||
|
@ -381,6 +381,27 @@ void GetAxisEventAction(int32_t action, AxisEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void GetNonPointerAxisEventAction(int32_t action, NG::NonPointerAxisEvent& event)
|
||||
{
|
||||
switch (action) {
|
||||
case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_BEGIN:
|
||||
event.action = AxisAction::BEGIN;
|
||||
break;
|
||||
case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_UPDATE:
|
||||
event.action = AxisAction::UPDATE;
|
||||
break;
|
||||
case OHOS::MMI::PointerEvent::POINTER_ACTION_AXIS_END:
|
||||
event.action = AxisAction::END;
|
||||
break;
|
||||
case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
|
||||
event.action = AxisAction::CANCEL;
|
||||
break;
|
||||
default:
|
||||
event.action = AxisAction::NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, AxisEvent& event)
|
||||
{
|
||||
int32_t pointerID = pointerEvent->GetPointerId();
|
||||
@ -463,7 +484,46 @@ void ConvertKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, KeyEvent& e
|
||||
event.numLock = keyEvent->GetFunctionKey(MMI::KeyEvent::NUM_LOCK_FUNCTION_KEY);
|
||||
}
|
||||
|
||||
void GetPointerEventAction(int32_t action, PointerEvent& event)
|
||||
void ConvertNonPointerAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, NG::NonPointerAxisEvent& event)
|
||||
{
|
||||
int32_t pointerID = pointerEvent->GetPointerId();
|
||||
MMI::PointerEvent::PointerItem item;
|
||||
bool ret = pointerEvent->GetPointerItem(pointerID, item);
|
||||
if (!ret) {
|
||||
LOGE("get pointer: %{public}d item failed.", pointerID);
|
||||
return;
|
||||
}
|
||||
|
||||
event.id = item.GetPointerId();
|
||||
event.absXValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_X);
|
||||
event.absYValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_Y);
|
||||
event.absZValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_Z);
|
||||
event.absRzValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_RZ);
|
||||
event.absHat0XValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_HAT0X);
|
||||
event.absHat0YValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_HAT0Y);
|
||||
event.absBrakeValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_BRAKE);
|
||||
event.absGasValue = pointerEvent->GetAxisValue(OHOS::MMI::PointerEvent::AxisType::AXIS_TYPE_ABS_GAS);
|
||||
int32_t orgAction = pointerEvent->GetPointerAction();
|
||||
GetNonPointerAxisEventAction(orgAction, event);
|
||||
int32_t orgDevice = pointerEvent->GetSourceType();
|
||||
GetEventDevice(orgDevice, event);
|
||||
event.sourceTool = GetSourceTool(item.GetToolType());
|
||||
event.pointerEvent = pointerEvent;
|
||||
event.originalId = item.GetOriginPointerId();
|
||||
event.deviceId = pointerEvent->GetDeviceId();
|
||||
|
||||
std::chrono::microseconds microseconds(pointerEvent->GetActionTime());
|
||||
TimeStamp time(microseconds);
|
||||
event.time = time;
|
||||
event.touchEventId = pointerEvent->GetId();
|
||||
event.targetDisplayId = pointerEvent->GetTargetDisplayId();
|
||||
event.pressedCodes.clear();
|
||||
for (const auto& curCode : pointerEvent->GetPressedKeys()) {
|
||||
event.pressedCodes.emplace_back(static_cast<KeyCode>(curCode));
|
||||
}
|
||||
}
|
||||
|
||||
void GetPointerEventAction(int32_t action, DragPointerEvent& event)
|
||||
{
|
||||
switch (action) {
|
||||
case OHOS::MMI::PointerEvent::POINTER_ACTION_CANCEL:
|
||||
@ -519,7 +579,7 @@ bool GetPointerEventToolType(const std::shared_ptr<MMI::PointerEvent>& pointerEv
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, PointerEvent& event)
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, DragPointerEvent& event)
|
||||
{
|
||||
event.rawPointerEvent = pointerEvent;
|
||||
event.pointerEventId = pointerEvent->GetId();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "core/event/axis_event.h"
|
||||
#include "core/event/key_event.h"
|
||||
#include "core/event/mouse_event.h"
|
||||
#include "core/event/non_pointer_axis_event.h"
|
||||
#include "core/event/touch_event.h"
|
||||
#include "core/event/pointer_event.h"
|
||||
|
||||
@ -91,7 +92,9 @@ void ConvertAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, Ax
|
||||
|
||||
void ConvertKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, KeyEvent& event);
|
||||
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, PointerEvent& event);
|
||||
void ConvertNonPointerAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, NG::NonPointerAxisEvent& event);
|
||||
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, DragPointerEvent& event);
|
||||
|
||||
void LogPointInfo(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, int32_t instanceId);
|
||||
|
||||
|
@ -55,7 +55,9 @@ public:
|
||||
ACE_DCHECK(callback);
|
||||
keyEventCallback_ = std::move(callback);
|
||||
}
|
||||
|
||||
|
||||
void RegisterNonPointerEventCallback(NonPointerEventCallback&& callback) override {}
|
||||
|
||||
void RegisterMouseEventCallback(MouseEventCallback&& callback) override
|
||||
{
|
||||
ACE_DCHECK(callback);
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
virtual void RegisterTouchEventCallback(TouchEventCallback&& callback) = 0;
|
||||
virtual void RegisterDragEventCallback(DragEventCallBack&& callback) = 0;
|
||||
virtual void RegisterKeyEventCallback(KeyEventCallback&& callback) = 0;
|
||||
virtual void RegisterNonPointerEventCallback(NonPointerEventCallback&& callback) = 0;
|
||||
virtual void RegisterMouseEventCallback(MouseEventCallback&& callback) = 0;
|
||||
virtual void RegisterAxisEventCallback(AxisEventCallback&& callback) = 0;
|
||||
virtual void RegisterRotationEventCallback(RotationEventCallBack&& callback) = 0;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "core/components_ng/pattern/app_bar/app_bar_view.h"
|
||||
#include "core/components_ng/pattern/navigation/navigation_route.h"
|
||||
#include "core/components_ng/pattern/navigator/navigator_event_hub.h"
|
||||
#include "core/event/non_pointer_event.h"
|
||||
#include "core/event/pointer_event.h"
|
||||
#include "core/pipeline/pipeline_base.h"
|
||||
|
||||
@ -59,13 +60,14 @@ using PageTask = std::function<void()>;
|
||||
using TouchEventCallback = std::function<void(const TouchEvent&, const std::function<void()>&,
|
||||
const RefPtr<NG::FrameNode>&)>;
|
||||
using KeyEventCallback = std::function<bool(const KeyEvent&)>;
|
||||
using NonPointerEventCallback = std::function<bool(const NonPointerEvent&)>;
|
||||
using MouseEventCallback = std::function<void(const MouseEvent&, const std::function<void()>&,
|
||||
const RefPtr<NG::FrameNode>&)>;
|
||||
using AxisEventCallback = std::function<void(const AxisEvent&, const std::function<void()>&,
|
||||
const RefPtr<NG::FrameNode>&)>;
|
||||
using RotationEventCallBack = std::function<bool(const RotationEvent&)>;
|
||||
using CardViewPositionCallBack = std::function<void(int id, float offsetX, float offsetY)>;
|
||||
using DragEventCallBack = std::function<void(const PointerEvent&, const DragEventAction&,
|
||||
using DragEventCallBack = std::function<void(const DragPointerEvent&, const DragEventAction&,
|
||||
const RefPtr<NG::FrameNode>&)>;
|
||||
using StopDragCallback = std::function<void()>;
|
||||
|
||||
|
@ -2347,10 +2347,10 @@ void EventManager::FalsifyCancelEventAndDispatch(const TouchEvent& touchPoint, b
|
||||
bool EventManager::GetResampleTouchEvent(const std::vector<TouchEvent>& history,
|
||||
const std::vector<TouchEvent>& current, uint64_t nanoTimeStamp, TouchEvent& newTouchEvent)
|
||||
{
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
auto newScreenXy = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), nanoTimeStamp, true);
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
auto newScreenXy = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), nanoTimeStamp, true);
|
||||
newTouchEvent = GetLatestPoint(current, nanoTimeStamp);
|
||||
bool ret = false;
|
||||
if (newXy.x != 0 && newXy.y != 0) {
|
||||
@ -2403,10 +2403,10 @@ TouchEvent EventManager::GetLatestPoint(const std::vector<TouchEvent>& current,
|
||||
MouseEvent EventManager::GetResampleMouseEvent(
|
||||
const std::vector<MouseEvent>& history, const std::vector<MouseEvent>& current, uint64_t nanoTimeStamp)
|
||||
{
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
auto newScreenXy = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), nanoTimeStamp, true);
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
auto newScreenXy = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), nanoTimeStamp, true);
|
||||
MouseEvent newMouseEvent = GetMouseLatestPoint(current, nanoTimeStamp);
|
||||
if (newXy.x != 0 && newXy.y != 0) {
|
||||
newMouseEvent.x = newXy.x;
|
||||
@ -2451,12 +2451,12 @@ MouseEvent EventManager::GetMouseLatestPoint(const std::vector<MouseEvent>& curr
|
||||
return result;
|
||||
}
|
||||
|
||||
PointerEvent EventManager::GetResamplePointerEvent(const std::vector<PointerEvent>& history,
|
||||
const std::vector<PointerEvent>& current, uint64_t nanoTimeStamp)
|
||||
DragPointerEvent EventManager::GetResamplePointerEvent(const std::vector<DragPointerEvent>& history,
|
||||
const std::vector<DragPointerEvent>& current, uint64_t nanoTimeStamp)
|
||||
{
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
PointerEvent newPointerEvent = GetPointerLatestPoint(current, nanoTimeStamp);
|
||||
auto newXy = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), nanoTimeStamp, false);
|
||||
DragPointerEvent newPointerEvent = GetPointerLatestPoint(current, nanoTimeStamp);
|
||||
|
||||
if (newXy.x != 0 && newXy.y != 0) {
|
||||
newPointerEvent.x = newXy.x;
|
||||
@ -2468,10 +2468,10 @@ PointerEvent EventManager::GetResamplePointerEvent(const std::vector<PointerEven
|
||||
return newPointerEvent;
|
||||
}
|
||||
|
||||
PointerEvent EventManager::GetPointerLatestPoint(const std::vector<PointerEvent>& current,
|
||||
DragPointerEvent EventManager::GetPointerLatestPoint(const std::vector<DragPointerEvent>& current,
|
||||
uint64_t nanoTimeStamp)
|
||||
{
|
||||
PointerEvent result;
|
||||
DragPointerEvent result;
|
||||
uint64_t gap = UINT64_MAX;
|
||||
for (auto iter = current.begin(); iter != current.end(); iter++) {
|
||||
uint64_t timeStamp = static_cast<uint64_t>(iter->time.time_since_epoch().count());
|
||||
|
@ -184,10 +184,10 @@ public:
|
||||
|
||||
TouchEvent GetLatestPoint(const std::vector<TouchEvent>& current, uint64_t nanoTimeStamp);
|
||||
|
||||
PointerEvent GetResamplePointerEvent(const std::vector<PointerEvent>& history,
|
||||
const std::vector<PointerEvent>& current, uint64_t nanoTimeStamp);
|
||||
DragPointerEvent GetResamplePointerEvent(const std::vector<DragPointerEvent>& history,
|
||||
const std::vector<DragPointerEvent>& current, uint64_t nanoTimeStamp);
|
||||
|
||||
PointerEvent GetPointerLatestPoint(const std::vector<PointerEvent>& current, uint64_t nanoTimeStamp);
|
||||
DragPointerEvent GetPointerLatestPoint(const std::vector<DragPointerEvent>& current, uint64_t nanoTimeStamp);
|
||||
|
||||
MouseEvent GetResampleMouseEvent(
|
||||
const std::vector<MouseEvent>& history, const std::vector<MouseEvent>& current, uint64_t nanoTimeStamp);
|
||||
|
@ -114,6 +114,48 @@ enum class TouchType : size_t {
|
||||
PROXIMITY_OUT,
|
||||
UNKNOWN,
|
||||
};
|
||||
|
||||
enum class UIInputEventType {
|
||||
NONE = 0,
|
||||
TOUCH,
|
||||
AXIS,
|
||||
KEY,
|
||||
NON_POINTER_AXIS,
|
||||
};
|
||||
|
||||
enum class KeyIntention : int32_t {
|
||||
INTENTION_UNKNOWN = -1,
|
||||
INTENTION_UP = 1,
|
||||
INTENTION_DOWN = 2,
|
||||
INTENTION_LEFT = 3,
|
||||
INTENTION_RIGHT = 4,
|
||||
INTENTION_SELECT = 5,
|
||||
INTENTION_ESCAPE = 6,
|
||||
INTENTION_BACK = 7,
|
||||
INTENTION_FORWARD = 8,
|
||||
INTENTION_MENU = 9,
|
||||
INTENTION_HOME = 10,
|
||||
INTENTION_PAGE_UP = 11,
|
||||
INTENTION_PAGE_DOWN = 12,
|
||||
INTENTION_ZOOM_OUT = 13,
|
||||
INTENTION_ZOOM_IN = 14,
|
||||
|
||||
INTENTION_MEDIA_PLAY_PAUSE = 100,
|
||||
INTENTION_MEDIA_FAST_FORWARD = 101,
|
||||
INTENTION_MEDIA_FAST_REWIND = 102,
|
||||
INTENTION_MEDIA_FAST_PLAYBACK = 103,
|
||||
INTENTION_MEDIA_NEXT = 104,
|
||||
INTENTION_MEDIA_PREVIOUS = 105,
|
||||
INTENTION_MEDIA_MUTE = 106,
|
||||
INTENTION_VOLUTE_UP = 107,
|
||||
INTENTION_VOLUTE_DOWN = 108,
|
||||
|
||||
INTENTION_CALL = 200,
|
||||
INTENTION_ENDCALL = 201,
|
||||
INTENTION_REJECTCALL = 202,
|
||||
|
||||
INTENTION_CAMERA = 300,
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_EVENT_CONSTANTS_H
|
||||
|
@ -886,7 +886,7 @@ void GestureEventHub::OnDragStart(const GestureEvent& info, const RefPtr<Pipelin
|
||||
dragDropProxy_->OnDragStart(info, extraInfoLimited, GetFrameNode());
|
||||
if (!dragDropManager->IsDraggingPressed(info.GetPointerId())) {
|
||||
dragDropManager->OnDragEnd(
|
||||
PointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY()), extraInfoLimited);
|
||||
DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY()), extraInfoLimited);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ void DragDropFuncWrapper::SetDraggingPointerAndPressedState(int32_t currentPoint
|
||||
}
|
||||
|
||||
void DragDropFuncWrapper::DecideWhetherToStopDragging(
|
||||
const PointerEvent& pointerEvent, const std::string& extraParams, int32_t currentPointerId, int32_t containerId)
|
||||
const DragPointerEvent& pointerEvent, const std::string& extraParams, int32_t currentPointerId, int32_t containerId)
|
||||
{
|
||||
auto pipelineContext = PipelineContext::GetContextByContainerId(containerId);
|
||||
CHECK_NULL_VOID(pipelineContext);
|
||||
|
@ -30,7 +30,7 @@ class ACE_FORCE_EXPORT DragDropFuncWrapper {
|
||||
public:
|
||||
static int32_t StartDragAction(std::shared_ptr<OHOS::Ace::NG::ArkUIInteralDragAction> dragAction);
|
||||
static void SetDraggingPointerAndPressedState(int32_t currentPointerId, int32_t containerId);
|
||||
static void DecideWhetherToStopDragging(const PointerEvent& pointerEvent,
|
||||
static void DecideWhetherToStopDragging(const DragPointerEvent& pointerEvent,
|
||||
const std::string& extraParams, int32_t currentPointerId, int32_t containerId);
|
||||
static void UpdateDragPreviewOptionsFromModifier(
|
||||
std::function<void(WeakPtr<FrameNode>)> applyOnNodeSync, DragPreviewOption& options);
|
||||
|
@ -583,7 +583,7 @@ void DragDropManager::OnDragStart(const Point& point)
|
||||
}
|
||||
|
||||
void DragDropManager::PrintDragFrameNode(
|
||||
const OHOS::Ace::PointerEvent& pointerEvent, const RefPtr<FrameNode>& dragFrameNode)
|
||||
const OHOS::Ace::DragPointerEvent& pointerEvent, const RefPtr<FrameNode>& dragFrameNode)
|
||||
{
|
||||
CHECK_NULL_VOID(dragFrameNode);
|
||||
auto container = Container::Current();
|
||||
@ -651,7 +651,7 @@ void DragDropManager::TransDragWindowToDragFwk(int32_t windowContainerId)
|
||||
dampingOverflowCount_ = 0;
|
||||
}
|
||||
|
||||
void DragDropManager::OnDragMoveOut(const PointerEvent& pointerEvent)
|
||||
void DragDropManager::OnDragMoveOut(const DragPointerEvent& pointerEvent)
|
||||
{
|
||||
Point point = pointerEvent.GetPoint();
|
||||
auto container = Container::Current();
|
||||
@ -690,7 +690,7 @@ bool DragDropManager::isDistanceLimited(const Point& point)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DragDropManager::isTimeLimited(const PointerEvent& pointerEvent, const Point& point)
|
||||
bool DragDropManager::isTimeLimited(const DragPointerEvent& pointerEvent, const Point& point)
|
||||
{
|
||||
uint64_t currentTimeStamp = static_cast<uint64_t>(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(pointerEvent.time.time_since_epoch()).count());
|
||||
@ -701,7 +701,7 @@ bool DragDropManager::isTimeLimited(const PointerEvent& pointerEvent, const Poin
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DragDropManager::ReachMoveLimit(const PointerEvent& pointerEvent, const Point& point)
|
||||
bool DragDropManager::ReachMoveLimit(const DragPointerEvent& pointerEvent, const Point& point)
|
||||
{
|
||||
if (pointerEvent.sourceTool == SourceTool::MOUSE) {
|
||||
if (isTimeLimited(pointerEvent, point) && isDistanceLimited(point)) {
|
||||
@ -711,7 +711,7 @@ bool DragDropManager::ReachMoveLimit(const PointerEvent& pointerEvent, const Poi
|
||||
return false;
|
||||
}
|
||||
|
||||
void DragDropManager::HandleOnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void DragDropManager::HandleOnDragMove(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& dragFrameNode)
|
||||
{
|
||||
CHECK_NULL_VOID(dragFrameNode);
|
||||
@ -727,7 +727,7 @@ void DragDropManager::HandleOnDragMove(const PointerEvent& pointerEvent, const s
|
||||
preTargetFrameNode_ = dragFrameNode;
|
||||
}
|
||||
|
||||
void DragDropManager::OnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void DragDropManager::OnDragMove(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& node)
|
||||
{
|
||||
RequireSummaryIfNecessary(pointerEvent);
|
||||
@ -838,13 +838,13 @@ void DragDropManager::ResetDraggingStatus(const TouchEvent& touchPoint)
|
||||
SetDraggingPressedState(false);
|
||||
}
|
||||
if (!IsItemDragging() && IsDragging() && IsSameDraggingPointer(touchPoint.id)) {
|
||||
OnDragEnd(
|
||||
PointerEvent(touchPoint.touchEventId, touchPoint.x, touchPoint.y, touchPoint.screenX, touchPoint.screenY),
|
||||
OnDragEnd(DragPointerEvent(
|
||||
touchPoint.touchEventId, touchPoint.x, touchPoint.y, touchPoint.screenX, touchPoint.screenY),
|
||||
"");
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropManager::HandleOnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void DragDropManager::HandleOnDragEnd(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& dragFrameNode)
|
||||
{
|
||||
CHECK_NULL_VOID(dragFrameNode);
|
||||
@ -880,7 +880,7 @@ void DragDropManager::HandleOnDragEnd(const PointerEvent& pointerEvent, const st
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropManager::OnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void DragDropManager::OnDragEnd(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& node)
|
||||
{
|
||||
Point point = pointerEvent.GetPoint();
|
||||
@ -961,7 +961,7 @@ void DragDropManager::RequestDragSummaryInfoAndPrivilege()
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropManager::DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent,
|
||||
void DragDropManager::DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent,
|
||||
const RefPtr<UnifiedData>& unifiedData, const std::string& udKey)
|
||||
{
|
||||
RefPtr<OHOS::Ace::DragEvent> event = AceType::MakeRefPtr<OHOS::Ace::DragEvent>();
|
||||
@ -995,8 +995,8 @@ RefPtr<UnifiedData> DragDropManager::RequestUDMFDataWithUDKey(const std::string&
|
||||
return udData;
|
||||
}
|
||||
|
||||
void DragDropManager::TryGetDataBackGround(
|
||||
const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, const std::string& udKey, int32_t count)
|
||||
void DragDropManager::TryGetDataBackGround(const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent,
|
||||
const std::string& udKey, int32_t count)
|
||||
{
|
||||
auto pipeline = PipelineContext::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
@ -1034,7 +1034,7 @@ void DragDropManager::TryGetDataBackGround(
|
||||
}
|
||||
|
||||
bool DragDropManager::CheckRemoteData(
|
||||
const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, const std::string& udKey)
|
||||
const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent, const std::string& udKey)
|
||||
{
|
||||
if (udKey.empty()) {
|
||||
DragDropBehaviorReporter::GetInstance().UpdateDragStopResult(DragStopResult::GET_UDKEY_FAIL);
|
||||
@ -1054,7 +1054,7 @@ bool DragDropManager::CheckRemoteData(
|
||||
}
|
||||
|
||||
void DragDropManager::OnDragDrop(RefPtr<OHOS::Ace::DragEvent>& event, const RefPtr<FrameNode>& dragFrameNode,
|
||||
const OHOS::Ace::PointerEvent& pointerEvent)
|
||||
const OHOS::Ace::DragPointerEvent& pointerEvent)
|
||||
{
|
||||
auto point = pointerEvent.GetPoint();
|
||||
CHECK_NULL_VOID(dragFrameNode);
|
||||
@ -1213,7 +1213,7 @@ void DragDropManager::FireOnDragEventWithDragType(const RefPtr<EventHub>& eventH
|
||||
}
|
||||
|
||||
void DragDropManager::FireOnDragEvent(
|
||||
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent,
|
||||
const RefPtr<FrameNode>& frameNode, const DragPointerEvent& pointerEvent,
|
||||
DragEventType type, const std::string& extraInfo)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
@ -1589,7 +1589,8 @@ void DragDropManager::UpdateNotifyDragEvent(
|
||||
}
|
||||
}
|
||||
|
||||
void DragDropManager::UpdateDragEvent(RefPtr<OHOS::Ace::DragEvent>& event, const OHOS::Ace::PointerEvent& pointerEvent)
|
||||
void DragDropManager::UpdateDragEvent(
|
||||
RefPtr<OHOS::Ace::DragEvent>& event, const OHOS::Ace::DragPointerEvent& pointerEvent)
|
||||
{
|
||||
auto point = pointerEvent.GetPoint();
|
||||
event->SetX(point.GetX());
|
||||
@ -1685,7 +1686,7 @@ bool DragDropManager::GetDragPreviewInfo(const RefPtr<OverlayManager>& overlayMa
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DragDropManager::IsNeedDoDragMoveAnimate(const PointerEvent& pointerEvent)
|
||||
bool DragDropManager::IsNeedDoDragMoveAnimate(const DragPointerEvent& pointerEvent)
|
||||
{
|
||||
if (!(IsNeedDisplayInSubwindow() || isDragWithContextMenu_) || isDragFwkShow_) {
|
||||
return false;
|
||||
@ -1785,7 +1786,7 @@ float DragDropManager::GetCurrentDistance(float x, float y)
|
||||
return std::max(distance, gatherDistance);
|
||||
}
|
||||
|
||||
void DragDropManager::DoDragMoveAnimate(const PointerEvent& pointerEvent)
|
||||
void DragDropManager::DoDragMoveAnimate(const DragPointerEvent& pointerEvent)
|
||||
{
|
||||
bool needDoDragMoveAnimate = IsNeedDoDragMoveAnimate(pointerEvent);
|
||||
if (!needDoDragMoveAnimate) {
|
||||
@ -2158,7 +2159,7 @@ void DragDropManager::ResetDragDrop(int32_t windowId, const Point& point)
|
||||
}
|
||||
|
||||
void DragDropManager::FireOnDragLeave(
|
||||
const RefPtr<FrameNode>& preTargetFrameNode, const PointerEvent& pointerEvent, const std::string& extraInfo)
|
||||
const RefPtr<FrameNode>& preTargetFrameNode, const DragPointerEvent& pointerEvent, const std::string& extraInfo)
|
||||
{
|
||||
auto point = pointerEvent.GetPoint();
|
||||
if (preTargetFrameNode) {
|
||||
@ -2211,7 +2212,7 @@ bool DragDropManager::IsUIExtensionComponent(const RefPtr<NG::UINode>& node)
|
||||
}
|
||||
|
||||
void DragDropManager::HandleUIExtensionDragEvent(
|
||||
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent, DragEventType type)
|
||||
const RefPtr<FrameNode>& frameNode, const DragPointerEvent& pointerEvent, DragEventType type)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
auto pattern = frameNode->GetPattern<Pattern>();
|
||||
@ -2343,12 +2344,12 @@ bool DragDropManager::IsAllAnimationFinished()
|
||||
return currentAnimationCnt_ == 0;
|
||||
}
|
||||
|
||||
bool DragDropManager::CheckIsNewDrag(const PointerEvent& pointerEvent) const
|
||||
bool DragDropManager::CheckIsNewDrag(const DragPointerEvent& pointerEvent) const
|
||||
{
|
||||
return (pointerEvent.pullId != -1) && (pointerEvent.pullId != currentPullId_);
|
||||
}
|
||||
|
||||
void DragDropManager::RequireSummaryIfNecessary(const PointerEvent& pointerEvent)
|
||||
void DragDropManager::RequireSummaryIfNecessary(const DragPointerEvent& pointerEvent)
|
||||
{
|
||||
if (CheckIsNewDrag(pointerEvent)) {
|
||||
currentPullId_ = pointerEvent.pullId;
|
||||
|
@ -94,30 +94,30 @@ public:
|
||||
void UpdateItemDragPosition(int32_t globalX, int32_t globalY);
|
||||
void OnDragStart(const Point& point);
|
||||
void OnDragStart(const Point& point, const RefPtr<FrameNode>& frameNode);
|
||||
void OnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void OnDragMove(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& node = nullptr);
|
||||
void OnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void OnDragEnd(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& node = nullptr);
|
||||
void HandleOnDragMove(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void HandleOnDragMove(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& dragFrameNode);
|
||||
void HandleOnDragEnd(const PointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
void HandleOnDragEnd(const DragPointerEvent& pointerEvent, const std::string& extraInfo,
|
||||
const RefPtr<FrameNode>& dragFrameNode);
|
||||
void ResetDragEndOption(
|
||||
const DragNotifyMsgCore& notifyMessage, const RefPtr<OHOS::Ace::DragEvent>& dragEvent, int32_t currentId);
|
||||
void DoDragReset();
|
||||
void DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent,
|
||||
void DoDropAction(const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent,
|
||||
const RefPtr<UnifiedData>& unifiedData, const std::string& udKey);
|
||||
void RequestDragSummaryInfoAndPrivilege();
|
||||
RefPtr<UnifiedData> RequestUDMFDataWithUDKey(const std::string& udKey);
|
||||
void TryGetDataBackGround(
|
||||
const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent,
|
||||
const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent,
|
||||
const std::string& udKey, int32_t count = 0);
|
||||
void OnDragDrop(RefPtr<OHOS::Ace::DragEvent>& event, const RefPtr<FrameNode>& dragFrameNode,
|
||||
const OHOS::Ace::PointerEvent& pointerEvent);
|
||||
const OHOS::Ace::DragPointerEvent& pointerEvent);
|
||||
void ResetDragDropStatus(const Point& point, const DragDropRet& dragDropRet, int32_t windowId);
|
||||
bool CheckRemoteData(
|
||||
const RefPtr<FrameNode>& dragFrameNode, const PointerEvent& pointerEvent, const std::string& udKey);
|
||||
void OnDragMoveOut(const PointerEvent& pointerEvent);
|
||||
const RefPtr<FrameNode>& dragFrameNode, const DragPointerEvent& pointerEvent, const std::string& udKey);
|
||||
void OnDragMoveOut(const DragPointerEvent& pointerEvent);
|
||||
void OnTextDragEnd(float globalX, float globalY, const std::string& extraInfo);
|
||||
void onDragCancel();
|
||||
void OnItemDragStart(float globalX, float globalY, const RefPtr<FrameNode>& frameNode);
|
||||
@ -152,13 +152,13 @@ public:
|
||||
void HideDragPreviewOverlay();
|
||||
void HideDragPreviewWindow(int32_t containerId);
|
||||
bool IsMSDPDragging() const;
|
||||
void UpdateDragEvent(RefPtr<OHOS::Ace::DragEvent>& event, const OHOS::Ace::PointerEvent& pointerEvent);
|
||||
void UpdateDragEvent(RefPtr<OHOS::Ace::DragEvent>& event, const OHOS::Ace::DragPointerEvent& pointerEvent);
|
||||
void UpdateNotifyDragEvent(
|
||||
RefPtr<NotifyDragEvent>& notifyEvent, const Point& point, const DragEventType dragEventType);
|
||||
bool CheckDragDropProxy(int64_t id) const;
|
||||
void NotifyEnterTextEditorArea();
|
||||
void FireOnEditableTextComponent(const RefPtr<FrameNode>& frameNode, DragEventType type);
|
||||
void FireOnDragLeave(const RefPtr<FrameNode>& preTargetFrameNode_, const PointerEvent& pointerEven,
|
||||
void FireOnDragLeave(const RefPtr<FrameNode>& preTargetFrameNode_, const DragPointerEvent& pointerEven,
|
||||
const std::string& extraInfo);
|
||||
|
||||
bool IsWindowConsumed() const
|
||||
@ -313,7 +313,7 @@ public:
|
||||
RefPtr<FrameNode> textNode { nullptr };
|
||||
} DragPreviewInfo;
|
||||
bool IsNeedScaleDragPreview();
|
||||
void DoDragMoveAnimate(const PointerEvent& pointerEvent);
|
||||
void DoDragMoveAnimate(const DragPointerEvent& pointerEvent);
|
||||
void DragMoveAnimation(const Offset& newOffset, const RefPtr<OverlayManager>& overlayManager, Point point);
|
||||
void DoDragStartAnimation(const RefPtr<OverlayManager>& overlayManager,
|
||||
const GestureEvent& event, const RefPtr<GestureEventHub>& gestureHub, bool isSubwindowOverlay = false);
|
||||
@ -378,12 +378,12 @@ public:
|
||||
void PushGatherPixelMap(const RefPtr<PixelMap>& pixelMap);
|
||||
void GetGatherPixelMap(DragDataCore& dragData, float scale, float previewWidth = 0.0f, float previewHeight = 0.0f);
|
||||
|
||||
const PointerEvent& GetDragDropPointerEvent() const
|
||||
const DragPointerEvent& GetDragDropPointerEvent() const
|
||||
{
|
||||
return dragDropPointerEvent_;
|
||||
}
|
||||
|
||||
void SetDragDropPointerEvent(const PointerEvent& dragDropPointerEvent)
|
||||
void SetDragDropPointerEvent(const DragPointerEvent& dragDropPointerEvent)
|
||||
{
|
||||
dragDropPointerEvent_ = dragDropPointerEvent;
|
||||
}
|
||||
@ -463,9 +463,9 @@ public:
|
||||
menuWrapperNode_ = frameNode;
|
||||
}
|
||||
|
||||
bool CheckIsNewDrag(const PointerEvent& pointerEvent) const;
|
||||
bool CheckIsNewDrag(const DragPointerEvent& pointerEvent) const;
|
||||
|
||||
void RequireSummaryIfNecessary(const PointerEvent& pointerEvent);
|
||||
void RequireSummaryIfNecessary(const DragPointerEvent& pointerEvent);
|
||||
|
||||
inline void ResetPullId()
|
||||
{
|
||||
@ -486,12 +486,12 @@ private:
|
||||
void UpdateDragPreviewScale();
|
||||
bool GetDragPreviewInfo(const OHOS::Ace::RefPtr<OHOS::Ace::NG::OverlayManager>& overlayManager,
|
||||
DragPreviewInfo& dragPreviewInfo, const RefPtr<GestureEventHub>& gestureHub);
|
||||
bool IsNeedDoDragMoveAnimate(const PointerEvent& pointerEvent);
|
||||
bool IsNeedDoDragMoveAnimate(const DragPointerEvent& pointerEvent);
|
||||
const RefPtr<NG::OverlayManager> GetDragAnimationOverlayManager(int32_t containerId);
|
||||
RefPtr<FrameNode> FindDragFrameNodeByPosition(float globalX, float globalY,
|
||||
const RefPtr<FrameNode>& node = nullptr);
|
||||
void FireOnDragEvent(
|
||||
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent,
|
||||
const RefPtr<FrameNode>& frameNode, const DragPointerEvent& pointerEvent,
|
||||
DragEventType type, const std::string& extraInfo);
|
||||
void FireOnItemDragEvent(const RefPtr<FrameNode>& frameNode, DragType dragType,
|
||||
const ItemDragInfo& itemDragInfo, DragEventType type, int32_t draggedIndex, int32_t insertIndex = 0);
|
||||
@ -502,7 +502,7 @@ private:
|
||||
RefPtr<FrameNode> CreateDragRootNode(const RefPtr<UINode>& customNode);
|
||||
void ClearVelocityInfo();
|
||||
void UpdateVelocityTrackerPoint(const Point& point, bool isEnd = false);
|
||||
void PrintDragFrameNode(const OHOS::Ace::PointerEvent& pointerEvent, const RefPtr<FrameNode>& dragFrameNode);
|
||||
void PrintDragFrameNode(const OHOS::Ace::DragPointerEvent& pointerEvent, const RefPtr<FrameNode>& dragFrameNode);
|
||||
void PrintGridDragFrameNode(const float globalX, const float globalY, const RefPtr<FrameNode>& dragFrameNode);
|
||||
void FireOnDragEventWithDragType(const RefPtr<EventHub>& eventHub, DragEventType type,
|
||||
RefPtr<OHOS::Ace::DragEvent>& event, const std::string& extraParams);
|
||||
@ -511,12 +511,12 @@ private:
|
||||
void TransDragWindowToDragFwk(int32_t windowContainerId);
|
||||
void ResetDragDrop(int32_t windowId, const Point& point);
|
||||
bool isDistanceLimited(const Point& point);
|
||||
bool isTimeLimited(const PointerEvent& pointerEvent, const Point& point);
|
||||
bool ReachMoveLimit(const PointerEvent& pointerEvent, const Point& point);
|
||||
bool isTimeLimited(const DragPointerEvent& pointerEvent, const Point& point);
|
||||
bool ReachMoveLimit(const DragPointerEvent& pointerEvent, const Point& point);
|
||||
bool IsUIExtensionShowPlaceholder(const RefPtr<NG::UINode>& node);
|
||||
bool IsUIExtensionComponent(const RefPtr<NG::UINode>& node);
|
||||
void HandleUIExtensionDragEvent(
|
||||
const RefPtr<FrameNode>& frameNode, const PointerEvent& pointerEvent, DragEventType type);
|
||||
const RefPtr<FrameNode>& frameNode, const DragPointerEvent& pointerEvent, DragEventType type);
|
||||
int32_t GetWindowId();
|
||||
void AddItemDrag(const RefPtr<FrameNode>& frameNode, const RefPtr<EventHub>& eventHub);
|
||||
void RemoveItemDrag();
|
||||
@ -564,7 +564,7 @@ private:
|
||||
PreDragStatus preDragStatus_ = PreDragStatus::ACTION_DETECTING_STATUS;
|
||||
Rect previewRect_ { -1, -1, -1, -1 };
|
||||
DragPreviewInfo info_;
|
||||
PointerEvent dragDropPointerEvent_;
|
||||
DragPointerEvent dragDropPointerEvent_;
|
||||
bool isDragFwkShow_ = true;
|
||||
OffsetF pixelMapOffset_;
|
||||
OffsetF curPointerOffset_;
|
||||
|
@ -39,7 +39,7 @@ void DragDropProxy::OnDragStart(
|
||||
|
||||
auto point = Point(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(), info.GetScreenLocation().GetX(),
|
||||
info.GetScreenLocation().GetY());
|
||||
auto pointerEvent = PointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
auto pointerEvent = DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY());
|
||||
manager->OnDragStart(point, frameNode);
|
||||
manager->OnDragMove(pointerEvent, extraInfo);
|
||||
@ -55,7 +55,7 @@ void DragDropProxy::OnDragMove(const GestureEvent& info)
|
||||
CHECK_NULL_VOID(manager->CheckDragDropProxy(id_));
|
||||
|
||||
std::string extraInfo = manager->GetExtraInfo();
|
||||
manager->OnDragMove(PointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
manager->OnDragMove(DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()), extraInfo);
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void DragDropProxy::OnDragEnd(const GestureEvent& info, bool isTextDragEnd)
|
||||
manager->OnTextDragEnd(static_cast<float>(info.GetGlobalPoint().GetX()),
|
||||
static_cast<float>(info.GetGlobalPoint().GetY()), extraInfo);
|
||||
} else {
|
||||
manager->OnDragEnd(PointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
manager->OnDragEnd(DragPointerEvent(info.GetGlobalPoint().GetX(), info.GetGlobalPoint().GetY(),
|
||||
info.GetScreenLocation().GetX(), info.GetScreenLocation().GetY()), extraInfo);
|
||||
}
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ public:
|
||||
virtual void HandleOnDragStatusCallback(
|
||||
const DragEventType& dragEventType, const RefPtr<NotifyDragEvent>& notifyDragEvent) {};
|
||||
|
||||
virtual void HandleDragEvent(const PointerEvent& info) {};
|
||||
virtual void HandleDragEvent(const DragPointerEvent& info) {};
|
||||
virtual void OnLanguageConfigurationUpdate() {}
|
||||
virtual void OnColorConfigurationUpdate() {}
|
||||
virtual void OnDirectionConfigurationUpdate() {}
|
||||
|
@ -234,7 +234,7 @@ void PlatformPattern::HandleHoverEvent(bool isHover)
|
||||
DispatchPointerEvent(lastPointerEvent_);
|
||||
}
|
||||
|
||||
void PlatformPattern::HandleDragEvent(const PointerEvent& info)
|
||||
void PlatformPattern::HandleDragEvent(const DragPointerEvent& info)
|
||||
{
|
||||
const auto pointerEvent = info.rawPointerEvent;
|
||||
CHECK_NULL_VOID(pointerEvent);
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override;
|
||||
FocusPattern GetFocusPattern() const override;
|
||||
void OnMountToParentDone() override;
|
||||
void HandleDragEvent(const PointerEvent& info) override;
|
||||
void HandleDragEvent(const DragPointerEvent& info) override;
|
||||
|
||||
virtual void SetOnErrorCallback(const std::function<void(int32_t code,
|
||||
const std::string& name, const std::string& message)>&& callback);
|
||||
|
@ -954,7 +954,7 @@ void UIExtensionPattern::DispatchDisplayArea(bool isForce)
|
||||
}
|
||||
}
|
||||
|
||||
void UIExtensionPattern::HandleDragEvent(const PointerEvent& info)
|
||||
void UIExtensionPattern::HandleDragEvent(const DragPointerEvent& info)
|
||||
{
|
||||
auto pointerEvent = info.rawPointerEvent;
|
||||
CHECK_NULL_VOID(pointerEvent);
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
|
||||
void OnConnect();
|
||||
void OnDisconnect(bool isAbnormal);
|
||||
void HandleDragEvent(const PointerEvent& info) override;
|
||||
void HandleDragEvent(const DragPointerEvent& info) override;
|
||||
|
||||
void SetModalOnDestroy(const std::function<void()>&& callback);
|
||||
void FireModalOnDestroy();
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
#include "base/geometry/offset.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "core/components_ng/event/event_constants.h"
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/event/key_event.h"
|
||||
|
||||
namespace OHOS::MMI {
|
||||
class PointerEvent;
|
||||
@ -56,20 +56,29 @@ enum class AxisAction : int32_t {
|
||||
END,
|
||||
CANCEL,
|
||||
};
|
||||
|
||||
struct UIInputEvent {
|
||||
virtual ~UIInputEvent() = default;
|
||||
explicit UIInputEvent(float x = {}, float y = {}, float screenX = {},
|
||||
TimeStamp time;
|
||||
UIInputEventType eventType = UIInputEventType::NONE;
|
||||
};
|
||||
|
||||
|
||||
struct PointerEvent : public UIInputEvent {
|
||||
virtual ~PointerEvent() = default;
|
||||
explicit PointerEvent(float x = {}, float y = {}, float screenX = {},
|
||||
float screenY = {}, TimeStamp time = {})
|
||||
:x(x), y(y), screenX(screenX), screenY(screenY), time(time)
|
||||
{}
|
||||
:x(x), y(y), screenX(screenX), screenY(screenY)
|
||||
{
|
||||
this->time = time;
|
||||
}
|
||||
float x = {};
|
||||
float y = {};
|
||||
float screenX = {};
|
||||
float screenY = {};
|
||||
TimeStamp time = {};
|
||||
};
|
||||
|
||||
struct AxisEvent final : public UIInputEvent {
|
||||
struct AxisEvent final : public PointerEvent {
|
||||
~AxisEvent() = default;
|
||||
int32_t id = 0;
|
||||
|
||||
@ -94,18 +103,22 @@ struct AxisEvent final : public UIInputEvent {
|
||||
int32_t originalId = 0;
|
||||
bool isInjected = false;
|
||||
|
||||
AxisEvent() {}
|
||||
AxisEvent()
|
||||
{
|
||||
eventType = UIInputEventType::AXIS;
|
||||
}
|
||||
|
||||
AxisEvent(int32_t id, float x, float y, float screenX, float screenY, double verticalAxis, double horizontalAxis,
|
||||
double pinchAxisScale, double rotateAxisAngle, bool isRotationEvent, AxisAction action, TimeStamp timestamp,
|
||||
int64_t deviceId, SourceType sourceType, SourceTool sourceTool, std::shared_ptr<MMI::PointerEvent> pointerEvent,
|
||||
std::vector<KeyCode> pressedCodes, int32_t targetDisplayId, int32_t originalId, bool isInjected)
|
||||
: UIInputEvent(x, y, screenX, screenY, timestamp), id(id), verticalAxis(verticalAxis),
|
||||
: PointerEvent(x, y, screenX, screenY, timestamp), id(id), verticalAxis(verticalAxis),
|
||||
horizontalAxis(horizontalAxis), pinchAxisScale(pinchAxisScale), rotateAxisAngle(rotateAxisAngle),
|
||||
isRotationEvent(isRotationEvent), action(action), deviceId(deviceId), sourceType(sourceType),
|
||||
sourceTool(sourceTool), pointerEvent(std::move(pointerEvent)), pressedCodes(pressedCodes),
|
||||
targetDisplayId(targetDisplayId), originalId(originalId), isInjected(isInjected)
|
||||
{
|
||||
eventType = UIInputEventType::AXIS;
|
||||
}
|
||||
|
||||
AxisEvent CreateScaleEvent(float scale) const
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <map>
|
||||
|
||||
#include "core/event/ace_events.h"
|
||||
#include "core/event/non_pointer_event.h"
|
||||
|
||||
namespace OHOS::MMI {
|
||||
class KeyEvent;
|
||||
@ -437,52 +438,26 @@ enum class KeyAction : int32_t {
|
||||
CLICK = 3,
|
||||
};
|
||||
|
||||
enum class KeyIntention : int32_t {
|
||||
INTENTION_UNKNOWN = -1,
|
||||
INTENTION_UP = 1,
|
||||
INTENTION_DOWN = 2,
|
||||
INTENTION_LEFT = 3,
|
||||
INTENTION_RIGHT = 4,
|
||||
INTENTION_SELECT = 5,
|
||||
INTENTION_ESCAPE = 6,
|
||||
INTENTION_BACK = 7,
|
||||
INTENTION_FORWARD = 8,
|
||||
INTENTION_MENU = 9,
|
||||
INTENTION_HOME = 10,
|
||||
INTENTION_PAGE_UP = 11,
|
||||
INTENTION_PAGE_DOWN = 12,
|
||||
INTENTION_ZOOM_OUT = 13,
|
||||
INTENTION_ZOOM_IN = 14,
|
||||
|
||||
INTENTION_MEDIA_PLAY_PAUSE = 100,
|
||||
INTENTION_MEDIA_FAST_FORWARD = 101,
|
||||
INTENTION_MEDIA_FAST_REWIND = 102,
|
||||
INTENTION_MEDIA_FAST_PLAYBACK = 103,
|
||||
INTENTION_MEDIA_NEXT = 104,
|
||||
INTENTION_MEDIA_PREVIOUS = 105,
|
||||
INTENTION_MEDIA_MUTE = 106,
|
||||
INTENTION_VOLUTE_UP = 107,
|
||||
INTENTION_VOLUTE_DOWN = 108,
|
||||
|
||||
INTENTION_CALL = 200,
|
||||
INTENTION_ENDCALL = 201,
|
||||
INTENTION_REJECTCALL = 202,
|
||||
|
||||
INTENTION_CAMERA = 300,
|
||||
};
|
||||
|
||||
constexpr int32_t ASCII_START_UPPER_CASE_LETTER = 65;
|
||||
constexpr int32_t ASCII_START_LOWER_CASE_LETTER = 97;
|
||||
|
||||
ACE_FORCE_EXPORT const char* KeyToString(int32_t code);
|
||||
|
||||
struct KeyEvent final {
|
||||
KeyEvent() = default;
|
||||
KeyEvent(KeyCode code, KeyAction action, std::vector<KeyCode> pressedCodes, int32_t repeatTime, TimeStamp timeStamp,
|
||||
int32_t metaKey, int64_t deviceId, SourceType sourceType, std::vector<uint8_t> enhanceData)
|
||||
: code(code), action(action), pressedCodes(std::move(pressedCodes)), repeatTime(repeatTime),
|
||||
timeStamp(timeStamp), metaKey(metaKey), deviceId(deviceId), sourceType(sourceType), enhanceData(enhanceData)
|
||||
{}
|
||||
struct KeyEvent final : public NonPointerEvent {
|
||||
KeyEvent()
|
||||
{
|
||||
eventType = UIInputEventType::KEY;
|
||||
}
|
||||
KeyEvent(KeyCode code, KeyAction action, std::vector<KeyCode> pressedCodes, int32_t repeatTimeStamp,
|
||||
TimeStamp timeStamp, int32_t metaKey, int64_t deviceIdNum, SourceType source, std::vector<uint8_t> enhanceData)
|
||||
: code(code), action(action), pressedCodes(std::move(pressedCodes)), timeStamp(timeStamp), metaKey(metaKey),
|
||||
enhanceData(enhanceData)
|
||||
{
|
||||
repeatTime = repeatTimeStamp;
|
||||
deviceId = deviceIdNum;
|
||||
sourceType = source;
|
||||
eventType = UIInputEventType::KEY;
|
||||
}
|
||||
KeyEvent(KeyCode code, KeyAction action, int32_t repeatTime = 0, int64_t timeStamp = 0, int64_t deviceId = 0,
|
||||
SourceType sourceType = SourceType::KEYBOARD)
|
||||
{
|
||||
@ -512,7 +487,7 @@ struct KeyEvent final {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool IsExactlyKey(const std::vector<KeyCode>& expectCodes) const
|
||||
{
|
||||
auto pressedKeysCnt = pressedCodes.size();
|
||||
@ -584,11 +559,8 @@ struct KeyEvent final {
|
||||
// When the key is held down for a long period of time, it will be accumulated once in a while.
|
||||
// Note that In the long press scene, you will receive a DOWN and an extra LONG_PRESS event. If you only want to
|
||||
// identify the click event, you can use CLICK event.
|
||||
int32_t repeatTime = 0;
|
||||
TimeStamp timeStamp;
|
||||
int32_t metaKey = 0;
|
||||
int64_t deviceId = 0;
|
||||
SourceType sourceType { SourceType::NONE };
|
||||
KeyIntention keyIntention { KeyIntention::INTENTION_UNKNOWN };
|
||||
bool enableCapsLock = false;
|
||||
bool isPreIme = false;
|
||||
|
@ -86,7 +86,7 @@ enum class HoverEffectType : int32_t {
|
||||
UNKNOWN,
|
||||
};
|
||||
|
||||
struct MouseEvent final : public UIInputEvent {
|
||||
struct MouseEvent final : public PointerEvent {
|
||||
int32_t id = 0;
|
||||
float z = 0.0f;
|
||||
float deltaX = 0.0f;
|
||||
|
145
frameworks/core/event/non_pointer_axis_event.h
Normal file
145
frameworks/core/event/non_pointer_axis_event.h
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_AXIS_EVENT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_AXIS_EVENT_H
|
||||
|
||||
#include "core/event/non_pointer_event.h"
|
||||
#include "core/components_ng/event/event_constants.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
struct NonPointerAxisEvent final : public NonPointerEvent {
|
||||
int32_t id = 0;
|
||||
AxisAction action = AxisAction::NONE;
|
||||
SourceTool sourceTool = SourceTool::UNKNOWN;
|
||||
std::shared_ptr<MMI::PointerEvent> pointerEvent;
|
||||
int32_t touchEventId = 0;
|
||||
std::vector<KeyCode> pressedCodes;
|
||||
int32_t targetDisplayId = 0;
|
||||
int32_t originalId = 0;
|
||||
float absXValue = 0.0f;
|
||||
float absYValue = 0.0f;
|
||||
float absZValue = 0.0f;
|
||||
float absRzValue = 0.0f;
|
||||
float absHat0XValue = 0.0f;
|
||||
float absHat0YValue = 0.0f;
|
||||
float absBrakeValue = 0.0f;
|
||||
float absGasValue = 0.0f;
|
||||
~NonPointerAxisEvent() = default;
|
||||
NonPointerAxisEvent()
|
||||
{
|
||||
eventType = UIInputEventType::NON_POINTER_AXIS;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetId(int32_t id)
|
||||
{
|
||||
this->id = id;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAction(AxisAction action)
|
||||
{
|
||||
this->action = action;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetSourceTool(SourceTool sourceTool)
|
||||
{
|
||||
this->sourceTool = sourceTool;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetPointerEvent(std::shared_ptr<MMI::PointerEvent> pointerEvent)
|
||||
{
|
||||
this->pointerEvent = std::move(pointerEvent);
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetTouchEventId(int32_t touchEventId)
|
||||
{
|
||||
this->touchEventId = touchEventId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetPressedKeyCodes(const std::vector<KeyCode>& pressedCodes)
|
||||
{
|
||||
this->pressedCodes = pressedCodes;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetTargetDisplayId(int32_t targetDisplayId)
|
||||
{
|
||||
this->targetDisplayId = targetDisplayId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetOriginalId(int32_t originalId)
|
||||
{
|
||||
this->originalId = originalId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsXValue(float absXValue)
|
||||
{
|
||||
this->absXValue = absXValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsYValue(float absYValue)
|
||||
{
|
||||
this->absYValue = absYValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsZValue(float absZValue)
|
||||
{
|
||||
this->absZValue = absZValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsRzValue(float absRzValue)
|
||||
{
|
||||
this->absRzValue = absRzValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsHat0XValue(float absHat0XValue)
|
||||
{
|
||||
this->absHat0XValue = absHat0XValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsHat0YValue(float absHat0YValue)
|
||||
{
|
||||
this->absHat0YValue = absHat0YValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsBrakeValue(float absBrakeValue)
|
||||
{
|
||||
this->absBrakeValue = absBrakeValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerAxisEvent& SetAbsGasValue(float absGasValue)
|
||||
{
|
||||
this->absGasValue = absGasValue;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace::NG
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_AXIS_EVENT_H
|
53
frameworks/core/event/non_pointer_event.h
Normal file
53
frameworks/core/event/non_pointer_event.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_EVENT_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_EVENT_H
|
||||
|
||||
#include "core/event/axis_event.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
struct NonPointerEvent : public PointerEvent {
|
||||
// When the key is held down for a long period of time, it will be accumulated once in a while.
|
||||
// Note that In the long press scene, you will receive a DOWN and an extra LONG_PRESS event. If you only want to
|
||||
// identify the click event, you can use CLICK event.
|
||||
int32_t repeatTime = 0;
|
||||
int64_t deviceId = 0;
|
||||
SourceType sourceType { SourceType::NONE };
|
||||
~NonPointerEvent() = default;
|
||||
NonPointerEvent() {}
|
||||
|
||||
NonPointerEvent& SetRepeatTime(int32_t repeatTime)
|
||||
{
|
||||
this->repeatTime = repeatTime;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerEvent& SetDeviceId(int64_t deviceId)
|
||||
{
|
||||
this->deviceId = deviceId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
NonPointerEvent& SetSourceType(SourceType sourceType)
|
||||
{
|
||||
this->sourceType = sourceType;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_EVENT_NON_POINTER_EVENT_H
|
@ -56,7 +56,7 @@ enum class PointerAction : int32_t {
|
||||
POINTER_ACTION_ROTATE_END = 22,
|
||||
};
|
||||
|
||||
struct PointerEvent final : public UIInputEvent {
|
||||
struct DragPointerEvent final : public PointerEvent {
|
||||
int32_t pointerEventId = 0;
|
||||
int32_t pointerId = 0;
|
||||
int32_t pullId = -1;
|
||||
@ -74,16 +74,16 @@ struct PointerEvent final : public UIInputEvent {
|
||||
std::shared_ptr<MMI::PointerEvent> rawPointerEvent;
|
||||
std::vector<KeyCode> pressedKeyCodes_;
|
||||
PointerAction action = PointerAction::UNKNOWN;
|
||||
std::vector<PointerEvent> history;
|
||||
std::vector<DragPointerEvent> history;
|
||||
|
||||
PointerEvent() = default;
|
||||
PointerEvent(float x, float y)
|
||||
:UIInputEvent(x, y)
|
||||
DragPointerEvent() = default;
|
||||
DragPointerEvent(float x, float y)
|
||||
:PointerEvent(x, y)
|
||||
{}
|
||||
PointerEvent(int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY)
|
||||
DragPointerEvent(int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY)
|
||||
: windowX(windowX), windowY(windowY), displayX(displayX), displayY(displayY)
|
||||
{}
|
||||
PointerEvent(int32_t pointerEventId, int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY)
|
||||
DragPointerEvent(int32_t pointerEventId, int32_t windowX, int32_t windowY, int32_t displayX, int32_t displayY)
|
||||
: pointerEventId(pointerEventId), windowX(windowX), windowY(windowY), displayX(displayX), displayY(displayY)
|
||||
{}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "core/event/resample_algo.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
AvgPoint ResampleAlgo::GetAvgPoint(const std::vector<UIInputEvent>&& events,
|
||||
AvgPoint ResampleAlgo::GetAvgPoint(const std::vector<PointerEvent>&& events,
|
||||
bool isScreen)
|
||||
{
|
||||
float avgX = 0.0f;
|
||||
@ -90,8 +90,8 @@ ResamplePoint ResampleAlgo::LinearInterpolation(const AvgPoint& history, const A
|
||||
return {};
|
||||
}
|
||||
|
||||
ResamplePoint ResampleAlgo::GetResampleCoord(const std::vector<UIInputEvent>&& history,
|
||||
const std::vector<UIInputEvent>&& current, uint64_t nanoTimeStamp,
|
||||
ResamplePoint ResampleAlgo::GetResampleCoord(const std::vector<PointerEvent>&& history,
|
||||
const std::vector<PointerEvent>&& current, uint64_t nanoTimeStamp,
|
||||
bool isScreen)
|
||||
{
|
||||
if (history.empty() || current.empty()) {
|
||||
|
@ -68,14 +68,14 @@ public:
|
||||
|
||||
~ResampleAlgo() = delete;
|
||||
|
||||
static AvgPoint GetAvgPoint(const std::vector<UIInputEvent>&& events,
|
||||
static AvgPoint GetAvgPoint(const std::vector<PointerEvent>&& events,
|
||||
bool isScreen);
|
||||
|
||||
static ResamplePoint LinearInterpolation(const AvgPoint& history, const AvgPoint& current,
|
||||
uint64_t nanoTimeStamp);
|
||||
|
||||
static ResamplePoint GetResampleCoord(const std::vector<UIInputEvent>&& history,
|
||||
const std::vector<UIInputEvent>&& current, uint64_t nanoTimeStamp,
|
||||
static ResamplePoint GetResampleCoord(const std::vector<PointerEvent>&& history,
|
||||
const std::vector<PointerEvent>&& current, uint64_t nanoTimeStamp,
|
||||
bool isScreen);
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -205,6 +205,7 @@ TouchEvent TouchEvent::CloneWith(float scale, float offsetX, float offsetY, std:
|
||||
event.isPrivacyMode = isPrivacyMode;
|
||||
event.inputXDeltaSlope = inputXDeltaSlope;
|
||||
event.inputYDeltaSlope = inputYDeltaSlope;
|
||||
event.eventType = UIInputEventType::TOUCH;
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ struct TouchPoint final {
|
||||
/**
|
||||
* @brief TouchEvent contains the active change point and a list of all touch points.
|
||||
*/
|
||||
struct TouchEvent final : public UIInputEvent {
|
||||
struct TouchEvent final : public PointerEvent {
|
||||
~TouchEvent() = default;
|
||||
// the active changed point info
|
||||
// The ID is used to identify the point of contact between the finger and the screen. Different fingers have
|
||||
@ -93,7 +93,10 @@ struct TouchEvent final : public UIInputEvent {
|
||||
float inputXDeltaSlope = 0.0f;
|
||||
float inputYDeltaSlope = 0.0f;
|
||||
|
||||
TouchEvent() {}
|
||||
TouchEvent()
|
||||
{
|
||||
eventType = UIInputEventType::TOUCH;
|
||||
}
|
||||
TouchEvent& SetId(int32_t id);
|
||||
TouchEvent& SetX(float x);
|
||||
TouchEvent& SetY(float y);
|
||||
|
@ -192,6 +192,10 @@ public:
|
||||
// if return false, then this event needs platform to handle it.
|
||||
virtual bool OnKeyEvent(const KeyEvent& event) = 0;
|
||||
|
||||
// Called by container when key event received.
|
||||
// if return false, then this event needs platform to handle it.
|
||||
virtual bool OnNonPointerEvent(const NonPointerEvent& event) = 0;
|
||||
|
||||
// Called by view when mouse event received.
|
||||
virtual void OnMouseEvent(const MouseEvent& event) = 0;
|
||||
|
||||
@ -214,7 +218,7 @@ public:
|
||||
virtual void OnVsyncEvent(uint64_t nanoTimestamp, uint32_t frameCount);
|
||||
|
||||
// Called by viewr
|
||||
virtual void OnDragEvent(const PointerEvent& pointerEvent, DragEventAction action,
|
||||
virtual void OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
|
||||
const RefPtr<NG::FrameNode>& node = nullptr) = 0;
|
||||
|
||||
// Called by view when idle event.
|
||||
|
@ -3044,7 +3044,7 @@ void PipelineContext::ProcessDragEventEnd(
|
||||
SetInitRenderNode(nullptr);
|
||||
}
|
||||
|
||||
void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAction action,
|
||||
void PipelineContext::OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
|
||||
const RefPtr<NG::FrameNode>& node)
|
||||
{
|
||||
if (!clipboard_) {
|
||||
|
@ -222,6 +222,8 @@ public:
|
||||
// if return false, then this event needs platform to handle it.
|
||||
bool OnKeyEvent(const KeyEvent& event) override;
|
||||
|
||||
bool OnNonPointerEvent(const NonPointerEvent& event) override { return false; }
|
||||
|
||||
// Called by view when mouse event received.
|
||||
void OnMouseEvent(const MouseEvent& event) override;
|
||||
|
||||
@ -663,7 +665,7 @@ public:
|
||||
}
|
||||
void StartSystemDrag(const std::string& str, const RefPtr<PixelMap>& pixmap);
|
||||
void InitDragListener();
|
||||
void OnDragEvent(const PointerEvent& pointerEvent, DragEventAction action,
|
||||
void OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
|
||||
const RefPtr<NG::FrameNode>& node = nullptr) override;
|
||||
void SetPreTargetRenderNode(const RefPtr<DragDropEvent>& preDragDropNode);
|
||||
const RefPtr<DragDropEvent>& GetPreTargetRenderNode() const;
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
|
||||
#include "base/subwindow/subwindow_manager.h"
|
||||
#include "core/components_ng/event/event_constants.h"
|
||||
#include "core/event/key_event.h"
|
||||
|
||||
#ifdef ENABLE_ROSEN_BACKEND
|
||||
#include "render_service_client/core/transaction/rs_transaction.h"
|
||||
@ -408,11 +410,11 @@ void PipelineContext::FlushDragEvents()
|
||||
void PipelineContext::FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
std::string extraInfo,
|
||||
const RefPtr<FrameNode>& node,
|
||||
const std::list<PointerEvent>& pointEvent)
|
||||
const std::list<DragPointerEvent>& pointEvent)
|
||||
{
|
||||
std::unordered_map<int, PointerEvent> idToPoints;
|
||||
std::unordered_map<int, DragPointerEvent> idToPoints;
|
||||
bool needInterpolation = true;
|
||||
std::unordered_map<int32_t, PointerEvent> newIdPoints;
|
||||
std::unordered_map<int32_t, DragPointerEvent> newIdPoints;
|
||||
for (auto iter = pointEvent.rbegin(); iter != pointEvent.rend(); ++iter) {
|
||||
idToPoints.emplace(iter->pointerId, *iter);
|
||||
idToPoints[iter->pointerId].history.insert(idToPoints[iter->pointerId].history.begin(), *iter);
|
||||
@ -432,7 +434,7 @@ void PipelineContext::FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
static_cast<uint64_t>(stamp), targetTimeStamp);
|
||||
continue;
|
||||
}
|
||||
PointerEvent newPointerEvent = eventManager_->GetResamplePointerEvent(
|
||||
DragPointerEvent newPointerEvent = eventManager_->GetResamplePointerEvent(
|
||||
historyPointsEventById_[idIter.first], idIter.second.history, targetTimeStamp);
|
||||
if (newPointerEvent.x != 0 && newPointerEvent.y != 0) {
|
||||
newIdPoints[idIter.first] = newPointerEvent;
|
||||
@ -444,13 +446,13 @@ void PipelineContext::FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
}
|
||||
|
||||
void PipelineContext::FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
std::unordered_map<int32_t, PointerEvent> newIdPoints,
|
||||
std::unordered_map<int32_t, DragPointerEvent> newIdPoints,
|
||||
std::string& extraInfo,
|
||||
std::unordered_map<int, PointerEvent> &idToPoints,
|
||||
std::unordered_map<int, DragPointerEvent> &idToPoints,
|
||||
const RefPtr<FrameNode>& node)
|
||||
{
|
||||
std::map<RefPtr<FrameNode>, std::vector<PointerEvent>> nodeToPointEvent;
|
||||
std::list<PointerEvent> dragPoint;
|
||||
std::map<RefPtr<FrameNode>, std::vector<DragPointerEvent>> nodeToPointEvent;
|
||||
std::list<DragPointerEvent> dragPoint;
|
||||
for (const auto& iter : idToPoints) {
|
||||
auto lastDispatchTime = eventManager_->GetLastDispatchTime();
|
||||
lastDispatchTime[iter.first] = GetVsyncTime();
|
||||
@ -3487,6 +3489,15 @@ void PipelineContext::ReDispatch(KeyEvent& keyEvent)
|
||||
eventManager_->DispatchKeyEventNG(keyEvent, curEntryFocusViewFrame);
|
||||
}
|
||||
|
||||
bool PipelineContext::OnNonPointerEvent(const NonPointerEvent& event)
|
||||
{
|
||||
if (event.eventType == UIInputEventType::KEY) {
|
||||
const KeyEvent* keyEvent = static_cast<const KeyEvent*>(&event);
|
||||
return OnKeyEvent(*keyEvent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PipelineContext::OnKeyEvent(const KeyEvent& event)
|
||||
{
|
||||
CHECK_NULL_RETURN(eventManager_, false);
|
||||
@ -3510,7 +3521,7 @@ bool PipelineContext::OnKeyEvent(const KeyEvent& event)
|
||||
auto manager = GetDragDropManager();
|
||||
if (manager && manager->IsMSDPDragging()) {
|
||||
manager->SetIsDragCancel(true);
|
||||
manager->OnDragEnd(PointerEvent(0, 0), "");
|
||||
manager->OnDragEnd(DragPointerEvent(0, 0), "");
|
||||
manager->SetIsDragCancel(false);
|
||||
return true;
|
||||
}
|
||||
@ -4160,7 +4171,7 @@ void PipelineContext::RequireSummary()
|
||||
manager->RequireSummary();
|
||||
}
|
||||
|
||||
void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAction action,
|
||||
void PipelineContext::OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
|
||||
const RefPtr<NG::FrameNode>& node)
|
||||
{
|
||||
auto manager = GetDragDropManager();
|
||||
@ -4214,7 +4225,7 @@ void PipelineContext::OnDragEvent(const PointerEvent& pointerEvent, DragEventAct
|
||||
}
|
||||
}
|
||||
|
||||
void PipelineContext::CompensatePointerMoveEvent(const PointerEvent& event, const RefPtr<FrameNode>& node)
|
||||
void PipelineContext::CompensatePointerMoveEvent(const DragPointerEvent& event, const RefPtr<FrameNode>& node)
|
||||
{
|
||||
auto manager = GetDragDropManager();
|
||||
std::string extraInfo = manager->GetExtraInfo();
|
||||
@ -4225,7 +4236,7 @@ void PipelineContext::CompensatePointerMoveEvent(const PointerEvent& event, cons
|
||||
if (lastEventIter == nodeToPointEvent_.end() || lastEventIter->second.empty()) {
|
||||
return;
|
||||
}
|
||||
PointerEvent pointerEvent = lastEventIter->second.back();
|
||||
DragPointerEvent pointerEvent = lastEventIter->second.back();
|
||||
auto iter = eventManager_->GetLastDispatchTime().find(pointerEvent.pointerEventId);
|
||||
if (iter != eventManager_->GetLastDispatchTime().end()) {
|
||||
if (static_cast<uint64_t>(pointerEvent.time.time_since_epoch().count()) > iter->second) {
|
||||
@ -4235,11 +4246,11 @@ void PipelineContext::CompensatePointerMoveEvent(const PointerEvent& event, cons
|
||||
}
|
||||
|
||||
bool PipelineContext::CompensatePointerMoveEventFromUnhandledEvents(
|
||||
const PointerEvent& event, const RefPtr<FrameNode>& node)
|
||||
const DragPointerEvent& event, const RefPtr<FrameNode>& node)
|
||||
{
|
||||
auto manager = GetDragDropManager();
|
||||
std::string extraInfo = manager->GetExtraInfo();
|
||||
std::vector<PointerEvent> history;
|
||||
std::vector<DragPointerEvent> history;
|
||||
if (dragEvents_.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ public:
|
||||
// Called by container when key event received.
|
||||
// if return false, then this event needs platform to handle it.
|
||||
bool OnKeyEvent(const KeyEvent& event) override;
|
||||
bool OnNonPointerEvent(const NonPointerEvent& event) override;
|
||||
|
||||
// ReDispatch KeyEvent from Web process.
|
||||
void ReDispatch(KeyEvent& keyEvent);
|
||||
@ -199,11 +200,11 @@ public:
|
||||
void FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
std::string extraInfo,
|
||||
const RefPtr<FrameNode>& node,
|
||||
const std::list<PointerEvent>& pointEvent);
|
||||
const std::list<DragPointerEvent>& pointEvent);
|
||||
void FlushDragEvents(const RefPtr<DragDropManager>& manager,
|
||||
std::unordered_map<int32_t, PointerEvent> newIdPoints,
|
||||
std::unordered_map<int32_t, DragPointerEvent> newIdPoints,
|
||||
std::string& extraInfo,
|
||||
std::unordered_map<int, PointerEvent> &idToPoints,
|
||||
std::unordered_map<int, DragPointerEvent> &idToPoints,
|
||||
const RefPtr<FrameNode>& node);
|
||||
|
||||
// Called by view when axis event received.
|
||||
@ -216,7 +217,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnDragEvent(const PointerEvent& pointerEvent, DragEventAction action,
|
||||
void OnDragEvent(const DragPointerEvent& pointerEvent, DragEventAction action,
|
||||
const RefPtr<NG::FrameNode>& node = nullptr) override;
|
||||
|
||||
// Called by view when idle event.
|
||||
@ -1089,9 +1090,9 @@ private:
|
||||
|
||||
bool CompensateMouseMoveEventFromUnhandledEvents(const MouseEvent& event, const RefPtr<FrameNode>& node);
|
||||
|
||||
void CompensatePointerMoveEvent(const PointerEvent& event, const RefPtr<FrameNode>& node);
|
||||
void CompensatePointerMoveEvent(const DragPointerEvent& event, const RefPtr<FrameNode>& node);
|
||||
|
||||
bool CompensatePointerMoveEventFromUnhandledEvents(const PointerEvent& event, const RefPtr<FrameNode>& node);
|
||||
bool CompensatePointerMoveEventFromUnhandledEvents(const DragPointerEvent& event, const RefPtr<FrameNode>& node);
|
||||
|
||||
FrameInfo* GetCurrentFrameInfo(uint64_t recvTime, uint64_t timeStamp);
|
||||
|
||||
@ -1148,7 +1149,7 @@ private:
|
||||
|
||||
std::list<TouchEvent> touchEvents_;
|
||||
|
||||
std::map<RefPtr<FrameNode>, std::list<PointerEvent>> dragEvents_;
|
||||
std::map<RefPtr<FrameNode>, std::list<DragPointerEvent>> dragEvents_;
|
||||
std::map<RefPtr<FrameNode>, std::list<MouseEvent>> mouseEvents_;
|
||||
std::vector<std::function<void(const std::vector<std::string>&)>> dumpListeners_;
|
||||
|
||||
@ -1174,7 +1175,7 @@ private:
|
||||
std::unordered_set<int32_t> onAreaChangeNodeIds_;
|
||||
std::unordered_set<int32_t> onVisibleAreaChangeNodeIds_;
|
||||
std::unordered_map<int32_t, std::vector<MouseEvent>> historyMousePointsById_;
|
||||
std::unordered_map<int32_t, std::vector<PointerEvent>> historyPointsEventById_;
|
||||
std::unordered_map<int32_t, std::vector<DragPointerEvent>> historyPointsEventById_;
|
||||
RefPtr<AccessibilityManagerNG> accessibilityManagerNG_;
|
||||
RefPtr<StageManager> stageManager_;
|
||||
RefPtr<OverlayManager> overlayManager_;
|
||||
@ -1244,7 +1245,7 @@ private:
|
||||
RefPtr<PostEventManager> postEventManager_;
|
||||
|
||||
std::map<RefPtr<FrameNode>, std::vector<MouseEvent>> nodeToMousePoints_;
|
||||
std::map<RefPtr<FrameNode>, std::vector<PointerEvent>> nodeToPointEvent_;
|
||||
std::map<RefPtr<FrameNode>, std::vector<DragPointerEvent>> nodeToPointEvent_;
|
||||
std::vector<Ace::RectF> overlayNodePositions_;
|
||||
std::function<void(std::vector<Ace::RectF>)> overlayNodePositionUpdateCallback_;
|
||||
|
||||
|
@ -164,7 +164,7 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event)
|
||||
return touchEvent->timeStamp;
|
||||
}
|
||||
case TOUCH_EVENT_ID: {
|
||||
const auto* uiEvent = reinterpret_cast<const OHOS::Ace::UIInputEvent*>(event->inputEvent);
|
||||
const auto* uiEvent = reinterpret_cast<const OHOS::Ace::PointerEvent*>(event->inputEvent);
|
||||
if (!uiEvent) {
|
||||
LOGE("The parameter of OH_ArkUI_UIInputEvent_GetEventTime is invalid");
|
||||
return 0;
|
||||
@ -172,7 +172,7 @@ int64_t OH_ArkUI_UIInputEvent_GetEventTime(const ArkUI_UIInputEvent* event)
|
||||
return uiEvent->time.time_since_epoch().count();
|
||||
}
|
||||
case AXIS_EVENT_ID: {
|
||||
const auto* uiEvent = reinterpret_cast<const OHOS::Ace::UIInputEvent*>(event->inputEvent);
|
||||
const auto* uiEvent = reinterpret_cast<const OHOS::Ace::PointerEvent*>(event->inputEvent);
|
||||
if (!uiEvent) {
|
||||
LOGE("The parameter of OH_ArkUI_UIInputEvent_GetEventTime is invalid");
|
||||
return 0;
|
||||
|
@ -336,7 +336,7 @@ void PipelineContext::FlushTouchEvents() {}
|
||||
void PipelineContext::OnAxisEvent(const AxisEvent& event) {}
|
||||
|
||||
void PipelineContext::OnDragEvent(
|
||||
const PointerEvent& pointerEvent, DragEventAction action, const RefPtr<NG::FrameNode>& node)
|
||||
const DragPointerEvent& pointerEvent, DragEventAction action, const RefPtr<NG::FrameNode>& node)
|
||||
{}
|
||||
|
||||
void PipelineContext::OnIdle(int64_t deadline)
|
||||
@ -538,6 +538,11 @@ bool PipelineContext::OnKeyEvent(const KeyEvent& event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PipelineContext::OnNonPointerEvent(const NonPointerEvent& event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PipelineContext::RequestFocus(const std::string& targetNodeId, bool isSyncRequest)
|
||||
{
|
||||
return false;
|
||||
|
@ -234,7 +234,7 @@ HWTEST_F(AccessibilityManagerNgTestNg, AccessibilityManagerNgTest004, TestSize.L
|
||||
NG::PointF hoverPoint(x, y);
|
||||
std::string summary;
|
||||
std::string detail;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
|
||||
TimeStamp time;
|
||||
|
||||
|
@ -72,7 +72,7 @@ void DragDropFuncWrapperTestNgCoverage::TearDownTestCase()
|
||||
*/
|
||||
HWTEST_F(DragDropFuncWrapperTestNgCoverage, DragDropFuncWrapperTestNgCoverage001, TestSize.Level1)
|
||||
{
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
std::string extraParams = "test";
|
||||
int32_t currentPointerId = 1;
|
||||
int32_t containerId = 100;
|
||||
@ -96,7 +96,7 @@ HWTEST_F(DragDropFuncWrapperTestNgCoverage, DragDropFuncWrapperTestNgCoverage001
|
||||
*/
|
||||
HWTEST_F(DragDropFuncWrapperTestNgCoverage, DragDropFuncWrapperTestNgCoverage002, TestSize.Level1)
|
||||
{
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
std::string extraParams = "test";
|
||||
int32_t currentPointerId = 1;
|
||||
int32_t invalidContainerId = -1;
|
||||
|
@ -741,7 +741,7 @@ HWTEST_F(DragDropManagerTestNg, DragDropManagerTest013, TestSize.Level1)
|
||||
onDropInfo = EXTRA_INFO;
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -895,7 +895,7 @@ HWTEST_F(DragDropManagerTestNg, DragDropManagerTest017, TestSize.Level1)
|
||||
* @tc.steps: step3. call UpdateDragEvent.
|
||||
* @tc.expected: pipeline is not null.
|
||||
*/
|
||||
dragDropManager->UpdateDragEvent(event, PointerEvent(1, 1));
|
||||
dragDropManager->UpdateDragEvent(event, DragPointerEvent(1, 1));
|
||||
auto pipeline = PipelineContext::GetCurrentContext();
|
||||
ASSERT_NE(pipeline, nullptr);
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ HWTEST_F(DragDropManagerTestNg, DragDropManagerTest034, TestSize.Level1)
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
ASSERT_NE(dragDropManager, nullptr);
|
||||
|
||||
OHOS::Ace::PointerEvent point;
|
||||
OHOS::Ace::DragPointerEvent point;
|
||||
RefPtr<FrameNode> dragFrameNode = nullptr;
|
||||
dragDropManager->OnDragStart({ GLOBAL_X, GLOBAL_Y }, dragFrameNode);
|
||||
|
||||
|
@ -496,7 +496,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage014, TestSi
|
||||
* @tc.steps: step1. construct a DragDropManager
|
||||
*/
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
OHOS::Ace::PointerEvent point;
|
||||
OHOS::Ace::DragPointerEvent point;
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. call OnDragStart
|
||||
@ -574,7 +574,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage018, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 1000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
Point point(0, 0);
|
||||
EXPECT_FALSE(dragDropManager.isTimeLimited(pointerEvent, point));
|
||||
}
|
||||
@ -589,7 +589,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage019, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 1000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(1000); // 1000ms after preTimeStamp_
|
||||
Point point(0, 0);
|
||||
EXPECT_FALSE(dragDropManager.isTimeLimited(pointerEvent, point));
|
||||
@ -605,7 +605,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage020, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 1000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(2500); // 1500ms after preTimeStamp_
|
||||
Point point(0, 0);
|
||||
EXPECT_FALSE(dragDropManager.isTimeLimited(pointerEvent, point));
|
||||
@ -621,7 +621,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage021, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 1000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(1000); // Same as preTimeStamp_
|
||||
Point point(0, 0);
|
||||
EXPECT_FALSE(dragDropManager.isTimeLimited(pointerEvent, point));
|
||||
@ -637,7 +637,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage022, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 2000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(1500); // Less than preTimeStamp_
|
||||
Point point(0, 0);
|
||||
EXPECT_FALSE(dragDropManager.isTimeLimited(pointerEvent, point));
|
||||
@ -653,7 +653,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage023, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 2000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(2005);
|
||||
pointerEvent.sourceTool = SourceTool::MOUSE;
|
||||
dragDropManager.preMovePoint_ = Point(0, 0);
|
||||
@ -671,7 +671,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage024, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 2000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(1000);
|
||||
pointerEvent.sourceTool = SourceTool::MOUSE;
|
||||
dragDropManager.preMovePoint_ = Point(0, 0);
|
||||
@ -689,7 +689,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage025, TestSi
|
||||
{
|
||||
DragDropManager dragDropManager;
|
||||
dragDropManager.preTimeStamp_ = 2000;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
pointerEvent.time += std::chrono::milliseconds(2002);
|
||||
pointerEvent.sourceTool = SourceTool::MOUSE;
|
||||
dragDropManager.preMovePoint_ = Point(0, 0);
|
||||
@ -743,7 +743,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage026, TestSi
|
||||
auto parentNode = pipeline->GetRootElement();
|
||||
auto parentFrameNode = AceType::DynamicCast<FrameNode>(parentNode);
|
||||
auto children = parentFrameNode->GetFrameChildren();
|
||||
PointerEvent pointEvent(100, 100, 100, 100);
|
||||
DragPointerEvent pointEvent(100, 100, 100, 100);
|
||||
auto draggedNode = dragDropManager->draggedFrameNode_;
|
||||
auto preTargetNode = dragDropManager->preTargetFrameNode_;
|
||||
dragDropManager->isMouseDragged_ = true;
|
||||
@ -801,7 +801,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage027, TestSi
|
||||
auto parentNode = pipeline->GetRootElement();
|
||||
auto parentFrameNode = AceType::DynamicCast<FrameNode>(parentNode);
|
||||
auto children = parentFrameNode->GetFrameChildren();
|
||||
PointerEvent pointEvent(100, 100, 100, 100);
|
||||
DragPointerEvent pointEvent(100, 100, 100, 100);
|
||||
auto draggedNode = dragDropManager->draggedFrameNode_;
|
||||
auto preTargetNode = dragDropManager->preTargetFrameNode_;
|
||||
dragDropManager->isMouseDragged_ = true;
|
||||
@ -824,7 +824,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage028, TestSi
|
||||
* @tc.steps: step1. construct a DragDropManager
|
||||
*/
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
PointerEvent point(100, 100, 100, 100);
|
||||
DragPointerEvent point(100, 100, 100, 100);
|
||||
auto frameNodeNullId = ElementRegister::GetInstance()->MakeUniqueId();
|
||||
auto frameNodeNull = AceType::MakeRefPtr<FrameNode>("parent", frameNodeNullId, AceType::MakeRefPtr<Pattern>());
|
||||
|
||||
@ -866,7 +866,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage032, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
ASSERT_NE(dragDropManager, nullptr);
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
std::string remoteUdKey;
|
||||
auto result = dragDropManager->CheckRemoteData(frameNode, point, remoteUdKey);
|
||||
EXPECT_FALSE(result);
|
||||
@ -883,7 +883,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage033, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
ASSERT_NE(dragDropManager, nullptr);
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
std::string remoteUdKey = "abc";
|
||||
auto mockUdmfClient = static_cast<MockUdmfClient*>(UdmfClient::GetInstance());
|
||||
EXPECT_CALL(*mockUdmfClient, GetRemoteStatus(testing::_)).WillOnce(testing::Return(true));
|
||||
@ -953,7 +953,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage037, TestSi
|
||||
std::string remoteUdKey = "abc";
|
||||
RefPtr<UnifiedData> unifiedData = AceType::MakeRefPtr<MockUnifiedData>();
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
dragDropManager->DoDropAction(frameNode, point, unifiedData, remoteUdKey);
|
||||
EXPECT_NE(unifiedData, nullptr);
|
||||
}
|
||||
@ -970,7 +970,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage038, TestSi
|
||||
ASSERT_NE(dragDropManager, nullptr);
|
||||
std::string remoteUdKey;
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
dragDropManager->DoDropAction(frameNode, point, nullptr, remoteUdKey);
|
||||
EXPECT_NE(frameNode, nullptr);
|
||||
}
|
||||
@ -1196,7 +1196,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage048, TestSi
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
dragDropManager->isDragFwkShow_ = false;
|
||||
dragDropManager->isDragWithContextMenu_ = true;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
dragDropManager->DoDragMoveAnimate(pointerEvent);
|
||||
pointerEvent.x = 3.0f;
|
||||
pointerEvent.y = 4.0f;
|
||||
@ -1260,7 +1260,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage050, TestSi
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
eventHub->SetOnDragMove(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -1306,7 +1306,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage051, TestSi
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
eventHub->SetOnDragMove(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -1350,7 +1350,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage052, TestSi
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
eventHub->SetOnDragMove(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -1664,7 +1664,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage061, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
point.x = 1;
|
||||
point.y = 1;
|
||||
auto mockRenderContext = AceType::MakeRefPtr<MockRenderContext>();
|
||||
@ -1689,7 +1689,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage062, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
point.x = 1;
|
||||
point.y = 1;
|
||||
auto container = MockContainer::Current();
|
||||
@ -1721,7 +1721,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage063, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
point.x = 1;
|
||||
point.y = 1;
|
||||
auto container = MockContainer::Current();
|
||||
@ -1753,7 +1753,7 @@ HWTEST_F(DragDropManagerTestNgCoverage, DragDropManagerTestNgCoverage064, TestSi
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
auto frameNode = AceType::MakeRefPtr<FrameNode>(NODE_TAG, -1, AceType::MakeRefPtr<Pattern>());
|
||||
ASSERT_NE(frameNode, nullptr);
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
point.x = 1;
|
||||
point.y = 1;
|
||||
auto container = MockContainer::Current();
|
||||
|
@ -111,7 +111,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerPrintDragFrameNodeTest001, Tes
|
||||
* @tc.steps: step1. construct a DragDropManager
|
||||
*/
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
OHOS::Ace::PointerEvent point;
|
||||
OHOS::Ace::DragPointerEvent point;
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. call OnDragStart
|
||||
@ -373,7 +373,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerOnDragMoveTest001, TestSize.Le
|
||||
* @tc.steps: step1. construct a DragDropManager
|
||||
*/
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. call OnDragStart
|
||||
@ -429,7 +429,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerFireOnDragEventTest001, TestSi
|
||||
onDropInfo = EXTRA_INFO;
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -485,7 +485,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerFireOnItemDragEventTest003, Te
|
||||
onDropInfo = EXTRA_INFO;
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -773,7 +773,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerGetItemIndexTest002, TestSize.
|
||||
onDropInfo = EXTRA_INFO;
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -845,7 +845,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerGetItemIndexTest003, TestSize.
|
||||
onDropInfo = EXTRA_INFO;
|
||||
};
|
||||
eventHub->SetOnDrop(std::move(onDrop));
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
TouchEvent event;
|
||||
event.x = 1.0f;
|
||||
event.y = 2.0f;
|
||||
@ -1180,7 +1180,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest043, TestSize.Level1)
|
||||
* @tc.steps: step2. call DoDragMoveAnimate with pointerEvent.
|
||||
* @tc.expected: dragDropManager->IsNeedScaleDragPreview() returns true.
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
dragDropManager->info_.scale = 0.5f;
|
||||
dragDropManager->DoDragMoveAnimate(pointerEvent);
|
||||
EXPECT_TRUE(dragDropManager->IsNeedScaleDragPreview());
|
||||
@ -1304,7 +1304,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest047, TestSize.Level1)
|
||||
* @tc.steps: step2. call OnDragMoveOut with pointerEvent.
|
||||
* @tc.expected: container is null.
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
dragDropManager->OnDragMoveOut(pointerEvent);
|
||||
auto container = Container::Current();
|
||||
ASSERT_NE(container, nullptr);
|
||||
@ -1470,7 +1470,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest050, TestSize.Level1)
|
||||
* @tc.steps: step2. Construct frameNode and update the properties.
|
||||
* @tc.expected: frameNode and geometryNode are not null.
|
||||
*/
|
||||
PointerEvent point;
|
||||
DragPointerEvent point;
|
||||
std::string extraInfo;
|
||||
dragDropManager->extraInfo_ = EXTRA_INFO;
|
||||
dragDropManager->isMouseDragged_ = true;
|
||||
@ -1521,7 +1521,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest051, TestSize.Level1)
|
||||
* @tc.expected: dragDropManager->isDragCancel_ is true.
|
||||
*/
|
||||
std::string extraInfo;
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
dragDropManager->SetIsDragCancel(true);
|
||||
dragDropManager->OnDragEnd(pointerEvent, extraInfo);
|
||||
EXPECT_TRUE(dragDropManager->isDragCancel_);
|
||||
@ -1767,7 +1767,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest061, TestSize.Level1)
|
||||
* @tc.steps: step2. call DoDragMoveAnimate with pointerEvent.
|
||||
* @tc.expected: dragDropManager->IsNeedScaleDragPreview() returns true.
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
dragDropManager->info_.scale = 0.5f;
|
||||
dragDropManager->DoDragMoveAnimate(pointerEvent);
|
||||
EXPECT_TRUE(dragDropManager->IsNeedScaleDragPreview());
|
||||
@ -2007,7 +2007,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest068, TestSize.Level1)
|
||||
* @tc.steps: step1. construct a DragDropManager
|
||||
*/
|
||||
auto dragDropManager = AceType::MakeRefPtr<DragDropManager>();
|
||||
OHOS::Ace::PointerEvent point;
|
||||
OHOS::Ace::DragPointerEvent point;
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. Invoke PrintDragFrameNode
|
||||
@ -2095,7 +2095,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest071, TestSize.Level1)
|
||||
* @tc.steps: step2. Invoke ReachMoveLimit
|
||||
* @tc.expected: isTimeLimited returns false and isDistanceLimited returns true
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
auto point = Point(1, 1);
|
||||
pointerEvent.sourceTool = SourceTool::MOUSE;
|
||||
auto moveLimit = dragDropManager->ReachMoveLimit(pointerEvent, point);
|
||||
@ -2160,7 +2160,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest073, TestSize.Level1)
|
||||
/**
|
||||
* @tc.steps: step1. Invoke DoDropAction
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
auto dragFrameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
|
||||
std::string udKey;
|
||||
InteractionInterface::GetInstance()->GetUdKey(udKey);
|
||||
@ -2185,7 +2185,7 @@ HWTEST_F(DragDropManagerTestNgNew, DragDropManagerTest074, TestSize.Level1)
|
||||
/**
|
||||
* @tc.steps: step1. Invoke DoDropAction
|
||||
*/
|
||||
PointerEvent pointerEvent;
|
||||
DragPointerEvent pointerEvent;
|
||||
auto dragFrameNode = FrameNode::CreateFrameNode("test", 1, AceType::MakeRefPtr<Pattern>(), false);
|
||||
std::string udKey;
|
||||
InteractionInterface::GetInstance()->GetUdKey(udKey);
|
||||
|
@ -161,7 +161,7 @@ HWTEST_F(PlatformPatternTestNg, PlatformPatternTest003, TestSize.Level1)
|
||||
* @tc.steps: step3. call InitializeDynamicComponent.
|
||||
* @tc.expected: expect dynamicComponentRenderer_ is not null.
|
||||
*/
|
||||
OHOS::Ace::PointerEvent event;
|
||||
OHOS::Ace::DragPointerEvent event;
|
||||
platformPattern->HandleDragEvent(event);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,10 @@ void ConvertAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, Ax
|
||||
|
||||
void ConvertKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, KeyEvent& event) {}
|
||||
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, PointerEvent& event) {}
|
||||
void ConvertNonPointerAxisEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, NG::NonPointerAxisEvent& event)
|
||||
{}
|
||||
|
||||
void ConvertPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, DragPointerEvent& event) {}
|
||||
|
||||
void LogPointInfo(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, int32_t instanceId) {}
|
||||
|
||||
|
@ -1081,21 +1081,21 @@ HWTEST_F(PipelineContextTestNg, PipelineContextTestNg065, TestSize.Level1)
|
||||
uint64_t nanoTimeStamp = 1234567890;
|
||||
bool isScreen = true;
|
||||
auto result =
|
||||
ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<UIInputEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<PointerEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.x);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.y);
|
||||
auto timeStampAce = TimeStamp(std::chrono::nanoseconds(1000));
|
||||
emptyHistory.push_back(TouchEvent {}.SetX(100.0f).SetY(200.0f).SetTime(timeStampAce));
|
||||
result = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<UIInputEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
result = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<PointerEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.x);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.y);
|
||||
emptyHistory.clear();
|
||||
auto timeStampTwo = TimeStamp(std::chrono::nanoseconds(2000));
|
||||
emptyCurrent.push_back(TouchEvent {}.SetX(200.0f).SetY(300.0f).SetTime(timeStampTwo));
|
||||
result = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<UIInputEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
result = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(emptyHistory.begin(), emptyHistory.end()),
|
||||
std::vector<PointerEvent>(emptyCurrent.begin(), emptyCurrent.end()), nanoTimeStamp, isScreen);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.x);
|
||||
EXPECT_FLOAT_EQ(0.0f, result.y);
|
||||
}
|
||||
@ -1118,15 +1118,15 @@ HWTEST_F(PipelineContextTestNg, PipelineContextTestNg066, TestSize.Level1)
|
||||
current.push_back(TouchEvent {}.SetX(200.0f).SetY(300.0f).SetTime(timeStampThree));
|
||||
current.push_back(TouchEvent {}.SetX(250.0f).SetY(350.0f).SetTime(timeStampFour));
|
||||
|
||||
auto resampledCoord = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), 30000000, true);
|
||||
auto resampledCoord = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), 30000000, true);
|
||||
|
||||
ASSERT_FLOAT_EQ(200.0f, resampledCoord.x);
|
||||
ASSERT_FLOAT_EQ(300.0f, resampledCoord.y);
|
||||
|
||||
SystemProperties::debugEnabled_ = true;
|
||||
resampledCoord = ResampleAlgo::GetResampleCoord(std::vector<UIInputEvent>(history.begin(), history.end()),
|
||||
std::vector<UIInputEvent>(current.begin(), current.end()), 2500, true);
|
||||
resampledCoord = ResampleAlgo::GetResampleCoord(std::vector<PointerEvent>(history.begin(), history.end()),
|
||||
std::vector<PointerEvent>(current.begin(), current.end()), 2500, true);
|
||||
ASSERT_FLOAT_EQ(0.0f, resampledCoord.x);
|
||||
ASSERT_FLOAT_EQ(0.0f, resampledCoord.y);
|
||||
}
|
||||
@ -1976,31 +1976,31 @@ HWTEST_F(PipelineContextTestNg, DragEvent01, TestSize.Level1)
|
||||
auto timeStampThree = TimeStamp(std::chrono::nanoseconds(3000));
|
||||
auto timeStampFour = TimeStamp(std::chrono::nanoseconds(4000));
|
||||
|
||||
std::vector<PointerEvent> history;
|
||||
PointerEvent historyDrageEvent1;
|
||||
std::vector<DragPointerEvent> history;
|
||||
DragPointerEvent historyDrageEvent1;
|
||||
historyDrageEvent1.x = 200;
|
||||
historyDrageEvent1.y = 300;
|
||||
historyDrageEvent1.time = timeStampAce;
|
||||
history.push_back(historyDrageEvent1);
|
||||
PointerEvent historyDrageEvent2;
|
||||
DragPointerEvent historyDrageEvent2;
|
||||
historyDrageEvent2.x = 250;
|
||||
historyDrageEvent2.y = 350;
|
||||
historyDrageEvent2.time = timeStampTwo;
|
||||
history.push_back(historyDrageEvent2);
|
||||
std::vector<PointerEvent> current;
|
||||
PointerEvent currentDragEvent1;
|
||||
std::vector<DragPointerEvent> current;
|
||||
DragPointerEvent currentDragEvent1;
|
||||
currentDragEvent1.x = 300;
|
||||
currentDragEvent1.y = 400;
|
||||
currentDragEvent1.time = timeStampThree;
|
||||
current.push_back(currentDragEvent1);
|
||||
PointerEvent currentDragEvent2;
|
||||
DragPointerEvent currentDragEvent2;
|
||||
currentDragEvent2.x = 350;
|
||||
currentDragEvent2.y = 450;
|
||||
currentDragEvent2.time = timeStampFour;
|
||||
current.push_back(currentDragEvent2);
|
||||
uint64_t nanoTimeStamp = 3100;
|
||||
|
||||
PointerEvent resampledPointerEvent = context_->eventManager_->GetResamplePointerEvent(
|
||||
DragPointerEvent resampledPointerEvent = context_->eventManager_->GetResamplePointerEvent(
|
||||
history, current, nanoTimeStamp);
|
||||
EXPECT_EQ(305, resampledPointerEvent.x);
|
||||
EXPECT_EQ(405, resampledPointerEvent.y);
|
||||
|
Loading…
Reference in New Issue
Block a user