mirror of
https://github.com/lubosz/overte.git
synced 2025-04-07 09:42:06 +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 var expectedChildren;
|
||||
property bool repositionLocked: true
|
||||
property bool hmdHandMouseActive: false
|
||||
|
||||
onRepositionLockedChanged: {
|
||||
if (!repositionLocked) {
|
||||
|
|
|
@ -17,6 +17,9 @@ import "../styles-uit"
|
|||
Rectangle {
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
signal inflateDecorations();
|
||||
signal deflateDecorations();
|
||||
|
||||
property int frameMargin: 9
|
||||
property int frameMarginLeft: frameMargin
|
||||
property int frameMarginRight: frameMargin
|
||||
|
@ -43,5 +46,26 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
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 "../styles-uit"
|
||||
|
||||
|
||||
Decoration {
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
|
@ -28,23 +27,22 @@ Decoration {
|
|||
frameMarginTop: 2 * frameMargin + iconSize
|
||||
frameMarginBottom: iconSize + 11
|
||||
|
||||
Connections {
|
||||
target: window
|
||||
onMouseEntered: {
|
||||
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
|
||||
onInflateDecorations: {
|
||||
if (!HMD.active) {
|
||||
return;
|
||||
}
|
||||
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 {
|
||||
id: controlsRow
|
||||
anchors {
|
||||
|
|
|
@ -32,23 +32,21 @@ Decoration {
|
|||
frameMarginBottom: frameMargin + (verticalSpacers ? spacerMargin : 0)
|
||||
radius: hifi.dimensions.borderRadius / 2
|
||||
|
||||
Connections {
|
||||
target: window
|
||||
onMouseEntered: {
|
||||
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
|
||||
onInflateDecorations: {
|
||||
if (!HMD.active) {
|
||||
return;
|
||||
}
|
||||
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 {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <display-plugins/DisplayPlugin.h>
|
||||
#include <display-plugins/CompositorHelper.h>
|
||||
#include <OffscreenUi.h>
|
||||
#include <avatar/AvatarManager.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 {
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
offscreenUi->executeOnUiThread([offscreenUi, enabled] {
|
||||
offscreenUi->getDesktop()->setProperty("hmdHandMouseActive", enabled);
|
||||
});
|
||||
return qApp->getActiveDisplayPlugin()->setHandLaser(hands,
|
||||
enabled ? DisplayPlugin::HandLaserMode::Overlay : DisplayPlugin::HandLaserMode::None,
|
||||
color, direction);
|
||||
}
|
||||
|
||||
void HMDScriptingInterface::disableHandLasers(int hands) const {
|
||||
qApp->getActiveDisplayPlugin()->setHandLaser(hands, DisplayPlugin::HandLaserMode::None);
|
||||
setHandLasers(hands, false, vec4(0), vec3(0));
|
||||
}
|
||||
|
||||
bool HMDScriptingInterface::suppressKeyboard() {
|
||||
|
|
|
@ -33,6 +33,11 @@ ApplicationWindow {
|
|||
onClicked: HMD.active = !HMD.active
|
||||
}
|
||||
|
||||
Button {
|
||||
text: desktop.hmdHandMouseActive ? "Disable HMD HandMouse" : "Enable HMD HandMouse"
|
||||
onClicked: desktop.hmdHandMouseActive = !desktop.hmdHandMouseActive
|
||||
}
|
||||
|
||||
// Window visibility
|
||||
Button {
|
||||
text: "toggle desktop"
|
||||
|
|
Loading…
Reference in a new issue