mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 13:44:32 +02:00
style / make sure the magnifier isn't rendered when we don't want it
This commit is contained in:
parent
d810283d5a
commit
e53b38e497
2 changed files with 46 additions and 19 deletions
|
@ -51,10 +51,12 @@ function Instructions(imageURL, originalWidth, originalHeight) {
|
||||||
}
|
}
|
||||||
tthis.remove();
|
tthis.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.remove = function() {
|
this.remove = function() {
|
||||||
Overlays.deleteOverlay(tthis.overlay);
|
Overlays.deleteOverlay(tthis.overlay);
|
||||||
tthis.visible = false;
|
tthis.visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.rescale = function() {
|
this.rescale = function() {
|
||||||
var scale = Math.min(windowDimensions.x / tthis.originalSize.w, windowDimensions.y / tthis.originalSize.h);
|
var scale = Math.min(windowDimensions.x / tthis.originalSize.w, windowDimensions.y / tthis.originalSize.h);
|
||||||
var newWidth = tthis.originalSize.w * scale;
|
var newWidth = tthis.originalSize.w * scale;
|
||||||
|
@ -115,14 +117,14 @@ keyboard.onKeyRelease = function(event) {
|
||||||
// you can cancel a key by releasing its focusing before releasing it
|
// you can cancel a key by releasing its focusing before releasing it
|
||||||
if (event.focus) {
|
if (event.focus) {
|
||||||
if (event.event == 'delete') {
|
if (event.event == 'delete') {
|
||||||
deleteChar();
|
deleteChar();
|
||||||
} else if (event.event == 'submit' || event.event == 'enter') {
|
} else if (event.event == 'submit' || event.event == 'enter') {
|
||||||
print("going to hifi://" + locationURL);
|
print("going to hifi://" + locationURL);
|
||||||
location = "hifi://" + locationURL;
|
location = "hifi://" + locationURL;
|
||||||
locationURL = "";
|
locationURL = "";
|
||||||
keyboard.hide();
|
keyboard.hide();
|
||||||
cursor.hide();
|
cursor.hide();
|
||||||
updateTextOverlay();
|
updateTextOverlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -131,18 +133,18 @@ keyboard.onFullyLoaded = function() {
|
||||||
print("Virtual-keyboard fully loaded.");
|
print("Virtual-keyboard fully loaded.");
|
||||||
var dimensions = Controller.getViewportDimensions();
|
var dimensions = Controller.getViewportDimensions();
|
||||||
text = Overlays.addOverlay("text", {
|
text = Overlays.addOverlay("text", {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: dimensions.y - keyboard.height() - 260,
|
y: dimensions.y - keyboard.height() - 260,
|
||||||
width: dimensions.x,
|
width: dimensions.x,
|
||||||
height: 250,
|
height: 250,
|
||||||
backgroundColor: { red: 255, green: 255, blue: 255},
|
backgroundColor: { red: 255, green: 255, blue: 255},
|
||||||
color: { red: 0, green: 0, blue: 0},
|
color: { red: 0, green: 0, blue: 0},
|
||||||
topMargin: 5,
|
topMargin: 5,
|
||||||
leftMargin: 0,
|
leftMargin: 0,
|
||||||
font: {size: textFontSize},
|
font: {size: textFontSize},
|
||||||
text: "",
|
text: "",
|
||||||
alpha: 0.8,
|
alpha: 0.8,
|
||||||
visible: keyboard.visible
|
visible: keyboard.visible
|
||||||
});
|
});
|
||||||
updateTextOverlay();
|
updateTextOverlay();
|
||||||
// the cursor is being loaded after the keyboard, else it will be on the background of the keyboard
|
// the cursor is being loaded after the keyboard, else it will be on the background of the keyboard
|
||||||
|
@ -189,6 +191,7 @@ function scriptEnding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportButtonValue(button, newValue, oldValue) {
|
function reportButtonValue(button, newValue, oldValue) {
|
||||||
|
print(button);
|
||||||
if (theInstruction.visible) {
|
if (theInstruction.visible) {
|
||||||
if (button == Joysticks.BUTTON_FACE_BOTTOM && newValue) {
|
if (button == Joysticks.BUTTON_FACE_BOTTOM && newValue) {
|
||||||
theInstruction.remove();
|
theInstruction.remove();
|
||||||
|
@ -201,6 +204,27 @@ function reportButtonValue(button, newValue, oldValue) {
|
||||||
}
|
}
|
||||||
} else if (button == Joysticks.BUTTON_FACE_RIGHT && newValue) {
|
} else if (button == Joysticks.BUTTON_FACE_RIGHT && newValue) {
|
||||||
deleteChar();
|
deleteChar();
|
||||||
|
} else if (button == Joysticks.BUTTON_FACE_LEFT && newValue) {
|
||||||
|
keyboard.hide();
|
||||||
|
if (cursor !== undefined) {
|
||||||
|
cursor.hide();
|
||||||
|
}
|
||||||
|
Overlays.editOverlay(text, {visible: false});
|
||||||
|
} else if (button == Joysticks.BUTTON_RIGHT_SHOULDER && newValue) {
|
||||||
|
if (keyboard.visible) {
|
||||||
|
print("going to hifi://" + locationURL);
|
||||||
|
location = "hifi://" + locationURL;
|
||||||
|
locationURL = "";
|
||||||
|
keyboard.hide();
|
||||||
|
cursor.hide();
|
||||||
|
updateTextOverlay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
keyboard.show();
|
||||||
|
if (cursor !== undefined) {
|
||||||
|
cursor.show();
|
||||||
|
}
|
||||||
|
Overlays.editOverlay(text, {visible: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -719,6 +719,9 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) {
|
||||||
|
|
||||||
//Renders a small magnification of the currently bound texture at the coordinates
|
//Renders a small magnification of the currently bound texture at the coordinates
|
||||||
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) {
|
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) {
|
||||||
|
if (!_magnifier) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
const int widgetWidth = glCanvas->width();
|
const int widgetWidth = glCanvas->width();
|
||||||
|
|
Loading…
Reference in a new issue