react-three-fiber icon indicating copy to clipboard operation
react-three-fiber copied to clipboard

feat: enrich pointer missed event

Open saitonakamura opened this issue 4 years ago • 7 comments
trafficstars

My usecase is that I'm doing ui stuff and I have a text input and a keyboard that should when you click on an input and close when you click outside the keyboard, except for input

Thing is, I can't place keyboard as in the same group as an input, so. Reacting to click outside is easy with onPointerMissed, but stopping closing of the keyboard when you click on an input is actually hard. If we enrich the event with intersections, I can understand that certain Object3D was hit and don't close the keyboard

The change is almost backwards compatible except for the case if someone used the reference equality of the pointer event

I need some feedback on whether it's a good idea and if we want enrich it with more info

saitonakamura avatar Oct 05 '21 11:10 saitonakamura

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9a8814d7839133c4c231fd92775c2b0ed7486ec7:

Sandbox Source
example Configuration

codesandbox-ci[bot] avatar Oct 05 '21 12:10 codesandbox-ci[bot]

I think this will have to point this to v8 so we have a bit more freedom -- v7 is frozen rn except for critical fixes.

From what I understand, you're wanting to enhance pointer missed events? I don't see anything wrong with this approach, considering that it streamlines events across the board.

CodyJasonBennett avatar Dec 10 '21 10:12 CodyJasonBennett

Yeah, I was under the impression that you want to stop doing things for v7. For now I maintain a fork, so no rush. Yeah, I want to be more like other events, but it's not backwards compatible

saitonakamura avatar Dec 10 '21 14:12 saitonakamura

On an unrelated note, I did realize that making rich UI in three probably was a mistake and I'm better off doing it in a 2d renderer like pixi and than stream the texture to three (or even straight to the webgl with xr layers)

saitonakamura avatar Dec 10 '21 14:12 saitonakamura

FWIW, events are completely modular, so you can plug in your own events system into v7 or v8 instead of forking the whole thing.

<Canvas events={myEvents} />
render(<group />, canvas, { events: myEvents })

If this is still useful for you, we can continue here or further discuss in #1794.

CodyJasonBennett avatar Dec 10 '21 14:12 CodyJasonBennett

Yeah, I know but i would basically need to copy paste most of the events.ts 😀

saitonakamura avatar Dec 10 '21 15:12 saitonakamura

Although I did reimplement the same system for react-xr (in another fork) cause I needed stopPropagation

saitonakamura avatar Dec 10 '21 15:12 saitonakamura