I’m working on implementing some draggable UI elements in a project, and I came across this in the api reference:
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 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!