Skip to content

Commit

Permalink
Issue #42: Update calculating the padding of line number to solve ove…
Browse files Browse the repository at this point in the history
…rlap problem
  • Loading branch information
AmrDeveloper committed Mar 27, 2023
1 parent e002f3d commit d91c2ac
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,9 @@ protected void onDraw(Canvas canvas) {
}
}

// Calculate padding depending on current line number
final int paddingLeft = 50 + (int) Math.log10(lineCount) * 10;
// Calculate padding depending on number of lines and the size of line number text
final int lineNumberDigitCount = (int) (Math.log10(lineCount) + 1);
final int paddingLeft = (int) (lineNumberPaint.getTextSize() * lineNumberDigitCount);
setPadding(paddingLeft, getPaddingTop(), getPaddingRight(), getPaddingBottom());
}
}
Expand Down Expand Up @@ -638,7 +639,7 @@ public void setLineNumberTextColor(int color) {

/**
* Modify the line number text size
* @param size The new size value
* @param size The new text size in pixel units
* @since 1.1.0
*/
public void setLineNumberTextSize(float size) {
Expand Down

0 comments on commit d91c2ac

Please sign in to comment.