I hope I didn’t read the official documentation too quick…
I ran today into a quite old forum comment from @RaananWhere where Raanan wrote that onPointerUp is technically deprecated.
To this day, I still use this syntax over Observables sometimes, typically when it results in cleaner code.
Should I strive for systematically using the Observables pattern nowadays?
And while I’m at it: is there any performance difference between the two approaches? (I’m thinking in particular when events are fired at high frequency e.g. pointer movement events.)
We never really deprecated it, but we did provide a better API. As we guaranty backwards-compatibility, those APIs will stay there for as long as you use the current packages we provide.
We recommend using the observables, as we believe this is the better architecture for your application. One of the reasons is that by setting onPointerUp you are changing the babylon context (adding a function to the BABYLON namespace), whereas when you use observables you attach yourself to an already-existing observable.
But, eventually - use whatever you feel fits your application. Those function definitions will not be removed from the scene
Back in 2018-9, there was. I remember having an exchange with @Deltakosh back then. So, I left it out but I have to admit I never tried again since. That’s why I’m asking. Obviously, I understand from your answer that everything should be fine now?
@RaananW I noticed that when using a gui element and webxr on the device,
GuiElement.onPointerDownObservable triggers naturally and provides info needed to do things.
GuiElement.onPointerMoveObservable does not actually trigger.
I’m trying to use these in the buttons as listeners instead of implementing the controllers manually and recreating an event system that probably already exists…
have any suggestions?
Borrowing code from InputText and using it in InputTextArea seemed to work, I did it sloppy though, via overriding, but it definitely seems like a bug.
In the meantime, I also noticed that the only Button press even that is fired is the trigger press.
Is there a way to get grib press, other buttons and register them properly with the Observer system that babylons GUI uses? I’m trying to avoid manually handling events.