Marc Plano-Lesay 12 лет назад
Родитель
Сommit
0c0768a093
1 измененных файлов с 8 добавлено и 5 удалено
  1. 8 5
      gameplay/src/TextBox.cpp

+ 8 - 5
gameplay/src/TextBox.cpp

@@ -130,11 +130,14 @@ bool TextBox::keyEvent(Keyboard::KeyEvent evt, int key)
                 }
                 case Keyboard::KEY_HOME:
                 {
-                    // TODO: Move cursor to beginning of line.
-                    // This only works for left alignment...
-                        
-                    //_caretLocation.x = _viewportClipBounds.x;
-                    //_dirty = true;
+                    Font* font = getFont(_state);
+                    GP_ASSERT(font);
+                    unsigned int fontSize = getFontSize(_state);
+                    Font::Justify textAlignment = getTextAlignment(_state);
+                    bool rightToLeft = getTextRightToLeft(_state);
+                    font->getLocationAtIndex(getDisplayedText().c_str(), _textBounds, fontSize, &_caretLocation, 0,
+                        textAlignment, true, rightToLeft);
+                    _dirty = true;
                     break;
                 }
                 case Keyboard::KEY_END: