Skip to content

Commit

Permalink
Another deletion option: before 1st visible cell & partially into vie…
Browse files Browse the repository at this point in the history
…wport
  • Loading branch information
JordanMartinez committed Mar 28, 2017
1 parent 3658c32 commit 22da999
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/fxmisc/flowless/TargetPosition.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public TargetPosition transformByChange(
if(itemIndex >= pos + removedSize) {
// change before the target item, just update item index
return new StartOffStart(itemIndex - removedSize + addedSize, offsetFromStart);
} else if (pos <= itemIndex && itemIndex <= pos + removedSize) {
// deletion occurred before viewport and partially into it, so update the item index
return new StartOffStart(itemIndex - removedSize + addedSize, offsetFromStart);
} else if(itemIndex >= pos) {
// target item deleted, show the first inserted at the target offset
return new StartOffStart(pos, offsetFromStart);
Expand Down

0 comments on commit 22da999

Please # to comment.