I searched around to see if there are any examples of this code being used, but no one ever seemed to get an answer when asking if this was even functional. If it is functional, what is the best way to implement this class on an existing element in code?
Thank you @yaustar. I’ve been fiddling with calling the constructor in events,variables, and just plainly in the initialize scripts, but no luck. That’s from sheer ignorance on my part, I’m sure.
There appears to be a bug, preventing the draggable to work under root screen, so I nested it under another screen (can be any screen element). I will make a github issue about it.
Thank you very much for the example. It didn’t work at first, but I immediately realized my failure. I had been forgetting to activate ‘Use Input’ on the image element. Activating it made everything work.
Then out of curiosity, I tried simply making a script that held
this._handleDragHelper = new pc.ElementDragHelper(this.entity.element, 'y');
in the initialize function. It worked. I feel a little dumb, but I appreciate your help!