Skip to content

ref(node): add pinpoint(x:, y:, position:), deprecate find_position - #726

Merged
route merged 1 commit into
mainfrom
ref/node-pinpoint
Nov 24, 2026
Merged

route merged 1 commit into
mainfrom
ref/node-pinpoint

Conversation

@route

@route route commented Nov 24, 2026

Copy link
Copy Markdown
Member
node.pinpoint                            # => [126.7, 401.4], the center, was find_position
node.pinpoint(x: 5, y: 5)                # => [131.7, 406.4], from the center
node.pinpoint(x: 5, y: 5, position: :top) # => [55.2, 395.9], from the top-left corner
node.pinpoint(x: 5)                      # one offset applies, find_position ignored it
node.click(offset: { x: 10, y: 20 })     # from the center now, was the top-left corner
  • pinpoint returns the point a click on the node lands on. find_position didn't find anything, and it only applied offsets when both were given and dropped them when the node had no box. pinpoint applies whatever it gets in both cases.
  • x and y are an offset from the center by default, or from the top-left corner with position: :top. Any other position raises ArgumentError.
  • click(offset:) and hover(offset:) pass their hash to pinpoint as is, so their offsets are measured from the center unless position: :top is given.
  • find_position keeps its old behavior and warns until 0.22.

find_position computes the point a click lands on rather than finding anything, ignored a single offset and dropped offsets in its bounding rect fallback. pinpoint measures x and y from the center by default or the top-left corner with position: :top, applies any offset and the fallback honors it. click and hover pass their offset: hash to it unchanged, so their offsets are now measured from the center by default.
@route
route merged commit 2553e42 into main Nov 24, 2026
7 checks passed
@route
route deleted the ref/node-pinpoint branch November 24, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant