mirror of
https://github.com/openharmony/ace_engine_lite.git
synced 2026-07-18 18:34:29 -04:00
Description:修复ondragend代码逻辑问题
Sig:ace_engine_lite Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: lancer <haoshuo@huawei.com>
This commit is contained in:
@@ -358,7 +358,7 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
|
||||
return K_JUSTIFY_CONTENT;
|
||||
}
|
||||
break;
|
||||
#ifdef JS_TOUCH_EVENT_SUPPORT
|
||||
#ifdef JS_EXTRA_EVENT_SUPPORT
|
||||
case 'k':
|
||||
if (!strcmp(s, "ey")) {
|
||||
return K_KEY;
|
||||
@@ -693,7 +693,7 @@ uint16_t KeyParser::ParseKeyId(const char *s, const size_t len)
|
||||
if (!strcmp(s, "ouchstart")) {
|
||||
return K_TOUCHSTART;
|
||||
}
|
||||
#ifdef JS_TOUCH_EVENT_SUPPORT
|
||||
#ifdef JS_EXTRA_EVENT_SUPPORT
|
||||
if (!strcmp(s, "ouchcancel")) {
|
||||
return K_TOUCHCANCEL;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ enum {
|
||||
KEYWORD(ITEM_SELECTED, itemselected) // scroll item selected event listener
|
||||
KEYWORD(ITERATION, iteration) // image-animator attribute
|
||||
KEYWORD(JUSTIFY_CONTENT, justifyContent) // layout style
|
||||
#ifdef JS_TOUCH_EVENT_SUPPORT
|
||||
#ifdef JS_EXTRA_EVENT_SUPPORT
|
||||
KEYWORD(KEY, key) // onkey event
|
||||
#endif
|
||||
KEYWORD(LABELS, labels) // chart labels
|
||||
@@ -275,7 +275,7 @@ enum {
|
||||
KEYWORD(TOUCHSTART, touchStart) // touch event listener
|
||||
KEYWORD(TOUCHMOVE, touchmove) // touchmove event listener
|
||||
KEYWORD(TOUCHEND, touchEnd) // touchend event listener
|
||||
#ifdef JS_TOUCH_EVENT_SUPPORT
|
||||
#ifdef JS_EXTRA_EVENT_SUPPORT
|
||||
KEYWORD(TOUCHCANCEL, touchcancel) // ontouchcancel event
|
||||
#endif
|
||||
KEYWORD(TRANSLATE_X, translateX) // animation transform x
|
||||
|
||||
@@ -124,23 +124,18 @@ bool ViewOnTouchListener::OnDrag(UIView& view, const DragEvent& event)
|
||||
|
||||
bool ViewOnTouchListener::OnDragEnd(UIView& view, const DragEvent &event)
|
||||
{
|
||||
if (JSUndefined::Is(bindSwipeFunc_)) {
|
||||
HILOG_ERROR(HILOG_MODULE_ACE, "OnSwipe received, but no JS function to call");
|
||||
return isStopPropagation_;
|
||||
if (!JSUndefined::Is(bindSwipeFunc_)) {
|
||||
JSValue argSwipe = EventUtil::CreateSwipeEvent(view, event);
|
||||
EventUtil::InvokeCallback(vm_, bindSwipeFunc_, argSwipe, this);
|
||||
}
|
||||
|
||||
if (JSUndefined::Is(bindTouchEndFunc_)) {
|
||||
HILOG_ERROR(HILOG_MODULE_ACE, "OnDragEnd received, but no JS function to call");
|
||||
return isStopPropagation_;
|
||||
if (!JSUndefined::Is(bindTouchEndFunc_)) {
|
||||
JSValue argDragEnd = EventUtil::CreateTouchEvent(view, event);
|
||||
EventUtil::InvokeCallback(vm_, bindTouchEndFunc_, argDragEnd, this);
|
||||
}
|
||||
|
||||
HILOG_DEBUG(HILOG_MODULE_ACE, "OnDragEnd received");
|
||||
|
||||
JSValue argSwipe = EventUtil::CreateSwipeEvent(view, event);
|
||||
EventUtil::InvokeCallback(vm_, bindSwipeFunc_, argSwipe, this);
|
||||
|
||||
JSValue argDragEnd = EventUtil::CreateTouchEvent(view, event);
|
||||
EventUtil::InvokeCallback(vm_, bindTouchEndFunc_, argDragEnd, this);
|
||||
HILOG_DEBUG(HILOG_MODULE_ACE, "Swipe received");
|
||||
return isStopPropagation_;
|
||||
}
|
||||
} // namespace ACELite
|
||||
|
||||
@@ -175,7 +175,12 @@ class ViewOnTouchListener final : public UIView::OnDragListener {
|
||||
public:
|
||||
ACE_DISALLOW_COPY_AND_MOVE(ViewOnTouchListener);
|
||||
ViewOnTouchListener(jerry_value_t vm, bool isStopPropagation)
|
||||
: vm_(jerry_acquire_value(vm)), isStopPropagation_(isStopPropagation)
|
||||
: vm_(jerry_acquire_value(vm)),
|
||||
isStopPropagation_(isStopPropagation),
|
||||
bindTouchStartFunc_(UNDEFINED),
|
||||
bindTouchMoveFunc_(UNDEFINED),
|
||||
bindTouchEndFunc_(UNDEFINED),
|
||||
bindSwipeFunc_(UNDEFINED)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user