Exemplo n.º 1
0
 public int getAbsoluteY(TextLocation location) {
   int height = 0;
   for (int i = 0; i < location.line; i++) {
     TypedLayout layout = getLines().get(i);
     height += layout.getHeightWithLeading();
   }
   return height;
 }
Exemplo n.º 2
0
  public void moveCaretToNewLine(int lineDelta) {
    ArrayList<TypedLayout> lines = getLines();
    int newLineNumber = caretLocation.line + lineDelta;
    if (newLineNumber >= 0 && newLineNumber < lines.size()) {
      TextLocation origin = verticalOrigin != null ? verticalOrigin : caretLocation;
      int desiredX = lines.get(origin.line).getX(origin.index);

      TypedLayout newLine = lines.get(newLineNumber);
      int newIndex = newLine.getIndexAt(desiredX);

      TextLocation newLocation = TextLocation.at(newLineNumber, newIndex);
      setCaretLocation(newLocation);

      verticalOrigin = origin;
    }
  }
Exemplo n.º 3
0
 public int getXOffset(TypedLayout line) {
   HorizontalAlignmentValue horizontalAlignment =
       getContainer().getStyle().getCompiledHorizontalAlignment();
   return horizontalAlignment.getX(line.getWidth(), getContainer().getBounds());
 }
Exemplo n.º 4
0
 public void sendCaretToEndOfLine() {
   final TextLocation caret = getCaretLocation();
   TypedLayout caretLine = getLines().get(caret.line);
   setCaretLocation(TextLocation.at(caret.line, caretLine.visibleLength()));
 }