fix touchevent

Signed-off-by: yaoyuchi <yaoyuchi@huawei.com>
This commit is contained in:
yaoyuchi
2022-03-21 21:00:27 +08:00
parent 33ae9a5bec
commit 0b76582e1d
2 changed files with 28 additions and 1 deletions
@@ -164,8 +164,9 @@ bool FlutterAceView::HandleTouchEvent(const TouchEvent& touchEvent)
LOGD("HandleTouchEvent touchEvent.x: %lf, touchEvent.y: %lf, touchEvent.size: %lf",
touchEvent.x, touchEvent.y, touchEvent.size);
auto event = touchEvent.UpdatePointers();
if (touchEventCallback_) {
touchEventCallback_(touchEvent);
touchEventCallback_(event);
}
return true;
+26
View File
@@ -137,6 +137,32 @@ struct TouchEvent final {
return { pointId, (x - offsetX) / scale, (y - offsetY) / scale, (screenX - offsetX) / scale,
(screenY - offsetY) / scale, type, time, size, force, deviceId, sourceType, temp };
}
TouchEvent UpdatePointers() const
{
TouchPoint point { .id = id,
.x = x,
.y = y,
.screenX = screenX,
.screenY = screenY,
.downTime = time,
.size = size,
.force = force,
.isPressed = (type == TouchType::DOWN) };
TouchEvent event { .id = id,
.x = x,
.y = y,
.screenX = screenX,
.screenY = screenY,
.type = type,
.time = time,
.size = size,
.force = force,
.deviceId = deviceId,
.sourceType = sourceType };
event.pointers.emplace_back(std::move(point));
return event;
}
};
class TouchCallBackInfo : public BaseEventInfo {