When using the hand controller as a mouse, disable the navigation focus state in QML

This commit is contained in:
Brad Davis 2016-07-14 12:11:12 -07:00
parent 882139ebcf
commit 8685b23610

View file

@ -54,18 +54,14 @@ function Trigger(label) {
that.rawTriggerValue = 0; that.rawTriggerValue = 0;
that.triggerValue = 0; // rolling average of trigger value that.triggerValue = 0; // rolling average of trigger value
that.triggerClicked = false; that.triggerClicked = false;
that.triggerClick = function (value) { that.triggerClick = function (value) { that.triggerClicked = value; };
print("Trigger clicked is now " + value); that.triggerPress = function (value) { that.rawTriggerValue = value; };
that.triggerClicked = value;
};
that.triggerPress = function (value) {
that.rawTriggerValue = value;
};
that.updateSmoothedTrigger = function () { // e.g., call once/update for effect that.updateSmoothedTrigger = function () { // e.g., call once/update for effect
var triggerValue = that.rawTriggerValue; var triggerValue = that.rawTriggerValue;
// smooth out trigger value // smooth out trigger value
that.triggerValue = (that.triggerValue * that.TRIGGER_SMOOTH_RATIO) + that.triggerValue = (that.triggerValue * that.TRIGGER_SMOOTH_RATIO) +
(triggerValue * (1.0 - that.TRIGGER_SMOOTH_RATIO)); (triggerValue * (1.0 - that.TRIGGER_SMOOTH_RATIO));
OffscreenFlags.navigationFocusDisabled = that.triggerValue != 0.0;
}; };
// Current smoothed state, without hysteresis. Answering booleans. // Current smoothed state, without hysteresis. Answering booleans.
that.triggerSmoothedClick = function () { that.triggerSmoothedClick = function () {
@ -499,7 +495,10 @@ function checkSettings() {
updateRecommendedArea(); updateRecommendedArea();
} }
checkSettings(); checkSettings();
var settingsChecker = Script.setInterval(checkSettings, SETTINGS_CHANGE_RECHECK_INTERVAL); var settingsChecker = Script.setInterval(checkSettings, SETTINGS_CHANGE_RECHECK_INTERVAL);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
Script.clearInterval(settingsChecker); Script.clearInterval(settingsChecker);
OffscreenFlags.navigationFocusDisabled = false;
}); });