Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decal example is not working #20205

Closed
Ben-Mack opened this issue Aug 28, 2020 · 11 comments
Closed

Decal example is not working #20205

Ben-Mack opened this issue Aug 28, 2020 · 11 comments

Comments

@Ben-Mack
Copy link

Ben-Mack commented Aug 28, 2020

The original decal example is not working anymore on r120: https://threejs.org/examples/#webgl_decals

Nothing happened when clicking on the object, no error reported in console.

@sciecode
Copy link
Contributor

Same underlying issue as #20191. Fix PR already filed on #20194

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 28, 2020

@mrdoob Please let's merge #20194 for now since I'm afraid it won't take long until projects hit into this issue.

@mrdoob
Copy link
Owner

mrdoob commented Aug 28, 2020

@Mugen87 I'll have a look at this today. I hope we don't have to revert.

@chilmers
Copy link

chilmers commented Aug 28, 2020

I ran into similar issues with 0.120.0 where it seemed like the upgrade (probably OrbitControls) ate my mousemove events while panning (i.e. while the mouse button was down I no longer got any mousemove events).

When I changed my code to listen to 'pointermove' (as the OrbitControls does) instead of 'mousemove' it started working again.
Not sure if it helps with this particular issue but it might be a clue.

Could it be that if a pointermove eventlistener is triggered, then the browser would not trigger the mousemove event for some reason since they are almost the same?

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 28, 2020

Could it be that if a pointermove eventlistener is triggered, then the browser would not trigger the mousemove event for some reason since they are almost the same?

It's explain at the MDN: https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent

If you use pointer events, you should call event.preventDefault() to keep the mouse event from being sent as well.

OrbitControls and TrackballControls use event.preventDefault() in certain event listeners which is responsible for this breakage.

@chilmers
Copy link

I guess you are referring to this part of the doc?

If you use pointer events, you should call event.preventDefault() to keep the mouse event from being sent as well.

I thought the event would still be propagated to my event listener since the OrbitControls isn't doing event.stopPropagation but this might explain why i got no mousemove and also why changing to pointermove worked (since I guess that one is still propagated).

Interesting, thanks!

@mrdoob
Copy link
Owner

mrdoob commented Aug 29, 2020

Fixed: 2b477f0

This example also never worked on mobile before either.

@mrdoob mrdoob closed this as completed Aug 29, 2020
@mrdoob
Copy link
Owner

mrdoob commented Aug 29, 2020

Seems like in order to update to r120, users will need to change their mouse events to pointer events...

@marcofugaro
Copy link
Contributor

@mrdoob have you considered removing the preventDefault() from the pointerdown event? I couldn't find any reason why it is there.

@mrdoob
Copy link
Owner

mrdoob commented Aug 30, 2020

@marcofugaro Just because mousedown used to have it. I'll give it a try and test things tomorrow 👍

@mrdoob
Copy link
Owner

mrdoob commented Aug 30, 2020

@marcofugaro That ended up being not the problem and I didn't pursue the investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants