From 3ea3a497c64396bef3444a00fa2bca447797e964 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 9 Dec 2014 18:33:29 -0800 Subject: [PATCH] Update scripts to use new textSize() method --- examples/editModels.js | 4 ++-- examples/lobby.js | 2 +- examples/newEditEntities.js | 4 ++-- examples/virtualKeyboard.js | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/editModels.js b/examples/editModels.js index c961d55bed..e0ade3b6a3 100644 --- a/examples/editModels.js +++ b/examples/editModels.js @@ -1191,8 +1191,8 @@ var toolBar = (function () { visible: false }); - menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"), - Overlays.textWidth(loadFileMenuItem, "Model File")) + 20; + menuItemWidth = Math.max(Overlays.textSize(loadURLMenuItem, "Model URL").width, + Overlays.textSize(loadFileMenuItem, "Model File").width) + 20; Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth }); Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth }); diff --git a/examples/lobby.js b/examples/lobby.js index dd011d08a4..a1f161d8a5 100644 --- a/examples/lobby.js +++ b/examples/lobby.js @@ -331,7 +331,7 @@ function handleLookAt(pickRay) { } else { currentTestLine = allWords[currentTestWord]; } - var lineLength = Overlays.textWidth(descriptionText, currentTestLine); + var lineLength = Overlays.textSize(descriptionText, currentTestLine).width; if (lineLength < textWidth || wordsOnLine == 0) { wordsFormated++; currentTestWord++; diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index 43e304a76d..e9f42bf74c 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -159,8 +159,8 @@ var toolBar = (function () { visible: false }); - menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"), - Overlays.textWidth(loadFileMenuItem, "Model File")) + 20; + menuItemWidth = Math.max(Overlays.textSize(loadURLMenuItem, "Model URL").width, + Overlays.textSize(loadFileMenuItem, "Model File").width) + 20; Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth }); Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth }); diff --git a/examples/virtualKeyboard.js b/examples/virtualKeyboard.js index c89dc6fb04..ce793c6ea0 100644 --- a/examples/virtualKeyboard.js +++ b/examples/virtualKeyboard.js @@ -80,7 +80,7 @@ function updateTextOverlay() { var textLines = textText.split("\n"); var maxLineWidth = 0; for (textLine in textLines) { - var lineWidth = Overlays.textWidth(text, textLines[textLine]); + var lineWidth = Overlays.textSize(text, textLines[textLine]).width; if (lineWidth > maxLineWidth) { maxLineWidth = lineWidth; } @@ -92,7 +92,7 @@ function updateTextOverlay() { Overlays.editOverlay(text, {text: textText, font: {size: textFontSize}, topMargin: topMargin}); var maxLineWidth = 0; for (textLine in textLines) { - var lineWidth = Overlays.textWidth(text, textLines[textLine]); + var lineWidth = Overlays.textSize(text, textLines[textLine]).width; if (lineWidth > maxLineWidth) { maxLineWidth = lineWidth; } @@ -122,18 +122,18 @@ keyboard.onKeyRelease = function(event) { var textLines = textText.split("\n"); var maxLineWidth = 0; for (textLine in textLines) { - var lineWidth = Overlays.textWidth(textSizeMeasureOverlay, textLines[textLine]); + var lineWidth = Overlays.textSize(textSizeMeasureOverlay, textLines[textLine]).width; if (lineWidth > maxLineWidth) { maxLineWidth = lineWidth; } } var usernameLine = "--" + GlobalServices.myUsername; - var usernameWidth = Overlays.textWidth(textSizeMeasureOverlay, usernameLine); + var usernameWidth = Overlays.textSize(textSizeMeasureOverlay, usernameLine).width; if (maxLineWidth < usernameWidth) { maxLineWidth = usernameWidth; } else { var spaceableWidth = maxLineWidth - usernameWidth; - var spaceWidth = Overlays.textWidth(textSizeMeasureOverlay, " "); + var spaceWidth = Overlays.textSize(textSizeMeasureOverlay, " ").width; var numberOfSpaces = Math.floor(spaceableWidth / spaceWidth); for (var i = 0; i < numberOfSpaces; i++) { usernameLine = " " + usernameLine;