adding 3d keyboard/get anchor id wip for reposition

This commit is contained in:
Wayne Chen 2018-11-13 17:09:47 -08:00
parent e84361f267
commit 7375840eda
5 changed files with 16 additions and 7 deletions

View file

@ -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 }
};

View file

@ -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);

View file

@ -847,6 +847,12 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) {
request->send();
}
OverlayID Keyboard::getAnchorID() {
return _ignoreItemsLock.resultWithReadLock<OverlayID>([&] {
return _anchor.overlayID;
});
}
QVector<OverlayID> Keyboard::getKeysID() {
return _ignoreItemsLock.resultWithReadLock<QVector<OverlayID>>([&] {
return _itemsToIgnore;

View file

@ -99,6 +99,7 @@ public:
void loadKeyboardFile(const QString& keyboardFile);
QVector<OverlayID> getKeysID();
OverlayID getAnchorID();
public slots:
void handleTriggerBegin(const OverlayID& overlayID, const PointerEvent& event);

View file

@ -232,6 +232,8 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) {
_webSurface->getSurfaceContext()->setContextProperty("Entities", DependencyManager::get<EntityScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Snapshot", DependencyManager::get<Snapshot>().data());
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get<KeyboardScriptingInterface>().data());
if (isTablet) {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
@ -262,7 +264,6 @@ void Web3DOverlay::setupQmlSurface(bool isTablet) {
_webSurface->getSurfaceContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
_webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get<SoundCacheScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().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<WalletScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("ResourceRequestObserver", DependencyManager::get<ResourceRequestObserver>().data());
_webSurface->getSurfaceContext()->setContextProperty("KeyboardScriptingInterface", DependencyManager::get<KeyboardScriptingInterface>().data());
// Override min fps for tablet UI, for silky smooth scrolling
setMaxFPS(90);