yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.

Home Page:https://yomotsu.github.io/camera-controls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

If pointer is held down without any movement "updated" keeps firing

vis-prime opened this issue · comments

commented

Describe the bug

I'm using the on demand rendering method since model is static , it works great

one thing i noticed

if I keep left click held down , cameraControls.update(delta) return true continuously

my use case:
I want to render the final frame with full device pixel ratio after "sleep" event
When mouse is held down it's continuously firing 'sleep' and 'updated'
On mouse up everything is fine

To Reproduce

console.log the updated value in the render loop

Code

cameraControls.addEventListener("sleep", (e) => {
    console.log(e)
  })

  renderer.setAnimationLoop(() => {
    const delta = clock.getDelta()
    const hasControlsUpdated = cameraControls.update(delta)

    // on demand
    if (hasControlsUpdated) {
      console.log("render")
      render()
    }
  })

Live example

Sandbox to showcase the issue

Expected behavior

if the hold the mouse button down and do not move it at all , 'hasControlUpdated' should return false

Screenshots or Video

2023-08-08.22-38-59.mp4

Device

Desktop

OS

Windows

Browser

Chrome

Thanks for using camera-controls, and your report.
Your demo and video are really helpful.

I tested on your demo, but It seems I can't reproduce the problem.
Does it happen to other devices too? Might be some mouse devices are too sensitive.

Screen.Recording.2023-08-09.at.11.54.41.mp4
commented

Strange , does not happen on phone too,

on sandbox and my vite js project it's happening even if mouse is lifted off the surface

mouse.mp4

will check if it's the mouse causing the issue !

commented

uh, it somehow fixed it self !

now idea how ! both sandbox and my local project seems to working correctly

will close this for now !

thanks!

fixed.mp4