mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 19:42:17 +02:00
better text selection
This commit is contained in:
parent
b1e47ee0bd
commit
336821c520
2 changed files with 10 additions and 6 deletions
|
@ -160,7 +160,7 @@ public final class FBView extends ZLTextView {
|
||||||
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y, maxSelectionDistance());
|
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y, maxSelectionDistance());
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
myReader.runAction(ActionCode.SELECTION_HIDE_PANEL);
|
myReader.runAction(ActionCode.SELECTION_HIDE_PANEL);
|
||||||
moveSelectionCursorTo(cursor, x, y);
|
moveSelectionCursorTo(cursor, x, y, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ public final class FBView extends ZLTextView {
|
||||||
|
|
||||||
final ZLTextSelectionCursor cursor = getSelectionCursorInMovement();
|
final ZLTextSelectionCursor cursor = getSelectionCursorInMovement();
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
moveSelectionCursorTo(cursor, x, y);
|
moveSelectionCursorTo(cursor, x, y, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public final class FBView extends ZLTextView {
|
||||||
initSelection(x, y);
|
initSelection(x, y);
|
||||||
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y);
|
final ZLTextSelectionCursor cursor = findSelectionCursor(x, y);
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
moveSelectionCursorTo(cursor, x, y);
|
moveSelectionCursorTo(cursor, x, y, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case selectSingleWord:
|
case selectSingleWord:
|
||||||
|
@ -299,7 +299,7 @@ public final class FBView extends ZLTextView {
|
||||||
|
|
||||||
final ZLTextSelectionCursor cursor = getSelectionCursorInMovement();
|
final ZLTextSelectionCursor cursor = getSelectionCursorInMovement();
|
||||||
if (cursor != ZLTextSelectionCursor.None) {
|
if (cursor != ZLTextSelectionCursor.None) {
|
||||||
moveSelectionCursorTo(cursor, x, y);
|
moveSelectionCursorTo(cursor, x, y, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,8 +327,12 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void moveSelectionCursorTo(ZLTextSelectionCursor cursor, int x, int y) {
|
protected void moveSelectionCursorTo(ZLTextSelectionCursor cursor, int x, int y, boolean inMovement) {
|
||||||
y -= ZLTextSelectionCursor.getHeight() / 2 + ZLTextSelectionCursor.getAccent() / 2;
|
if (inMovement) {
|
||||||
|
y -= ZLTextSelectionCursor.getHeight() / 2 + ZLTextSelectionCursor.getAccent() / 2;
|
||||||
|
} else {
|
||||||
|
y -= getTextStyleCollection().getBaseStyle().getFontSize() / 2;
|
||||||
|
}
|
||||||
mySelection.setCursorInMovement(cursor, x, y);
|
mySelection.setCursorInMovement(cursor, x, y);
|
||||||
mySelection.expandTo(myCurrentPage, x, y);
|
mySelection.expandTo(myCurrentPage, x, y);
|
||||||
Application.getViewWidget().reset();
|
Application.getViewWidget().reset();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue