mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:38:00 +02:00
Clean code that manually checked for windows coordinates to disable radar touch
This commit is contained in:
parent
242b009562
commit
686af4ff77
7 changed files with 16 additions and 107 deletions
|
@ -67,6 +67,10 @@ Item {
|
||||||
fill: parent
|
fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
QmlHifi.WindowHeader {
|
QmlHifi.WindowHeader {
|
||||||
id: header
|
id: header
|
||||||
iconSource: "../../../icons/goto-i.svg"
|
iconSource: "../../../icons/goto-i.svg"
|
||||||
|
|
|
@ -58,6 +58,10 @@ Item {
|
||||||
width: parent ? parent.width : 0
|
width: parent ? parent.width : 0
|
||||||
height: parent ? parent.height : 0
|
height: parent ? parent.height : 0
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { position: 0.0; color: android.color.gradientTop }
|
GradientStop { position: 0.0; color: android.color.gradientTop }
|
||||||
GradientStop { position: 1.0; color: android.color.gradientBottom }
|
GradientStop { position: 1.0; color: android.color.gradientBottom }
|
||||||
|
|
|
@ -14,10 +14,9 @@
|
||||||
var DEFAULT_SCRIPTS_COMBINED = [
|
var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/progress.js",
|
"system/progress.js",
|
||||||
"system/+android/touchscreenvirtualpad.js",
|
"system/+android/touchscreenvirtualpad.js",
|
||||||
"system/+android/audio.js",
|
|
||||||
"system/+android/androidCombined.js"/*,
|
|
||||||
"system/+android/bottombar.js",
|
"system/+android/bottombar.js",
|
||||||
"system/+android/modes.js",
|
"system/+android/audio.js",
|
||||||
|
"system/+android/modes.js"/*,
|
||||||
"system/away.js",
|
"system/away.js",
|
||||||
"system/controllers/controllerDisplayManager.js",
|
"system/controllers/controllerDisplayManager.js",
|
||||||
"system/controllers/handControllerGrabAndroid.js",
|
"system/controllers/handControllerGrabAndroid.js",
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
"use strict";
|
|
||||||
//
|
|
||||||
// androidCombined.js
|
|
||||||
// scripts/system/
|
|
||||||
//
|
|
||||||
// Created by Gabriel Calero & Cristian Duarte on Mar 20, 2018
|
|
||||||
// Copyright 2018 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
|
||||||
|
|
||||||
var modesInterface = Script.require('./modes.js');
|
|
||||||
var bottombarInterface = Script.require('./bottombar.js');
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
modesInterface.isRadarModeValidTouch = bottombarInterface.isRadarModeValidTouch;// set new function
|
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
|
|
@ -21,9 +21,7 @@ var loginBtn;
|
||||||
var gotoScript = Script.require('./goto.js');
|
var gotoScript = Script.require('./goto.js');
|
||||||
var avatarSelection = Script.require('./avatarSelection.js');
|
var avatarSelection = Script.require('./avatarSelection.js');
|
||||||
|
|
||||||
var bottombarInterface = [];
|
var logEnabled = false;
|
||||||
|
|
||||||
var logEnabled = true;
|
|
||||||
|
|
||||||
function printd(str) {
|
function printd(str) {
|
||||||
if (logEnabled) {
|
if (logEnabled) {
|
||||||
|
@ -264,40 +262,6 @@ Script.scriptEnding.connect(function () {
|
||||||
GlobalServices.disconnected.disconnect(handleLogout);
|
GlobalServices.disconnected.disconnect(handleLogout);
|
||||||
});
|
});
|
||||||
|
|
||||||
function isRadarModeValidTouch(coords) {
|
|
||||||
var qmlFragments = [bottombar, bottomHudOptionsBar.qmlFragment];
|
|
||||||
var windows = [gotoScript, avatarSelection];
|
|
||||||
for (var i=0; i < qmlFragments.length; i++) {
|
|
||||||
var aQmlFrag = qmlFragments[i];
|
|
||||||
if (aQmlFrag != null && aQmlFrag.isVisible() &&
|
|
||||||
coords.x >= aQmlFrag.position.x && coords.x <= aQmlFrag.position.x + aQmlFrag.size.x &&
|
|
||||||
coords.y >= aQmlFrag.position.y && coords.y <= aQmlFrag.position.y + aQmlFrag.size.y
|
|
||||||
) {
|
|
||||||
printd("isRadarModeValidTouch- false because of qmlFragments!? idx " + i);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i=0; i < windows.length; i++) {
|
|
||||||
var aWin = windows[i];
|
|
||||||
if (aWin != null && aWin.position() != null && aWin.isVisible() &&
|
|
||||||
coords.x >= aWin.position().x && coords.x <= aWin.position().x + aWin.width() &&
|
|
||||||
coords.y >= aWin.position().y && coords.y <= aWin.position().y + aWin.height()
|
|
||||||
) {
|
|
||||||
printd("isRadarModeValidTouch- false because of windows!? idx " + i);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
printd("isRadarModeValidTouch- discarded of window idx " + i + " visible= " + aWin.isVisible());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printd("isRadarModeValidTouch- true by default ");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bottombarInterface.isRadarModeValidTouch = isRadarModeValidTouch;
|
|
||||||
|
|
||||||
module.exports = bottombarInterface;
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
|
@ -23,8 +23,6 @@ var logEnabled = true;
|
||||||
var radar = Script.require('./radar.js');
|
var radar = Script.require('./radar.js');
|
||||||
var uniqueColor = Script.require('./uniqueColor.js');
|
var uniqueColor = Script.require('./uniqueColor.js');
|
||||||
|
|
||||||
var modesInterface = {};
|
|
||||||
|
|
||||||
function printd(str) {
|
function printd(str) {
|
||||||
if (logEnabled) {
|
if (logEnabled) {
|
||||||
print("[modes.js] " + str);
|
print("[modes.js] " + str);
|
||||||
|
@ -35,7 +33,6 @@ function init() {
|
||||||
radar.setUniqueColor(uniqueColor);
|
radar.setUniqueColor(uniqueColor);
|
||||||
radar.init();
|
radar.init();
|
||||||
setupModesBar();
|
setupModesBar();
|
||||||
radar.isTouchValid = isRadarModeValidTouch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdown() {
|
function shutdown() {
|
||||||
|
@ -185,45 +182,6 @@ function onButtonClicked(clickedButton, whatToDo, hideAllAfter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRadarModeValidTouch(coords) {
|
|
||||||
if (!modesInterface.isRadarModeValidTouch(coords)) {
|
|
||||||
printd("isRadarModeValidTouch- false because of modesInterface");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
printd("isRadarModeValidTouch- modesInterface is true, evaluating modesbar qmls..");
|
|
||||||
|
|
||||||
var qmlFragments = [modesbar.qmlFragment];
|
|
||||||
var windows = [];
|
|
||||||
for (var i=0; i < qmlFragments.length; i++) {
|
|
||||||
var aQmlFrag = qmlFragments[i];
|
|
||||||
if (aQmlFrag != null && aQmlFrag.isVisible() &&
|
|
||||||
coords.x >= aQmlFrag.position.x && coords.x <= aQmlFrag.position.x + aQmlFrag.size.x &&
|
|
||||||
coords.y >= aQmlFrag.position.y && coords.y <= aQmlFrag.position.y + aQmlFrag.size.y
|
|
||||||
) {
|
|
||||||
printd("isRadarModeValidTouch- false because of qmlFragments!? idx " + i);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i=0; i < windows.length; i++) {
|
|
||||||
var aWin = windows[i];
|
|
||||||
if (aWin != null && aWin.position() != null && aWin.isVisible() &&
|
|
||||||
coords.x >= aWin.position().x && coords.x <= aWin.position().x + aWin.width() &&
|
|
||||||
coords.y >= aWin.position().y && coords.y <= aWin.position().y + aWin.height()
|
|
||||||
) {
|
|
||||||
printd("isRadarModeValidTouch- false because of windows!? idx " + i);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printd("isRadarModeValidTouch- true by default ");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// default
|
|
||||||
modesInterface.isRadarModeValidTouch = function(coords) {return true;};
|
|
||||||
|
|
||||||
module.exports = modesInterface;
|
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
shutdown();
|
shutdown();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
var radarModeInterface = {};
|
var radarModeInterface = {};
|
||||||
|
|
||||||
var logEnabled = true;
|
var logEnabled = false;
|
||||||
function printd(str) {
|
function printd(str) {
|
||||||
if (logEnabled) {
|
if (logEnabled) {
|
||||||
print("[radar.js] " + str);
|
print("[radar.js] " + str);
|
||||||
|
@ -1390,6 +1390,10 @@ radarModeInterface.setUniqueColor = function(c) {
|
||||||
uniqueColor = c;
|
uniqueColor = c;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
radarModeInterface.isTouchValid = function(coords) {
|
||||||
|
return true; // by default
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = radarModeInterface;
|
module.exports = radarModeInterface;
|
||||||
|
|
||||||
function updateRadar() {
|
function updateRadar() {
|
||||||
|
|
Loading…
Reference in a new issue