mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Android - Use mouse events for interacting with UI. Now LoginDialog UI interation does not move radar camera. Remove repeated tooggle call in audio.js. Adapt button to simulated mouse events.
This commit is contained in:
parent
d7081b261b
commit
242b009562
3 changed files with 28 additions and 14 deletions
|
@ -118,7 +118,7 @@ Item {
|
|||
tabletRoot.playButtonClickSound();
|
||||
}*/
|
||||
}
|
||||
onEntered: {
|
||||
onPressed: {
|
||||
button.isEntered = true;
|
||||
button.entered();
|
||||
if (button.isActive) {
|
||||
|
@ -127,7 +127,7 @@ Item {
|
|||
button.state = "hover state";
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
onReleased: {
|
||||
button.isEntered = false;
|
||||
button.exited()
|
||||
if (button.isActive) {
|
||||
|
|
|
@ -166,18 +166,33 @@ bool OffscreenSurface::eventFilter(QObject* originalDestination, QEvent* event)
|
|||
case QEvent::TouchUpdate:
|
||||
case QEvent::TouchEnd: {
|
||||
QTouchEvent *originalEvent = static_cast<QTouchEvent *>(event);
|
||||
QTouchEvent fakeEvent(*originalEvent);
|
||||
auto newTouchPoints = fakeEvent.touchPoints();
|
||||
for (size_t i = 0; i < newTouchPoints.size(); ++i) {
|
||||
const auto &originalPoint = originalEvent->touchPoints()[i];
|
||||
auto &newPoint = newTouchPoints[i];
|
||||
newPoint.setPos(originalPoint.pos());
|
||||
QEvent::Type fakeMouseEventType = QEvent::None;
|
||||
Qt::MouseButton fakeMouseButton = Qt::NoButton;
|
||||
Qt::MouseButtons fakeMouseButtons = Qt::NoButton;
|
||||
switch (event->type()) {
|
||||
case QEvent::TouchBegin:
|
||||
fakeMouseEventType = QEvent::MouseButtonPress;
|
||||
fakeMouseButton = Qt::LeftButton;
|
||||
fakeMouseButtons = Qt::LeftButton;
|
||||
break;
|
||||
case QEvent::TouchUpdate:
|
||||
fakeMouseEventType = QEvent::MouseMove;
|
||||
fakeMouseButton = Qt::LeftButton;
|
||||
fakeMouseButtons = Qt::LeftButton;
|
||||
break;
|
||||
case QEvent::TouchEnd:
|
||||
fakeMouseEventType = QEvent::MouseButtonRelease;
|
||||
fakeMouseButton = Qt::LeftButton;
|
||||
fakeMouseButtons = Qt::NoButton;
|
||||
break;
|
||||
}
|
||||
fakeEvent.setTouchPoints(newTouchPoints);
|
||||
if (QCoreApplication::sendEvent(_sharedObject->getWindow(), &fakeEvent)) {
|
||||
qInfo() << __FUNCTION__ << "sent fake touch event:" << fakeEvent.type()
|
||||
<< "_quickWindow handled it... accepted:" << fakeEvent.isAccepted();
|
||||
return false; //event->isAccepted();
|
||||
if (fakeMouseEventType == QEvent::None) break;
|
||||
QMouseEvent fakeMouseEvent(fakeMouseEventType, originalEvent->touchPoints()[0].pos(), fakeMouseButton, fakeMouseButtons, Qt::NoModifier);
|
||||
fakeMouseEvent.ignore();
|
||||
if (QCoreApplication::sendEvent(_sharedObject->getWindow(), &fakeMouseEvent)) {
|
||||
qInfo() << __FUNCTION__ << "sent fake touch event:" << fakeMouseEvent.type()
|
||||
<< "_quickWindow handled it... accepted:" << fakeMouseEvent.isAccepted();
|
||||
return fakeMouseEvent.isAccepted();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ function onMuteClicked() {
|
|||
printd("On Mute Clicked");
|
||||
//Menu.setIsOptionChecked("Mute Microphone", !Menu.isOptionChecked("Mute Microphone"));
|
||||
Audio.muted = !Audio.muted;
|
||||
onMuteToggled();
|
||||
}
|
||||
|
||||
function onMuteToggled() {
|
||||
|
|
Loading…
Reference in a new issue