mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 21:42:24 +02:00
Update scripts to use new textSize() method
This commit is contained in:
parent
136c3a2cce
commit
3ea3a497c6
4 changed files with 10 additions and 10 deletions
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue