Skip to content

Commit

Permalink
add scrollTo() overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
xzel23 committed Jan 5, 2025
1 parent ef86e62 commit a0aa55a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,19 @@ public void scrollTo(PositionInItem pos) {
}
}

/**
* Scrolls the PinBoard to the specified position within an item.
*
* @param pos the position within an item to scroll to
* @param relativeXinVP the relative position inside the viewport, a value between 0 and 1, i.e., 0 left, 1 right
* @param relativeYinVP the relative position inside the viewport, a value between 0 and 1, i.e., 0 top, 1 bottom
*/
public void scrollTo(PositionInItem pos, double relativeXinVP, double relativeYinVP) {
if (getSkin() instanceof PinBoardSkin skin) {
skin.scrollTo(pos, relativeXinVP, relativeYinVP);
}
}

/**
* Scrolls the PinBoard the specified position into view.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ public void scrollTo(PinBoard.PositionInItem pos) {
scrollTo(toBoardPosition(pos));
}

/**
* Scrolls the PinBoard to the position specified by {@link PinBoard.PositionInItem}.
*
* @param pos the position within an item on the PinBoard. This includes the item information
* and its coordinates, relative to its area on the board.
* @param relativeXinVP the relative position inside the viewport, a value between 0 and 1, i.e., 0 left, 1 right
* @param relativeYinVP the relative position inside the viewport, a value between 0 and 1, i.e., 0 top, 1 bottom
*/
public void scrollTo(PinBoard.PositionInItem pos, double relativeXinVP, double relativeYinVP) {
PinBoard.BoardPosition bp = toBoardPosition(pos);
scrollTo(bp.x(), bp.y(), relativeXinVP, relativeYinVP);
}

/**
* Scrolls the specified position relative to an item into the visible area of the PinBoard.
* The method internally converts the given position to a board position and scrolls it into view.
Expand Down

0 comments on commit a0aa55a

Please sign in to comment.