mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 08:10:15 +02:00
saving work
This commit is contained in:
parent
da3d5a92d9
commit
20918641f4
6 changed files with 36 additions and 3 deletions
|
@ -223,7 +223,7 @@ FocusScope {
|
||||||
//offscreenWindow.activeFocusItemChanged.connect(onWindowFocusChanged);
|
//offscreenWindow.activeFocusItemChanged.connect(onWindowFocusChanged);
|
||||||
focusHack.start();
|
focusHack.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWindowFocusChanged() {
|
function onWindowFocusChanged() {
|
||||||
//console.log("Focus item is " + offscreenWindow.activeFocusItem);
|
//console.log("Focus item is " + offscreenWindow.activeFocusItem);
|
||||||
|
|
||||||
|
@ -298,6 +298,23 @@ FocusScope {
|
||||||
pinned = !pinned
|
pinned = !pinned
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPointOnWindow(point) {
|
||||||
|
for (var i = 0; i < desktop.visibleChildren.length; i++) {
|
||||||
|
var child = desktop.visibleChildren[i];
|
||||||
|
if (child.visible) {
|
||||||
|
if (child.hasOwnProperty("modality")) {
|
||||||
|
var mappedPoint = child.mapFromGlobal(point.x, point.y);
|
||||||
|
console.log(mappedPoint);
|
||||||
|
if (child.contains(mappedPoint)) {
|
||||||
|
return true;
|
||||||
|
console.log(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function setPinned(newPinned) {
|
function setPinned(newPinned) {
|
||||||
pinned = newPinned
|
pinned = newPinned
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,11 @@ void WindowScriptingInterface::setPreviousBrowseAssetLocation(const QString& loc
|
||||||
Setting::Handle<QVariant>(LAST_BROWSE_ASSETS_LOCATION_SETTING).set(location);
|
Setting::Handle<QVariant>(LAST_BROWSE_ASSETS_LOCATION_SETTING).set(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowScriptingInterface::isPointOnDesktopWindow(QVariant point) {
|
||||||
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
|
return offscreenUi->isPointOnDesktopWindow(point);
|
||||||
|
}
|
||||||
|
|
||||||
/// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and
|
/// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and
|
||||||
/// might be in same thread as a script that sets the reticle to invisible
|
/// might be in same thread as a script that sets the reticle to invisible
|
||||||
void WindowScriptingInterface::ensureReticleVisible() const {
|
void WindowScriptingInterface::ensureReticleVisible() const {
|
||||||
|
|
|
@ -72,6 +72,7 @@ public slots:
|
||||||
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
void shareSnapshot(const QString& path, const QUrl& href = QUrl(""));
|
||||||
bool isPhysicsEnabled();
|
bool isPhysicsEnabled();
|
||||||
bool setDisplayTexture(const QString& name);
|
bool setDisplayTexture(const QString& name);
|
||||||
|
bool isPointOnDesktopWindow(QVariant point);
|
||||||
|
|
||||||
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
||||||
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
||||||
|
|
|
@ -136,6 +136,15 @@ void OffscreenUi::toggle(const QUrl& url, const QString& name, std::function<voi
|
||||||
shownProperty.write(!shownProperty.read().toBool());
|
shownProperty.write(!shownProperty.read().toBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OffscreenUi::isPointOnDesktopWindow(QVariant point) {
|
||||||
|
QVariant result;
|
||||||
|
BLOCKING_INVOKE_METHOD(_desktop, "isPointOnWindow",
|
||||||
|
Q_RETURN_ARG(QVariant, result),
|
||||||
|
Q_ARG(QVariant, point));
|
||||||
|
qDebug() << "------> invoke method isPointOnWindow <------";
|
||||||
|
return result.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
void OffscreenUi::hide(const QString& name) {
|
void OffscreenUi::hide(const QString& name) {
|
||||||
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
QQuickItem* item = getRootItem()->findChild<QQuickItem*>(name);
|
||||||
if (item) {
|
if (item) {
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
bool eventFilter(QObject* originalDestination, QEvent* event) override;
|
||||||
void addMenuInitializer(std::function<void(VrMenu*)> f);
|
void addMenuInitializer(std::function<void(VrMenu*)> f);
|
||||||
QObject* getFlags();
|
QObject* getFlags();
|
||||||
|
Q_INVOKABLE bool isPointOnDesktopWindow(QVariant point);
|
||||||
QQuickItem* getDesktop();
|
QQuickItem* getDesktop();
|
||||||
QQuickItem* getToolWindow();
|
QQuickItem* getToolWindow();
|
||||||
QObject* getRootMenu();
|
QObject* getRootMenu();
|
||||||
|
|
|
@ -178,11 +178,11 @@
|
||||||
}
|
}
|
||||||
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
var hudRayPick = controllerData.hudRayPicks[this.hand];
|
||||||
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
var point2d = this.calculateNewReticlePosition(hudRayPick.intersection);
|
||||||
this.setReticlePosition(point2d);
|
if (!Window.isPointOnDesktopWindow(point2d)) {
|
||||||
if (!Reticle.isPointingAtSystemOverlay(point2d)) {
|
|
||||||
this.exitModule();
|
this.exitModule();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.setReticlePosition(point2d);
|
||||||
Reticle.visible = false;
|
Reticle.visible = false;
|
||||||
this.movedAway = false;
|
this.movedAway = false;
|
||||||
this.triggerClicked = controllerData.triggerClicks[this.hand];
|
this.triggerClicked = controllerData.triggerClicks[this.hand];
|
||||||
|
|
Loading…
Reference in a new issue