Is it possible to get the viewport position so I can make objects appear in view rather than somewhere off the screen?

In essence, I allow my users to add a Pin into their screen. However, if they add this pin and they’re all the way at the bottom of the page, the pin appears on top or elsewhere and they can’t see it so they think there’s an error and it didn’t create, when in fact it’s somewhere down or above they’d need to scroll to in order to see it.

So I want to get the viewport position or something that tells me at what appoximated x/y coordinate the user is currently viewing the page so I can move the pin (I have a plugin to move things to x/y coordinate) in front of them when it’s created. Otherwise I have to scroll around and look for the pin :confused: but I can’t figure out how to get the coordinates I need to move it to.

EX: When the pin is added, it goes to the bottom rather than within view. The gray zone is the rest of the screen not in view.

you could create a floating group with the pin inside and a conditional when it should be visible.

another way would be to use custom css and make the pin sticky.

The issue is that many pins can be created to be placed around the screen, so because it’s a repeating group they show at the bottom/end of the page… These pins can then be dragged around. I just can’t figure out what position to move them into that’s in the viewport :frowning:

Because the idea is that one gets created and I run a workflow to run “pin to x,y”, a coordinate in viewport. But how do I figure this out?

I also tried adding many viewport elements of various heights so that when they came to view I’d move the new pin to nearest viewport’s coordinates but… I couldn’t get it to work for some reason… I don’t know honestly.

… anyone? Any pointers are fine, even if its to look into some code :slight_smile: