react-babylonjs
react-babylonjs copied to clipboard
rectangle onPointerDownObservable removed after first pointerDown event
I don't know if this is intentional but a <rectangle onPointerDownObservable={() => { /*...*/ }}
and the onPointerDownObservable handler is only triggered once. Further pointer down events are ignored.
If rectangle
is replaced by babylon-button
then it can be clicked multiple times and fire the handler each time.
Here is the code that is updating the observable callback: https://github.com/brianzinn/react-babylonjs/blob/master/packages/react-babylonjs/src/UpdateInstance.ts#L58
Looks like it should work. Since you have a key
prop then the reconciler should keep that one and re-assign the callback. Calling set_chosen_home
triggers a re-render. I can see the code, but not what is happening in practice - I wonder if resizing and changing padding is a bug in GUI package for the pointer down event. Do you have time to make a regular imperative babylon.js PG or inspect the observables?
closing as it appears to be a bug in downstream project in babylon 4.2 only. not going to add a workaround in this library. please re-open if your question is still unanswered.