mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +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
|
visible: false
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"),
|
menuItemWidth = Math.max(Overlays.textSize(loadURLMenuItem, "Model URL").width,
|
||||||
Overlays.textWidth(loadFileMenuItem, "Model File")) + 20;
|
Overlays.textSize(loadFileMenuItem, "Model File").width) + 20;
|
||||||
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
|
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
|
||||||
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
|
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ function handleLookAt(pickRay) {
|
||||||
} else {
|
} else {
|
||||||
currentTestLine = allWords[currentTestWord];
|
currentTestLine = allWords[currentTestWord];
|
||||||
}
|
}
|
||||||
var lineLength = Overlays.textWidth(descriptionText, currentTestLine);
|
var lineLength = Overlays.textSize(descriptionText, currentTestLine).width;
|
||||||
if (lineLength < textWidth || wordsOnLine == 0) {
|
if (lineLength < textWidth || wordsOnLine == 0) {
|
||||||
wordsFormated++;
|
wordsFormated++;
|
||||||
currentTestWord++;
|
currentTestWord++;
|
||||||
|
|
|
@ -159,8 +159,8 @@ var toolBar = (function () {
|
||||||
visible: false
|
visible: false
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItemWidth = Math.max(Overlays.textWidth(loadURLMenuItem, "Model URL"),
|
menuItemWidth = Math.max(Overlays.textSize(loadURLMenuItem, "Model URL").width,
|
||||||
Overlays.textWidth(loadFileMenuItem, "Model File")) + 20;
|
Overlays.textSize(loadFileMenuItem, "Model File").width) + 20;
|
||||||
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
|
Overlays.editOverlay(loadURLMenuItem, { width: menuItemWidth });
|
||||||
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
|
Overlays.editOverlay(loadFileMenuItem, { width: menuItemWidth });
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ function updateTextOverlay() {
|
||||||
var textLines = textText.split("\n");
|
var textLines = textText.split("\n");
|
||||||
var maxLineWidth = 0;
|
var maxLineWidth = 0;
|
||||||
for (textLine in textLines) {
|
for (textLine in textLines) {
|
||||||
var lineWidth = Overlays.textWidth(text, textLines[textLine]);
|
var lineWidth = Overlays.textSize(text, textLines[textLine]).width;
|
||||||
if (lineWidth > maxLineWidth) {
|
if (lineWidth > maxLineWidth) {
|
||||||
maxLineWidth = lineWidth;
|
maxLineWidth = lineWidth;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ function updateTextOverlay() {
|
||||||
Overlays.editOverlay(text, {text: textText, font: {size: textFontSize}, topMargin: topMargin});
|
Overlays.editOverlay(text, {text: textText, font: {size: textFontSize}, topMargin: topMargin});
|
||||||
var maxLineWidth = 0;
|
var maxLineWidth = 0;
|
||||||
for (textLine in textLines) {
|
for (textLine in textLines) {
|
||||||
var lineWidth = Overlays.textWidth(text, textLines[textLine]);
|
var lineWidth = Overlays.textSize(text, textLines[textLine]).width;
|
||||||
if (lineWidth > maxLineWidth) {
|
if (lineWidth > maxLineWidth) {
|
||||||
maxLineWidth = lineWidth;
|
maxLineWidth = lineWidth;
|
||||||
}
|
}
|
||||||
|
@ -122,18 +122,18 @@ keyboard.onKeyRelease = function(event) {
|
||||||
var textLines = textText.split("\n");
|
var textLines = textText.split("\n");
|
||||||
var maxLineWidth = 0;
|
var maxLineWidth = 0;
|
||||||
for (textLine in textLines) {
|
for (textLine in textLines) {
|
||||||
var lineWidth = Overlays.textWidth(textSizeMeasureOverlay, textLines[textLine]);
|
var lineWidth = Overlays.textSize(textSizeMeasureOverlay, textLines[textLine]).width;
|
||||||
if (lineWidth > maxLineWidth) {
|
if (lineWidth > maxLineWidth) {
|
||||||
maxLineWidth = lineWidth;
|
maxLineWidth = lineWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var usernameLine = "--" + GlobalServices.myUsername;
|
var usernameLine = "--" + GlobalServices.myUsername;
|
||||||
var usernameWidth = Overlays.textWidth(textSizeMeasureOverlay, usernameLine);
|
var usernameWidth = Overlays.textSize(textSizeMeasureOverlay, usernameLine).width;
|
||||||
if (maxLineWidth < usernameWidth) {
|
if (maxLineWidth < usernameWidth) {
|
||||||
maxLineWidth = usernameWidth;
|
maxLineWidth = usernameWidth;
|
||||||
} else {
|
} else {
|
||||||
var spaceableWidth = maxLineWidth - usernameWidth;
|
var spaceableWidth = maxLineWidth - usernameWidth;
|
||||||
var spaceWidth = Overlays.textWidth(textSizeMeasureOverlay, " ");
|
var spaceWidth = Overlays.textSize(textSizeMeasureOverlay, " ").width;
|
||||||
var numberOfSpaces = Math.floor(spaceableWidth / spaceWidth);
|
var numberOfSpaces = Math.floor(spaceableWidth / spaceWidth);
|
||||||
for (var i = 0; i < numberOfSpaces; i++) {
|
for (var i = 0; i < numberOfSpaces; i++) {
|
||||||
usernameLine = " " + usernameLine;
|
usernameLine = " " + usernameLine;
|
||||||
|
|
Loading…
Reference in a new issue