wasm: fix Pen input
This also adds the ability to distinguish between a Pen and a Touch. Fixes: QTBUG-116989 Change-Id: Iffc5d20c9b46c1746a03c45dd12017d5dd5172a5 Pick-to: 6.6 6.7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
585f348f3c
commit
0367aace14
@ -180,6 +180,8 @@ PointerEvent::PointerEvent(EventType type, emscripten::val event) : MouseEvent(t
|
||||
return PointerType::Mouse;
|
||||
if (type == "touch")
|
||||
return PointerType::Touch;
|
||||
if (type == "pen")
|
||||
return PointerType::Pen;
|
||||
return PointerType::Other;
|
||||
})();
|
||||
width = event["width"].as<qreal>();
|
||||
|
@ -39,6 +39,7 @@ enum class EventType {
|
||||
enum class PointerType {
|
||||
Mouse,
|
||||
Touch,
|
||||
Pen,
|
||||
Other,
|
||||
};
|
||||
|
||||
|
@ -84,7 +84,7 @@ bool ClientArea::deliverEvent(const PointerEvent &event)
|
||||
pointInTargetWindowCoords.y() / m_window->window()->height());
|
||||
|
||||
const auto tp = m_pointerIdToTouchPoints.find(event.pointerId);
|
||||
if (tp != m_pointerIdToTouchPoints.end()) {
|
||||
if (event.pointerType != PointerType::Pen && tp != m_pointerIdToTouchPoints.end()) {
|
||||
touchPoint = &tp.value();
|
||||
} else {
|
||||
touchPoint = &m_pointerIdToTouchPoints
|
||||
|
Loading…
x
Reference in New Issue
Block a user