|
15 | 15 | import java.util.function.IntFunction; |
16 | 16 | import java.util.function.IntSupplier; |
17 | 17 | import java.util.function.IntUnaryOperator; |
18 | | -import java.util.function.UnaryOperator; |
19 | | -import java.util.stream.Collectors; |
20 | 18 |
|
21 | 19 | import javafx.beans.NamedArg; |
22 | 20 | import javafx.beans.binding.Binding; |
@@ -500,9 +498,6 @@ public Optional<Tuple2<Codec<PS>, Codec<SEG>>> getStyleCodecs() { |
500 | 498 |
|
501 | 499 | private Subscription subscriptions = () -> {}; |
502 | 500 |
|
503 | | - // Remembers horizontal position when traversing up / down. |
504 | | - private Optional<ParagraphBox.CaretOffsetX> targetCaretOffset = Optional.empty(); |
505 | | - |
506 | 501 | private final VirtualFlow<Paragraph<PS, SEG, S>, Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>>> virtualFlow; |
507 | 502 |
|
508 | 503 | // used for two-level navigation, where on the higher level are |
@@ -707,18 +702,6 @@ public GenericStyledArea( |
707 | 702 | * * |
708 | 703 | * ********************************************************************** */ |
709 | 704 |
|
710 | | - /** |
711 | | - * Returns caret bounds relative to the viewport, i.e. the visual bounds |
712 | | - * of the embedded VirtualFlow. |
713 | | - */ |
714 | | - Optional<Bounds> getCaretBoundsInViewport() { |
715 | | - return virtualFlow.getCellIfVisible(getCurrentParagraph()) |
716 | | - .map(c -> { |
717 | | - Bounds cellBounds = c.getNode().getCaretBounds(); |
718 | | - return virtualFlow.cellToViewport(c, cellBounds); |
719 | | - }); |
720 | | - } |
721 | | - |
722 | 705 | /** |
723 | 706 | * Returns x coordinate of the caret in the current paragraph. |
724 | 707 | */ |
@@ -1010,10 +993,6 @@ public void scrollBy(Point2D deltas) { |
1010 | 993 | suspendVisibleParsWhile(() -> virtualFlow.scrollBy(deltas)); |
1011 | 994 | } |
1012 | 995 |
|
1013 | | - void show(double y) { |
1014 | | - suspendVisibleParsWhile(() -> virtualFlow.show(y)); |
1015 | | - } |
1016 | | - |
1017 | 996 | @Override |
1018 | 997 | public void showParagraphInViewport(int paragraphIndex) { |
1019 | 998 | suspendVisibleParsWhile(() -> virtualFlow.show(paragraphIndex)); |
@@ -1288,11 +1267,6 @@ private Optional<Bounds> getRangeBoundsOnScreen(int paragraphIndex, int from, in |
1288 | 1267 | .map(c -> c.getNode().getRangeBoundsOnScreen(from, to)); |
1289 | 1268 | } |
1290 | 1269 |
|
1291 | | - private Optional<Bounds> getCaretBoundsOnScreen() { |
1292 | | - return virtualFlow.getCellIfVisible(getCurrentParagraph()) |
1293 | | - .map(c -> c.getNode().getCaretBoundsOnScreen()); |
1294 | | - } |
1295 | | - |
1296 | 1270 | public final Optional<Bounds> getCaretBoundsOnScreen(int paragraphIndex) { |
1297 | 1271 | return virtualFlow.getCellIfVisible(paragraphIndex) |
1298 | 1272 | .map(c -> c.getNode().getCaretBoundsOnScreen()); |
@@ -1366,7 +1340,7 @@ private void suspendVisibleParsWhile(Runnable runnable) { |
1366 | 1340 | } |
1367 | 1341 |
|
1368 | 1342 | void clearTargetCaretOffset() { |
1369 | | - targetCaretOffset = Optional.empty(); |
| 1343 | + mainCaret.clearTargetOffset(); |
1370 | 1344 | } |
1371 | 1345 |
|
1372 | 1346 | ParagraphBox.CaretOffsetX getTargetCaretOffset() { |
|
0 commit comments