Skip to content

Conversation

@ryantrem
Copy link
Member

With this PR the whole "side panes" (all tabs, top and bottom, plus toolbars) can be:

  1. Collapsed/expanded (small expand buttons will overlay the canvas in the top corners)
  2. "Undocked" to child windows

Styling in the child windows is easy to manage. No need to copy styles or anything like Inspector v1, it just requires a little bit of Fluent setup in the child window, and then only the used styles will be injected into that window.

In the Inspector v2 implementation, when a child window is closed, it is just re-docked in the main window. Also, child windows will automatically close if Inspector itself is closed, or if the main window is closed.

Unfortunately, the approach I initially used with portals to keep the panes mounted all the time (so we don't lose their state when redocking) does not work with child windows. Simply re-parenting a raw html element into a child window basically bypasses all the fluent theming and also seems to break other things. For this reason, I rolled that part of the change back, which means when you redock a side pane, it is unmounted/remounted and the state is lost. However, I did two things to improve this:

  1. Panes are not unmounted/remounted when the selected tab changes.
  2. Scene explorer selects the currently selected entity when it first mounts, so if you re-dock to a new location (including a child window), it at least selects and scrolls to the same selected entity. This is still an improvement over the v1 behavior!
image image image image

@ryantrem ryantrem enabled auto-merge (squash) October 24, 2025 00:24
@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

Building or testing the sandbox has failed.

If the tests failed, results can be found here:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17341/merge/testResults/

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

Building or testing the playground has failed.

If the tests failed, results can be found here:
https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/testResults/

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/?snapshot=refs/pull/17341/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17341/merge/

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

1 similar comment
@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/?snapshot=refs/pull/17341/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17341/merge/

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@ryantrem ryantrem requested a review from Copilot October 24, 2025 04:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements collapsible and undockable side panes for Inspector v2. Users can now collapse side panes with expand buttons overlaying the canvas corners, or undock panes into separate child windows with proper Fluent UI theming. Child windows automatically close when the main window or Inspector closes, and redocking restores panes to the main window. To improve state persistence, panes remain mounted during tab switches, and the Scene Explorer preserves entity selection when remounting.

Key Changes:

  • Added undocking functionality for side panes with automatic child window cleanup
  • Implemented side pane collapse/expand with overlay buttons
  • Changed pane rendering to keep all tabs mounted (hidden) to preserve state during tab switches

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/dev/inspector-v2/src/services/shellService.tsx Core implementation of collapsible/undockable side panes with child window management and portal-based rendering
packages/dev/inspector-v2/src/components/scene/sceneExplorer.tsx Enhanced entity selection to work properly when Scene Explorer remounts after undocking
packages/dev/inspector-v2/src/services/themeSelectorService.tsx Removed vertical margin from theme button for consistent toolbar spacing
packages/dev/inspector-v2/src/components/gizmoToolbar.tsx Updated button margin to match new toolbar spacing pattern

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have changed file(s) that made possible changes to the sandbox.
You can test the sandbox snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17341/merge/

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

You have made possible changes to the playground.
You can test the snapshot here:

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/

The snapshot playground with the CDN snapshot (only when available):

https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17341/merge/?snapshot=refs/pull/17341/merge

Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly.

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Oct 24, 2025

@ryantrem ryantrem merged commit f338005 into BabylonJS:master Oct 24, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants