From 7375840eda97df33dc59c39949a0f32c51bda86c Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Tue, 13 Nov 2018 17:09:47 -0800 Subject: [PATCH] adding 3d keyboard/get anchor id wip for reposition --- interface/src/Application.cpp | 11 ++++++----- interface/src/scripting/KeyboardScriptingInterface.h | 1 + interface/src/ui/Keyboard.cpp | 6 ++++++ interface/src/ui/Keyboard.h | 1 + interface/src/ui/overlays/Web3DOverlay.cpp | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a534201247..4951a5006e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -8541,9 +8541,10 @@ void Application::createLoginDialogOverlay() { refOverlayVec -= glm::vec3(0.0f, -0.1f, 1.0f); auto playArea = _displayPlugin->getPlayAreaRect(); - const glm::vec2 PLAY_AREA_OVERLAY_MODEL_DIMENSIONS{ 0.5f, 0.5f }; + const glm::vec2 LOGIN_OVERLAY_DIMENSIONS{ 0.5f, 0.5f }; if (!(playArea.isEmpty())) { - auto playAreaCenterOffset = glm::vec3(playArea.center().x(), 1.6f, playArea.center().y()); + // put it in the center of the play area with a default height. + auto playAreaCenterOffset = glm::vec3(0.0f, 1.6f, 0.0f); refRotation = glm::quat(1.0f, 0.0f, 1.0f, 0.0f); overlayProperties = { { "name", "LoginDialogOverlay" }, @@ -8551,12 +8552,12 @@ void Application::createLoginDialogOverlay() { { "parentID", getMyAvatar()->getSessionUUID() }, { "parentJointIndex", "_SENSOR_TO_WORLD_MATRIX" }, { "localPosition", vec3toVariant(playAreaCenterOffset) }, - { "orientation", quatToVariant(refRotation) }, + { "localOrientation", quatToVariant(refRotation) }, { "isSolid", true }, { "grabbable", false }, { "ignorePickIntersection", false }, { "alpha", 1.0 }, - { "dimensions", vec2ToVariant(PLAY_AREA_OVERLAY_MODEL_DIMENSIONS)}, + { "dimensions", vec2ToVariant(LOGIN_OVERLAY_DIMENSIONS)}, { "dpi", overlayDpi }, { "visible", true } }; @@ -8570,7 +8571,7 @@ void Application::createLoginDialogOverlay() { { "grabbable", false }, { "ignorePickIntersection", false }, { "alpha", 1.0 }, - { "dimensions", vec2ToVariant(PLAY_AREA_OVERLAY_MODEL_DIMENSIONS)}, + { "dimensions", vec2ToVariant(LOGIN_OVERLAY_DIMENSIONS)}, { "dpi", overlayDpi }, { "visible", true } }; diff --git a/interface/src/scripting/KeyboardScriptingInterface.h b/interface/src/scripting/KeyboardScriptingInterface.h index 1ab91ea7c3..b7c209b01d 100644 --- a/interface/src/scripting/KeyboardScriptingInterface.h +++ b/interface/src/scripting/KeyboardScriptingInterface.h @@ -33,6 +33,7 @@ class KeyboardScriptingInterface : public QObject, public Dependency { public: Q_INVOKABLE void loadKeyboardFile(const QString& string); + private: bool isRaised(); void setRaised(bool raised); diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 773253f85c..5085c6d3f0 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -847,6 +847,12 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { request->send(); } +OverlayID Keyboard::getAnchorID() { + return _ignoreItemsLock.resultWithReadLock([&] { + return _anchor.overlayID; + }); +} + QVector Keyboard::getKeysID() { return _ignoreItemsLock.resultWithReadLock>([&] { return _itemsToIgnore; diff --git a/interface/src/ui/Keyboard.h b/interface/src/ui/Keyboard.h index 18db38b2ae..b8e7346689 100644 --- a/interface/src/ui/Keyboard.h +++ b/interface/src/ui/Keyboard.h @@ -99,6 +99,7 @@ public: void loadKeyboardFile(const QString& keyboardFile); QVector getKeysID(); + OverlayID getAnchorID(); public slots: void handleTriggerBegin(const OverlayID& overlayID, const PointerEvent& event); diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 1d47e1294f..fd5c118f76 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -232,6 +232,8 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) { _webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance()); + _webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance()); + _webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get().data()); if (isTablet) { auto tabletScriptingInterface = DependencyManager::get(); @@ -262,7 +264,6 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) { _webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get().data()); - _webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("AvatarBookmarks", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("Render", AbstractViewStateInterface::instance()->getRenderEngine()->getConfiguration().get()); _webSurface->getSurfaceContext()->setContextProperty("Workload", qApp->getGameWorkload()._engine->getConfiguration().get()); @@ -274,7 +275,6 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) { _webSurface->getSurfaceContext()->setContextProperty("HiFiAbout", AboutUtil::getInstance()); _webSurface->getSurfaceContext()->setContextProperty("WalletScriptingInterface", DependencyManager::get().data()); _webSurface->getSurfaceContext()->setContextProperty("ResourceRequestObserver", DependencyManager::get().data()); - _webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get().data()); // Override min fps for tablet UI, for silky smooth scrolling setMaxFPS(90);