mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Merge branch 'master' of https://github.com/highfidelity/hifi into pop_interfaceChanges2
This commit is contained in:
commit
4814f277c1
3 changed files with 38 additions and 11 deletions
|
@ -14,7 +14,6 @@
|
|||
var isWindowFocused = true;
|
||||
var isKeyboardRaised = false;
|
||||
var isNumericKeyboard = false;
|
||||
var KEYBOARD_HEIGHT = 200;
|
||||
|
||||
function shouldRaiseKeyboard() {
|
||||
var nodeName = document.activeElement.nodeName;
|
||||
|
@ -38,6 +37,19 @@
|
|||
return document.activeElement.type === "number";
|
||||
};
|
||||
|
||||
function scheduleBringToView(timeout) {
|
||||
|
||||
var timer = setTimeout(function () {
|
||||
clearTimeout(timer);
|
||||
|
||||
var elementRect = document.activeElement.getBoundingClientRect();
|
||||
var absoluteElementTop = elementRect.top + window.scrollY;
|
||||
var middle = absoluteElementTop - (window.innerHeight / 2);
|
||||
|
||||
window.scrollTo(0, middle);
|
||||
}, timeout);
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
var keyboardRaised = shouldRaiseKeyboard();
|
||||
var numericKeyboard = shouldSetNumeric();
|
||||
|
@ -56,13 +68,8 @@
|
|||
}
|
||||
|
||||
if (!isKeyboardRaised) {
|
||||
var delta = document.activeElement.getBoundingClientRect().bottom + 10
|
||||
- (document.body.clientHeight - KEYBOARD_HEIGHT);
|
||||
if (delta > 0) {
|
||||
setTimeout(function () {
|
||||
document.body.scrollTop += delta;
|
||||
}, 500); // Allow time for keyboard to be raised in QML.
|
||||
}
|
||||
scheduleBringToView(250); // Allow time for keyboard to be raised in QML.
|
||||
// 2DO: should it be rather done from 'client area height changed' event?
|
||||
}
|
||||
|
||||
isKeyboardRaised = keyboardRaised;
|
||||
|
@ -70,6 +77,13 @@
|
|||
}
|
||||
}, POLL_FREQUENCY);
|
||||
|
||||
window.addEventListener("click", function () {
|
||||
var keyboardRaised = shouldRaiseKeyboard();
|
||||
if(keyboardRaised && isKeyboardRaised) {
|
||||
scheduleBringToView(150);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("focus", function () {
|
||||
isWindowFocused = true;
|
||||
});
|
||||
|
|
|
@ -278,9 +278,10 @@ Transform Line3DOverlay::evalRenderTransform() {
|
|||
auto endPos = getEnd();
|
||||
|
||||
auto vec = endPos - transform.getTranslation();
|
||||
auto scale = glm::length(vec);
|
||||
const float MIN_LINE_LENGTH = 0.0001f;
|
||||
auto scale = glm::max(glm::length(vec), MIN_LINE_LENGTH);
|
||||
auto dir = vec / scale;
|
||||
auto orientation = glm::rotation(glm::vec3(0,0,-1), dir);
|
||||
auto orientation = glm::rotation(glm::vec3(0.0f, 0.0f, -1.0f), dir);
|
||||
transform.setRotation(orientation);
|
||||
transform.setScale(scale);
|
||||
|
||||
|
|
|
@ -45,7 +45,19 @@ void Volume3DOverlay::setProperties(const QVariantMap& properties) {
|
|||
}
|
||||
|
||||
if (dimensions.isValid()) {
|
||||
setDimensions(vec3FromVariant(dimensions));
|
||||
glm::vec3 scale = vec3FromVariant(dimensions);
|
||||
// don't allow a zero or negative dimension component to reach the renderTransform
|
||||
const float MIN_DIMENSION = 0.0001f;
|
||||
if (scale.x < MIN_DIMENSION) {
|
||||
scale.x = MIN_DIMENSION;
|
||||
}
|
||||
if (scale.y < MIN_DIMENSION) {
|
||||
scale.y = MIN_DIMENSION;
|
||||
}
|
||||
if (scale.z < MIN_DIMENSION) {
|
||||
scale.z = MIN_DIMENSION;
|
||||
}
|
||||
setDimensions(scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue