Commit 4efc049
Add an option to disable teaching moments (BabylonJS#18508)
> 🤖 *This PR was created by the create-pr skill.*
Adds a new `disableTeachingMoments` option to `ModularToolOptions` (and
therefore `InspectorOptions`) that suppresses all teaching moments
rendered by the modular tool, regardless of each teaching moment's
individual `suppress` state.
## Changes
- New `TeachingMomentsContext` (in
`sharedUiComponents/src/modularTool/contexts/teachingMomentsContext.ts`)
exposing a `disabled` flag.
- `MakeModularTool` now accepts a `disableTeachingMoments?: boolean`
option and wraps the rendered tree in a
`TeachingMomentsContext.Provider`.
- `MakeTeachingMoment` consumes the context and ORs the context's
`disabled` flag with the caller-provided `suppress` flag.
- `ShowInspector` forwards `options.disableTeachingMoments` through to
`MakeModularTool` so inspector hosts can opt out of teaching moments.
## Motivation
Addresses a forum request from a user embedding the inspector in their
own app who wants a parameter in `ShowInspector` to turn off the
teaching-moment "bubbles" that appear the first time the inspector opens
in a session:
https://forum.babylonjs.com/t/introducing-inspector-v2/60937/223
With this option, host apps can call `ShowInspector(scene, {
disableTeachingMoments: true })` to globally suppress teaching moments.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 4c80d48 commit 4efc049
4 files changed
Lines changed: 139 additions & 108 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
430 | 430 | | |
431 | 431 | | |
432 | 432 | | |
| 433 | + | |
433 | 434 | | |
434 | 435 | | |
435 | 436 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
0 commit comments