Skip to content

Commit

Permalink
StyledTextAreaBehavior VirtualFlow references (view) changed to Style…
Browse files Browse the repository at this point in the history
…dTextArea reference (area).
  • Loading branch information
JordanMartinez committed Nov 23, 2015
1 parent cfee3b7 commit 3f00de3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public <C> StyledTextArea(S initialStyle, BiConsumer<? super TextExt, S> applySt
: EventStreams.never())
.subscribe(evt -> Event.fireEvent(this, evt));

new StyledTextAreaBehavior(this, virtualFlow);
new StyledTextAreaBehavior(this);
getChildren().add(virtualFlow);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ private enum DragState {
* ********************************************************************** */

private final StyledTextArea<?, ?> area;
private final VirtualFlow<?, ?> view;

private final Subscription subscription;

Expand Down Expand Up @@ -213,9 +212,8 @@ private CaretOffsetX getTargetCaretOffset() {
* Constructors *
* ********************************************************************** */

StyledTextAreaBehavior(StyledTextArea<?, ?> area, VirtualFlow<?, ?> view) {
StyledTextAreaBehavior(StyledTextArea<?, ?> area) {
this.area = area;
this.view = view;

EventHandler<? super KeyEvent> keyPressedHandler = KEY_PRESSED_TEMPLATE.bind(this);
EventHandler<? super KeyEvent> keyTypedHandler = KEY_TYPED_TEMPLATE.bind(this);
Expand All @@ -236,7 +234,7 @@ private CaretOffsetX getTargetCaretOffset() {
// setup auto-scroll
Val<Point2D> projection = Val.combine(
autoscrollTo,
view.layoutBoundsProperty(),
area.layoutBoundsProperty(),
StyledTextAreaBehavior::project);
Val<Point2D> distance = Val.combine(
autoscrollTo,
Expand Down Expand Up @@ -461,7 +459,7 @@ private void mouseDragged(MouseEvent e) {
}

Point2D p = new Point2D(e.getX(), e.getY());
if(view.getLayoutBounds().contains(p)) {
if(area.getLayoutBounds().contains(p)) {
dragTo(p);
autoscrollTo.setValue(null); // stops auto-scroll
} else {
Expand Down

0 comments on commit 3f00de3

Please sign in to comment.