mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +02:00
Fixing decoration inflation
This commit is contained in:
parent
f2220288fb
commit
6336362d40
6 changed files with 63 additions and 32 deletions
|
@ -25,6 +25,7 @@ FocusScope {
|
||||||
property rect recommendedRect: Qt.rect(0,0,0,0);
|
property rect recommendedRect: Qt.rect(0,0,0,0);
|
||||||
property var expectedChildren;
|
property var expectedChildren;
|
||||||
property bool repositionLocked: true
|
property bool repositionLocked: true
|
||||||
|
property bool hmdHandMouseActive: false
|
||||||
|
|
||||||
onRepositionLockedChanged: {
|
onRepositionLockedChanged: {
|
||||||
if (!repositionLocked) {
|
if (!repositionLocked) {
|
||||||
|
|
|
@ -17,6 +17,9 @@ import "../styles-uit"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
|
signal inflateDecorations();
|
||||||
|
signal deflateDecorations();
|
||||||
|
|
||||||
property int frameMargin: 9
|
property int frameMargin: 9
|
||||||
property int frameMarginLeft: frameMargin
|
property int frameMarginLeft: frameMargin
|
||||||
property int frameMarginRight: frameMargin
|
property int frameMarginRight: frameMargin
|
||||||
|
@ -43,5 +46,26 @@ Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
drag.target: window
|
drag.target: window
|
||||||
}
|
}
|
||||||
|
Connections {
|
||||||
|
target: window
|
||||||
|
onMouseEntered: {
|
||||||
|
if (desktop.hmdHandMouseActive) {
|
||||||
|
root.inflateDecorations()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onMouseExited: root.deflateDecorations();
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: desktop
|
||||||
|
onHmdHandMouseActiveChanged: {
|
||||||
|
if (desktop.hmdHandMouseActive) {
|
||||||
|
if (window.activator.containsMouse) {
|
||||||
|
root.inflateDecorations();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
root.deflateDecorations();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import QtGraphicalEffects 1.0
|
||||||
import "."
|
import "."
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
|
||||||
|
|
||||||
Decoration {
|
Decoration {
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
|
@ -28,23 +27,22 @@ Decoration {
|
||||||
frameMarginTop: 2 * frameMargin + iconSize
|
frameMarginTop: 2 * frameMargin + iconSize
|
||||||
frameMarginBottom: iconSize + 11
|
frameMarginBottom: iconSize + 11
|
||||||
|
|
||||||
Connections {
|
onInflateDecorations: {
|
||||||
target: window
|
if (!HMD.active) {
|
||||||
onMouseEntered: {
|
return;
|
||||||
if (!HMD.active) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.frameMargin = 18
|
|
||||||
titleText.size = hifi.fontSizes.overlayTitle * 2
|
|
||||||
root.iconSize = hifi.dimensions.frameIconSize * 2
|
|
||||||
}
|
|
||||||
onMouseExited: {
|
|
||||||
root.frameMargin = 9
|
|
||||||
titleText.size = hifi.fontSizes.overlayTitle
|
|
||||||
root.iconSize = hifi.dimensions.frameIconSize
|
|
||||||
}
|
}
|
||||||
|
root.frameMargin = 18
|
||||||
|
titleText.size = hifi.fontSizes.overlayTitle * 2
|
||||||
|
root.iconSize = hifi.dimensions.frameIconSize * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onDeflateDecorations: {
|
||||||
|
root.frameMargin = 9
|
||||||
|
titleText.size = hifi.fontSizes.overlayTitle
|
||||||
|
root.iconSize = hifi.dimensions.frameIconSize
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: controlsRow
|
id: controlsRow
|
||||||
anchors {
|
anchors {
|
||||||
|
|
|
@ -32,23 +32,21 @@ Decoration {
|
||||||
frameMarginBottom: frameMargin + (verticalSpacers ? spacerMargin : 0)
|
frameMarginBottom: frameMargin + (verticalSpacers ? spacerMargin : 0)
|
||||||
radius: hifi.dimensions.borderRadius / 2
|
radius: hifi.dimensions.borderRadius / 2
|
||||||
|
|
||||||
Connections {
|
onInflateDecorations: {
|
||||||
target: window
|
if (!HMD.active) {
|
||||||
onMouseEntered: {
|
return;
|
||||||
if (!HMD.active) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
root.frameMargin = 18
|
|
||||||
root.spacerWidth = 16
|
|
||||||
root.spacerRadius = 8
|
|
||||||
root.spacerMargin = 8
|
|
||||||
}
|
|
||||||
onMouseExited: {
|
|
||||||
root.frameMargin = 6
|
|
||||||
root.spacerWidth = 8
|
|
||||||
root.spacerRadius = 4
|
|
||||||
root.spacerMargin = 12
|
|
||||||
}
|
}
|
||||||
|
root.frameMargin = 18
|
||||||
|
root.spacerWidth = 16
|
||||||
|
root.spacerRadius = 8
|
||||||
|
root.spacerMargin = 8
|
||||||
|
}
|
||||||
|
|
||||||
|
onDeflateDecorations: {
|
||||||
|
root.frameMargin = 6
|
||||||
|
root.spacerWidth = 8
|
||||||
|
root.spacerRadius = 4
|
||||||
|
root.spacerMargin = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <display-plugins/DisplayPlugin.h>
|
#include <display-plugins/DisplayPlugin.h>
|
||||||
#include <display-plugins/CompositorHelper.h>
|
#include <display-plugins/CompositorHelper.h>
|
||||||
|
#include <OffscreenUi.h>
|
||||||
#include <avatar/AvatarManager.h>
|
#include <avatar/AvatarManager.h>
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
|
@ -110,13 +111,17 @@ QString HMDScriptingInterface::preferredAudioOutput() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) const {
|
bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) const {
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
offscreenUi->executeOnUiThread([offscreenUi, enabled] {
|
||||||
|
offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled);
|
||||||
|
});
|
||||||
return qApp->getActiveDisplayPlugin()->setHandLaser(hands,
|
return qApp->getActiveDisplayPlugin()->setHandLaser(hands,
|
||||||
enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
|
enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
|
||||||
color, direction);
|
color, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HMDScriptingInterface::disableHandLasers(int hands) const {
|
void HMDScriptingInterface::disableHandLasers(int hands) const {
|
||||||
qApp->getActiveDisplayPlugin()->setHandLaser(hands, DisplayPlugin::HandLaserMode::None);
|
setHandLasers(hands, false, vec4(0), vec3(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HMDScriptingInterface::suppressKeyboard() {
|
bool HMDScriptingInterface::suppressKeyboard() {
|
||||||
|
|
|
@ -33,6 +33,11 @@ ApplicationWindow {
|
||||||
onClicked: HMD.active = !HMD.active
|
onClicked: HMD.active = !HMD.active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: desktop.hmdHandMouseActive ? "Disable HMD HandMouse" : "Enable HMD HandMouse"
|
||||||
|
onClicked: desktop.hmdHandMouseActive = !desktop.hmdHandMouseActive
|
||||||
|
}
|
||||||
|
|
||||||
// Window visibility
|
// Window visibility
|
||||||
Button {
|
Button {
|
||||||
text: "toggle desktop"
|
text: "toggle desktop"
|
||||||
|
|
Loading…
Reference in a new issue