mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 01:47:31 +02:00
Ensure VR menus never render off the overlay
This commit is contained in:
parent
27e56a9ced
commit
d74686474a
1 changed files with 12 additions and 0 deletions
|
@ -51,6 +51,16 @@ Hifi.VrMenu {
|
||||||
VrMenuView {
|
VrMenuView {
|
||||||
property int menuDepth: root.models.length - 1
|
property int menuDepth: root.models.length - 1
|
||||||
model: root.models[menuDepth]
|
model: root.models[menuDepth]
|
||||||
|
|
||||||
|
function fit(position, size, maxposition) {
|
||||||
|
var padding = 8;
|
||||||
|
if (position < padding) {
|
||||||
|
position = padding;
|
||||||
|
} else if (position + size + padding > maxposition) {
|
||||||
|
position = maxposition - (size + padding);
|
||||||
|
}
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (menuDepth === 0) {
|
if (menuDepth === 0) {
|
||||||
|
@ -61,6 +71,8 @@ Hifi.VrMenu {
|
||||||
x = lastColumn.x + 64;
|
x = lastColumn.x + 64;
|
||||||
y = lastMousePosition.y - height / 2;
|
y = lastMousePosition.y - height / 2;
|
||||||
}
|
}
|
||||||
|
x = fit(x, width, parent.width);
|
||||||
|
y = fit(y, height, parent.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelected: {
|
onSelected: {
|
||||||
|
|
Loading…
Reference in a new issue