-
Notifications
You must be signed in to change notification settings - Fork 295
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
FIX: Dynamic zoom speed with distance from camera broken #1263
Comments
Probably. I didn't notice that when testing. Unfortunately I'm out of time to fix this until Sunday. |
The object picking is also bugged |
That's unfortunate! Will fix tomorrow morning 🙂👌 |
No worries! |
@Amoki: also, do you have some sample HTML page for the case of |
@tmarti I can easily do a rollback on this no worries, no pressure man. I just had a little look; basically the issue is that there are some handlers within CameraControl that expect a pick to happen synchronously when PickController.update() is called, where the handlers then check for results on PickController immediately after calling. So, when that is asynchronous, the results won't be there immediately after, and we'll get some missing pick events. An idea: perhaps This would assume that the view does not update in any way between multiple calls to update() within the current render frame, which I believe is a safe assumption, since a render only happens once per tick. The cache would be valid as long as the combination of values of these don't change since the last call to `update():
We could hash those. On each update() if the same values are on these since the last time, cached results would still be valid. CameraControl.fireEvents() can remain the way it is, no problem there AFAIK. Also a quick hack for now, if you run out of time, could be to make PickController.update() method call PickController.runUpdate(). |
Yes, I see what's the problem now with my code 🙂. It's this pattern: pickController.update();
if (pickController.pickResult) {
...
} This is, do something with Ok, then what do you think about this option @xeolabs? For performance reasons, what I wanted to avoid is an avalanche of "picks" triggered by What we could do, for input events that are triggered more than once per tick, is to "tick-debounce" them. Following this idea, instead of the following pattern... canvas.addEventListener(
"mousemove",
(e) => someCodeUsingPickController(e)
); We could do wrap the canvas.addEventListener(
"mousemove",
(e) => maxOncePerTick(
() => someCodeUsingPickController(e)
)
); And, do the debouncing in This could be probably used also for Will do a quick experiment and tell 🙂 |
@tmarti yes that sounds good, although I dare say it might make the handlers a bit more complex in terms of state management. Let's see how your experimentation goes though, could be workable. |
@xeolabs the new PR does not need any change in the state management part, just tickifying (and later untickyfy) the handlers 😊 |
Fixed by #1265 |
Describe the bug
Zoom speed is constant and doesn't slow down when the focused object is near.
Can't it come from #1261?
To Reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: