mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
fixes for the virtualKeyboardTextEntityExample
This commit is contained in:
parent
525fe7881e
commit
2c52c9c3c0
1 changed files with 12 additions and 10 deletions
|
@ -27,7 +27,7 @@ const TEXT_MARGIN_RIGHT = 0.17;
|
|||
const TEXT_MARGIN_BOTTOM = 0.17;
|
||||
|
||||
var windowDimensions = Controller.getViewportDimensions();
|
||||
var cursor = null;
|
||||
var cursor = new Cursor();
|
||||
var keyboard = new Keyboard();
|
||||
var textFontSize = 9;
|
||||
var text = null;
|
||||
|
@ -84,7 +84,9 @@ keyboard.onKeyRelease = function(event) {
|
|||
maxLineWidth = usernameWidth;
|
||||
} else {
|
||||
var spaceableWidth = maxLineWidth - usernameWidth;
|
||||
var spaceWidth = Overlays.textSize(textSizeMeasureOverlay, " ").width;
|
||||
//TODO: WORKAROUND WARNING BELOW Fix this when spaces are not trimmed out of the textsize calculation anymore
|
||||
var spaceWidth = Overlays.textSize(textSizeMeasureOverlay, "| |").width
|
||||
- Overlays.textSize(textSizeMeasureOverlay, "||").width;
|
||||
var numberOfSpaces = Math.floor(spaceableWidth / spaceWidth);
|
||||
for (var i = 0; i < numberOfSpaces; i++) {
|
||||
usernameLine = " " + usernameLine;
|
||||
|
@ -127,7 +129,7 @@ keyboard.onFullyLoaded = function() {
|
|||
});
|
||||
updateTextOverlay();
|
||||
// the cursor is being loaded after the keyboard, else it will be on the background of the keyboard
|
||||
cursor = new Cursor();
|
||||
cursor.initialize();
|
||||
cursor.onUpdate = function(position) {
|
||||
keyboard.setFocusPosition(position.x, position.y);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue