mirror of
https://github.com/overte-org/overte.git
synced 2025-07-10 21:38:40 +02:00
Disable VPAD on bottom bar tapping and modes bar tapping
This commit is contained in:
parent
4839a8c720
commit
5e3ad3fe9a
4 changed files with 37 additions and 0 deletions
|
@ -41,6 +41,15 @@ Item {
|
||||||
|
|
||||||
Styles.HifiConstants { id: hifi }
|
Styles.HifiConstants { id: hifi }
|
||||||
HifiConstants { id: android }
|
HifiConstants { id: android }
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onEntered: {
|
||||||
|
Controller.setVPadEnabled(false);
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
Controller.setVPadEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: background
|
id: background
|
||||||
|
|
|
@ -40,6 +40,8 @@ Item {
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
signal entered()
|
||||||
|
signal exited()
|
||||||
|
|
||||||
onIsActiveChanged: {
|
onIsActiveChanged: {
|
||||||
if (button.isEntered) {
|
if (button.isEntered) {
|
||||||
|
@ -118,6 +120,7 @@ Item {
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
button.isEntered = true;
|
button.isEntered = true;
|
||||||
|
button.entered();
|
||||||
if (button.isActive) {
|
if (button.isActive) {
|
||||||
button.state = "hover active state";
|
button.state = "hover active state";
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,6 +129,7 @@ Item {
|
||||||
}
|
}
|
||||||
onExited: {
|
onExited: {
|
||||||
button.isEntered = false;
|
button.isEntered = false;
|
||||||
|
button.exited()
|
||||||
if (button.isActive) {
|
if (button.isActive) {
|
||||||
button.state = "active state";
|
button.state = "active state";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,6 +40,12 @@ Item {
|
||||||
var keys = Object.keys(properties).forEach(function (key) {
|
var keys = Object.keys(properties).forEach(function (key) {
|
||||||
button[key] = properties[key];
|
button[key] = properties[key];
|
||||||
});
|
});
|
||||||
|
button.entered.connect(function() {
|
||||||
|
Controller.setVPadEnabled(false);
|
||||||
|
});
|
||||||
|
button.exited.connect(function() {
|
||||||
|
Controller.setVPadEnabled(true);
|
||||||
|
});
|
||||||
return button;
|
return button;
|
||||||
} else if( component.status == Component.Error) {
|
} else if( component.status == Component.Error) {
|
||||||
console.log("Load button errors " + component.errorString());
|
console.log("Load button errors " + component.errorString());
|
||||||
|
|
|
@ -127,6 +127,10 @@ void TouchscreenVirtualPadDevice::debugPoints(const QTouchEvent* event, QString
|
||||||
void TouchscreenVirtualPadDevice::touchBeginEvent(const QTouchEvent* event) {
|
void TouchscreenVirtualPadDevice::touchBeginEvent(const QTouchEvent* event) {
|
||||||
// touch begin here is a big begin -> begins both pads? maybe it does nothing
|
// touch begin here is a big begin -> begins both pads? maybe it does nothing
|
||||||
debugPoints(event, " BEGIN ++++++++++++++++");
|
debugPoints(event, " BEGIN ++++++++++++++++");
|
||||||
|
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||||
|
if (!virtualPadManager.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
KeyboardMouseDevice::enableTouch(false);
|
KeyboardMouseDevice::enableTouch(false);
|
||||||
QScreen* eventScreen = event->window()->screen();
|
QScreen* eventScreen = event->window()->screen();
|
||||||
_screenWidthCenter = eventScreen->size().width() / 2;
|
_screenWidthCenter = eventScreen->size().width() / 2;
|
||||||
|
@ -138,6 +142,10 @@ void TouchscreenVirtualPadDevice::touchBeginEvent(const QTouchEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) {
|
void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) {
|
||||||
|
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||||
|
if (!virtualPadManager.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// touch end here is a big reset -> resets both pads
|
// touch end here is a big reset -> resets both pads
|
||||||
_touchPointCount = 0;
|
_touchPointCount = 0;
|
||||||
KeyboardMouseDevice::enableTouch(true);
|
KeyboardMouseDevice::enableTouch(true);
|
||||||
|
@ -148,6 +156,12 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) {
|
void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) {
|
||||||
|
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||||
|
if (!virtualPadManager.isEnabled()) {
|
||||||
|
touchLeftEnd();
|
||||||
|
touchRightEnd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
_touchPointCount = event->touchPoints().count();
|
_touchPointCount = event->touchPoints().count();
|
||||||
|
|
||||||
const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
|
const QList<QTouchEvent::TouchPoint>& tPoints = event->touchPoints();
|
||||||
|
@ -224,6 +238,10 @@ void TouchscreenVirtualPadDevice::touchRightEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TouchscreenVirtualPadDevice::touchGestureEvent(const QGestureEvent* event) {
|
void TouchscreenVirtualPadDevice::touchGestureEvent(const QGestureEvent* event) {
|
||||||
|
auto& virtualPadManager = VirtualPad::Manager::instance();
|
||||||
|
if (!virtualPadManager.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (QGesture* gesture = event->gesture(Qt::PinchGesture)) {
|
if (QGesture* gesture = event->gesture(Qt::PinchGesture)) {
|
||||||
QPinchGesture* pinch = static_cast<QPinchGesture*>(gesture);
|
QPinchGesture* pinch = static_cast<QPinchGesture*>(gesture);
|
||||||
_pinchScale = pinch->totalScaleFactor();
|
_pinchScale = pinch->totalScaleFactor();
|
||||||
|
|
Loading…
Reference in a new issue