fix chat.js textSize

This commit is contained in:
SamGondelman 2019-02-28 15:24:32 -08:00
parent 72f198fe00
commit 8d5a3debfa

View file

@ -45,6 +45,17 @@
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 var SPEECH_BUBBLE_MAX_WIDTH = 1; // meters
var textSizeOverlay = Overlays.addOverlay("text3d", {
position: MyAvatar.position,
lineHeight: speechBubbleLineHeight,
leftMargin: 0,
topMargin: 0,
rightMargin: 0,
bottomMargin: 0,
ignoreRayIntersection: true,
visible: false
});
// Load the persistent variables from the Settings, with defaults. // Load the persistent variables from the Settings, with defaults.
function loadSettings() { function loadSettings() {
chatName = Settings.getValue('Chat_chatName', MyAvatar.displayName); chatName = Settings.getValue('Chat_chatName', MyAvatar.displayName);
@ -63,6 +74,9 @@
speechBubbleOffset = Settings.getValue('Chat_speechBubbleOffset', {x: 0.0, y: 0.3, z:0.0}); speechBubbleOffset = Settings.getValue('Chat_speechBubbleOffset', {x: 0.0, y: 0.3, z:0.0});
speechBubbleJointName = Settings.getValue('Chat_speechBubbleJointName', 'Head'); speechBubbleJointName = Settings.getValue('Chat_speechBubbleJointName', 'Head');
speechBubbleLineHeight = Settings.getValue('Chat_speechBubbleLineHeight', 0.05); speechBubbleLineHeight = Settings.getValue('Chat_speechBubbleLineHeight', 0.05);
Overlays.editOverlay(textSizeOverlay, {
lineHeight: speechBubbleLineHeight
});
saveSettings(); saveSettings();
} }
@ -637,7 +651,7 @@
// Only overlay text3d has a way to measure the text, not entities. // Only overlay text3d has a way to measure the text, not entities.
// So we make a temporary one just for measuring text, then delete it. // So we make a temporary one just for measuring text, then delete it.
var speechBubbleTextOverlayID = Overlays.addOverlay("text3d", speechBubbleParams); var speechBubbleTextOverlayID = Overlays.addOverlay("text3d", speechBubbleParams);
var textSize = Overlays.textSize(speechBubbleTextOverlayID, speechBubbleMessage); var textSize = Overlays.textSize(textSizeOverlay, speechBubbleMessage);
try { try {
Overlays.deleteOverlay(speechBubbleTextOverlayID); Overlays.deleteOverlay(speechBubbleTextOverlayID);
} catch (e) {} } catch (e) {}
@ -971,6 +985,8 @@
unidentifyAvatars(); unidentifyAvatars();
disconnectWebHandler(); disconnectWebHandler();
Overlays.deleteOverlay(textSizeOverlay);
if (onChatPage) { if (onChatPage) {
tablet.gotoHomeScreen(); tablet.gotoHomeScreen();
onChatPage = false; onChatPage = false;