Switch inputElement with multiple canvases

Hi. As discussed in the post below, I’m experimenting with the scenario switching input element using multiple canvases.

However, contrary to the description of the post, if the version is updated to the latest version (>= 5.0.0-beta.4), the input element change is not applied as expected.

After changing inputElement, still the first canvas(renderCanvas0) can only listen events. However, changes in camera viewpoint is applied as intendeted.

After clicking the increment input canvas button, events from the first canvas(renderCanvas0) result in changing viewpoint in the second canvas(renderCanvas1)

In lower versions (<= 5.0.0-beta.3) it works fine.

Below is the experiment setting using codesandbox(with 5.0.0-beta.7, so it is broken). You can easily change the babylonjs version by using Dependencies panel follwing attached image.
image

Should I use a new way to change inputElement following new commits after 5.0.0-beta.4 version?

cc @DarraghBurke

Think this may actually be an issue for @PolygonalSun

Lemme take a look and see what’s going on.

1 Like

I believe that this issue comes from a recent change to our InputManager that swaps in our DeviceSourceManager as its backbone. There was code that would swap the active input element (canvas) that wasn’t being called properly with the DeviceSourceManager. I’m currently working on a fix and I’ll update when it’s live.

PR is live: DeviceInputSystem: Add configure/removeEvents to be called by DeviceSourceManager by PolygonalSun · Pull Request #11959 · BabylonJS/Babylon.js (github.com)

1 Like

PR is merged

3 Likes