MG
Size: a a a
MG
AM
min(line_count, max_lines)
to find out the number of lines to drawMG
boolean hitBottom = false;
public void setOffsetY(int y) {
LineStats lineStats = textStats.lines.get(textStats.lineCount-1);
if (y <= (lineStats.yOffset + y)) {
float offset = y;
float heightOffset = lineStats.maxHeightF + offset;
boolean bottom = lineStats.bounds.bottom <= heightOffset;
if (!bottom) {
Log.d(TAG, "setOffsetY() called with: y = [" + y + "]");
offset_y = y;
hitBottom = false;
} else {
if (!hitBottom) {
Log.d(TAG, "setOffsetY() called with: y = [" + y + "]");
offset_y = y;
hitBottom = true;
}
}
}
}
AM
MG
MG
offset_y = lineStats.bounds.bottom - lineStats.maxHeight;
hitBottom = true;
MG
public void setOffsetY(int y) {
LineStats lineStats = textStats.lines.get(textStats.lineCount-1);
offset_y = Math.min(y, lineStats.bounds.bottom - lineStats.maxHeight);
}
MG
public void setOffsetX(int x) {
if (x < 0) {
offset_x = 0;
} else {
// to deal with x, we need only obtain the line with the longest width
LineStats lineStats = textStats.getLineWithLongestWidth();
if (lineStats != null) {
// our line's width may be smaller than our screen screen width
if (lineStats.bounds.right > lineStats.maxWidth) {
offset_x = Math.min(x, lineStats.bounds.right - lineStats.maxWidth);
} else {
offset_x = Math.min(x, lineStats.bounds.right);
}
}
}
}
public void setOffsetY(int y) {
if (y < 0) {
offset_y = 0;
} else {
// to deal with y, we need only obtain the line with the longest total height
// this is always the last line
LineStats lineStats = textStats.getLastLine();
if (lineStats != null) {
// our line's height may be smaller than our screen screen height
if (lineStats.bounds.bottom > lineStats.maxHeight) {
offset_y = Math.min(y, lineStats.bounds.bottom - lineStats.maxHeight);
} else {
offset_x = Math.min(y, lineStats.bounds.bottom);
}
}
}
}
Ш
Ш
Ш
Ш
Ш
CD
Ш
Ш
CD
Ш
DK
DK