react-babylonjs icon indicating copy to clipboard operation
react-babylonjs copied to clipboard

rectangle onPointerDownObservable removed after first pointerDown event

Open AJamesPhillips opened this issue 2 years ago • 1 comments

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.

A demo of this is here.

AJamesPhillips avatar Jun 09 '22 22:06 AJamesPhillips

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?

brianzinn avatar Jun 10 '22 00:06 brianzinn

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.

brianzinn avatar Aug 29 '22 19:08 brianzinn