From 391cca787f78093a91a799f12fee2608e11f9589 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Fri, 1 Feb 2019 15:31:58 -0800 Subject: [PATCH] fix keyboard textures and text display --- interface/src/ui/Keyboard.cpp | 5 ++++- libraries/entities-renderer/src/RenderableTextEntityItem.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 0a19ac7488..32e6f9d186 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -325,6 +325,7 @@ void Keyboard::updateTextDisplay() { scaledDimensions *= sensorToWorldScale; float leftMargin = (scaledDimensions.x / 2); scaledDimensions.x += textWidth; + scaledDimensions.y *= 1.25f; EntityItemProperties properties; properties.setDimensions(scaledDimensions); @@ -817,7 +818,7 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { properties.setEmissive(true); properties.setParentID(_anchor.entityID); properties.setModelURL(url); - properties.setTextures(QVariant(textureMap).toString()); + properties.setTextures(QString(QJsonDocument::fromVariant(textureMap).toJson())); properties.getGrab().setGrabbable(false); properties.setLocalRotation(quatFromVariant(keyboardKeyValue["localOrientation"].toVariant())); QUuid id = entityScriptingInterface->addEntityInternal(properties, entity::HostType::LOCAL); @@ -868,6 +869,8 @@ void Keyboard::loadKeyboardFile(const QString& keyboardFile) { properties.setEmissive(true); properties.getGrab().setGrabbable(false); properties.setText(""); + properties.setTextAlpha(1.0f); + properties.setBackgroundAlpha(0.7f); properties.setParentID(_anchor.entityID); TextDisplay textDisplay; diff --git a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp index 28879613f5..76d4711573 100644 --- a/libraries/entities-renderer/src/RenderableTextEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableTextEntityItem.cpp @@ -214,6 +214,7 @@ void TextEntityRenderer::doRender(RenderArgs* args) { QSizeF TextEntityRenderer::textSize(const QString& text) const { auto extents = _textRenderer->computeExtent(text); + extents.y *= 2.0f; float maxHeight = (float)_textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO; float pointToWorldScale = (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight;