#How do I get the current position of a custom node inside the custom node?

1 messages · Page 1 of 1 (latest)

last crystal
#

Not sure if I'm just being stupid, but I can't seem to figure out how to do this without just using useNodes and looping through the array it gives you. I've tried using useReactFlow hook but not sure how do get that to work inside a custom node.

I've also tried accessing the positionAbsoluteX and positionAbsoluteY props however, those don't seem to be updated dynamically.

feral venture
last crystal
#

Here's how i'm doing it, i've removed every irrelavent peice of code:

feral venture
#

is your node visible? any other errors/messages in the console that you're aware of?

last crystal
#

WAIT nvm I was bing a complete an utter idiot. Idk i didn't so it earlier, but i printed out all the props just now and the variable was stored ins xPos and yPos rather than positionAbosluteX and Y.

#

Althought its strange the docs don't mention this

#

I was just going off of the NodeProps page, so I never thought to investigate what was actually getting passed into my componenet

#

If you don't mind, could you explain why it is using xPos and yPos for me? I curious why there is a descrpency between my code and the docs

#

@feral venture Here's what my props object looks like

#

virutaly identical to the one on the docs, except with different names for position varaiables

feral venture
#

are you on v11?

last crystal
#

oooh i'm on 10.7, that's probably why

feral venture
#

yeah, the docs are for v12 ^^