question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attach camera-controls pointermove event listeners to window instead of element

See original GitHub issue

Discussed in https://github.com/google/model-viewer/discussions/2678

<div type='discussions-op-text'>

Originally posted by lucadalli August 10, 2021 When rotating a model with camera-controls enabled, I often find myself getting frustrated at the model’s unresponsiveness when my pointer falls out of the element’s bounds.

When I’m interacting with the model, after the initial pointerdown event, I become far less conscious of where my pointer is and more focused on the actual orientation of the model. I’d be rotating the model, until suddenly, my inputs are no longer recognized, only for me to realize that my pointer is outside the element. This breaks my “immersion” as I have to reset my pointer position back onto the model and resume the interaction.

I strongly believe this is an inferior user experience to the one offered by THREE’s OrbitControls, which attaches move listeners to window and hence allows an initiated camera interaction to continue anywhere on the page until the pointer is released.

https://threejs.org/examples/#misc_controls_orbit

</div>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lucadallicommented, Aug 11, 2021

Great, I have also tested Android Edge and it behaves like the rest. Given that all modern mobile browser are consistent, the way we handle touch events can remain as is. I will address mouse events, which should be a trivial change.

As you work on this, please keep this example in mind, as we want to make sure it is still easy for users to customize their UX by intercepting events before they get to us. We need to be mindful of anything that may be a breaking change.

Noted. I’ll verify that changes are backwards compatible.

1reaction
elalishcommented, Aug 11, 2021

Yes, I have those devices locally; let me get back here with results.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element: pointermove event - Web APIs | MDN
The pointermove event is fired when a pointer changes coordinates, and the pointer has not been canceled by a browser touch-action.
Read more >
Attach event to dynamic elements in javascript - Stack Overflow
createElement , add an event listener, and append it to the DOM. Your events will fire. If you create an element as a...
Read more >
JavaScript HTML DOM EventListener - W3Schools
The addEventListener() method allows you to add event listeners on any HTML DOM object such as HTML elements, the HTML document, the window...
Read more >
Handling Events :: Eloquent JavaScript
The addEventListener method allows you to add any number of handlers so that it is safe to add handlers even if there is...
Read more >
Understanding Events in JavaScript | Tania Rascia
An event listener attaches a listener to an element, which allows that ... except we're setting the property of an element in JavaScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found