mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-06 00:02:16 +02:00
Merge pull request #11055 from misslivirose/fix-chat-bubble-length
Fix chat bubble length
This commit is contained in:
commit
0f73496a44
1 changed files with 11 additions and 1 deletions
|
@ -43,6 +43,7 @@
|
||||||
var speechBubbleOffset = {x: 0, y: 0.3, z: 0.0}; // The offset from the joint to whic the speech bubble is attached.
|
var speechBubbleOffset = {x: 0, y: 0.3, z: 0.0}; // The offset from the joint to whic the speech bubble is attached.
|
||||||
var speechBubbleJointName = 'Head'; // The name of the joint to which the speech bubble is attached.
|
var speechBubbleJointName = 'Head'; // The name of the joint to which the speech bubble is attached.
|
||||||
var speechBubbleLineHeight = 0.05; // The height of a line of text in the speech bubble.
|
var speechBubbleLineHeight = 0.05; // The height of a line of text in the speech bubble.
|
||||||
|
var SPEECH_BUBBLE_MAX_WIDTH = 1; // meters
|
||||||
|
|
||||||
// Load the persistent variables from the Settings, with defaults.
|
// Load the persistent variables from the Settings, with defaults.
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
|
@ -645,8 +646,16 @@
|
||||||
//print("updateSpeechBubble:", "speechBubbleMessage", speechBubbleMessage, "textSize", textSize.width, textSize.height);
|
//print("updateSpeechBubble:", "speechBubbleMessage", speechBubbleMessage, "textSize", textSize.width, textSize.height);
|
||||||
|
|
||||||
var fudge = 0.02;
|
var fudge = 0.02;
|
||||||
|
|
||||||
var width = textSize.width + fudge;
|
var width = textSize.width + fudge;
|
||||||
var height = textSize.height + fudge;
|
var height = speechBubbleLineHeight + fudge;
|
||||||
|
|
||||||
|
if (textSize.width >= SPEECH_BUBBLE_MAX_WIDTH) {
|
||||||
|
var numLines = Math.ceil(width);
|
||||||
|
height = speechBubbleLineHeight * numLines + fudge;
|
||||||
|
width = SPEECH_BUBBLE_MAX_WIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
dimensions = {
|
dimensions = {
|
||||||
x: width,
|
x: width,
|
||||||
y: height,
|
y: height,
|
||||||
|
@ -672,6 +681,7 @@
|
||||||
Vec3.sum(
|
Vec3.sum(
|
||||||
headPosition,
|
headPosition,
|
||||||
rotatedOffset);
|
rotatedOffset);
|
||||||
|
position.y += height / 2; // offset based on half of bubble height
|
||||||
speechBubbleParams.position = position;
|
speechBubbleParams.position = position;
|
||||||
|
|
||||||
if (!speechBubbleTextID) {
|
if (!speechBubbleTextID) {
|
||||||
|
|
Loading…
Reference in a new issue