I have User Widget Added to Viewport that the User can Drag in Viewport.
When clicked, the Widget is draggable (Uses Tick), and sets the Widget Position in Viewport to Mouse Position in Viewport.
I have a variable “MouseOffset” that is set on Widget Button Pressed, and uses the Tick Space Geometry to get the geometry of the widget to subtract it from the Mouse Position in Viewport and store this value. This is so that on tick, I can use this offset to properly set the Widget Position in Viewport to prevent the Widget from “Popping” to the Mouse Position.
This is working great, except the first time the Widget Button is Pressed, it pops to the Viewport (0,0) Position, and then after that works as expected. I assume this is because I am setting the MouseOffset on Widget Button Down event with Tick Space Geometry (Cached Geometry does same) and there are no valus et for the Widget Geometry at that point?
I can print string the Local to Viewport value of the Geometry On Pressed, and the first press on widget, prints X=0 Y=0; then after release and a 2nd pressed event on widget, the print string will return a proper value?
I tried setting a Variable “Geometry” On Construct Event using a Delay(0.0) Node to get the value in the next tick after On Construct, and then use a Do Once Node, to use that value the first time, however, this did not work.
If I set delay to 0.04 I can get a result that is in viewport (0,0)
The red Dot in corner is a DebugWidget created when panel is created and its position in viewport set as shown in above code image
How can I prevent the Dragggable Widget from Popping to this location on the first Button Down if I cannot get Proper Geometry for the Widget?