@playcanvas/inspector 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/package.json +1 -1
- package/src/asset-view.js +24 -17
- package/src/camera-view.js +5 -3
- package/src/context-menu.js +231 -0
- package/src/copy-json.js +692 -0
- package/src/describe.js +20 -1
- package/src/frame-graph-view.js +1 -0
- package/src/hierarchy-view.js +29 -3
- package/src/inspector.js +406 -59
- package/src/list-view.js +118 -12
- package/src/material-view.js +7 -6
- package/src/memory-view.js +224 -66
- package/src/mesh-view.js +6 -5
- package/src/model.js +24 -2
- package/src/node-model.js +78 -9
- package/src/property-view.js +159 -5
- package/src/render-target-view.js +3 -3
- package/src/script-view.js +21 -12
- package/src/styles.js +196 -2
- package/src/texture-view.js +4 -4
- package/src/transform-tool.js +185 -0
- package/types/asset-view.d.ts +3 -1
- package/types/camera-view.d.ts +4 -0
- package/types/context-menu.d.ts +90 -0
- package/types/copy-json.d.ts +69 -0
- package/types/describe.d.ts +1 -1
- package/types/hierarchy-view.d.ts +13 -0
- package/types/inspector.d.ts +141 -21
- package/types/list-view.d.ts +44 -3
- package/types/material-view.d.ts +3 -1
- package/types/memory-view.d.ts +24 -25
- package/types/mesh-view.d.ts +3 -1
- package/types/model.d.ts +16 -1
- package/types/node-model.d.ts +17 -1
- package/types/property-view.d.ts +41 -0
- package/types/script-view.d.ts +3 -1
- package/types/transform-tool.d.ts +92 -0
package/src/inspector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Asset, Color, Entity, FramePass, GraphNode, LAYERID_UI, Material, Mesh, RenderPassForward, RenderTarget, Shader, Texture
|
|
2
|
+
Asset, Color, Component, Entity, FramePass, GraphNode, LAYERID_UI, Material, Mesh, MeshInstance, RenderPassForward, RenderTarget, Shader, Texture
|
|
3
3
|
} from 'playcanvas';
|
|
4
4
|
|
|
5
5
|
import { TextureRenderer } from './renderers/texture-renderer.js';
|
|
@@ -8,8 +8,10 @@ import { WireRenderer } from './renderers/wire-renderer.js';
|
|
|
8
8
|
import { pushResourceUsage } from './asset-usage.js';
|
|
9
9
|
import { ASSET_SORTS, assetRows, buildAssetModel, collectAssets } from './asset-view.js';
|
|
10
10
|
import { buildCameraModel, cameraRows, collectCameras } from './camera-view.js';
|
|
11
|
+
import { ContextMenu } from './context-menu.js';
|
|
12
|
+
import { copyGroup, copyList, copyListRow, copySubject, stringifyCopy } from './copy-json.js';
|
|
11
13
|
import { INSTANCES_PER_PAGE, LayerStepSelection, buildPassModel, buildStepModel, captureFrameGraph, passRows } from './frame-graph-view.js';
|
|
12
|
-
import {
|
|
14
|
+
import { bufferKind, bufferOwners, buildBufferModel, KIND_NAMES, memoryRows, videoMemory } from './memory-view.js';
|
|
13
15
|
import { HierarchyView, filterSuggestions } from './hierarchy-view.js';
|
|
14
16
|
import { ListView } from './list-view.js';
|
|
15
17
|
import {
|
|
@@ -18,7 +20,7 @@ import {
|
|
|
18
20
|
} from './material-view.js';
|
|
19
21
|
import { buildMeshModel, meshBytes, meshListRows, meshNote, surveyMeshes } from './mesh-view.js';
|
|
20
22
|
import { formatBytes, formatName, passDisplayName } from './model.js';
|
|
21
|
-
import { buildNodeModel } from './node-model.js';
|
|
23
|
+
import { buildComponentModel, buildNodeModel, meshInstanceRows } from './node-model.js';
|
|
22
24
|
import { AmmoDebugDraw, DEBUG_DRAW } from './physics-debug.js';
|
|
23
25
|
import { bodyRows, drawCollisionShape, drawJoint, jointRows, physicsStats } from './physics-view.js';
|
|
24
26
|
import { PropertyView } from './property-view.js';
|
|
@@ -29,12 +31,16 @@ import { styles } from './styles.js';
|
|
|
29
31
|
import { installTooltip, setTip } from './tooltip.js';
|
|
30
32
|
import { CameraFly, CameraOrbit, CanvasCapture, RENDER_MODES, ViewportPicker, WireframeMode, isScreenCamera, screenCameraAt } from './viewport-tools.js';
|
|
31
33
|
import { buildTextureModel, collectTextures, textureRows } from './texture-view.js';
|
|
34
|
+
import { TRANSFORM_POINTER_EVENTS, TransformTool } from './transform-tool.js';
|
|
32
35
|
|
|
33
36
|
/** @import { AppBase } from 'playcanvas' */
|
|
34
37
|
/** @import { GraphicsDevice } from 'playcanvas' */
|
|
35
38
|
/** @import { FrameSnapshot, PassModelContext } from './frame-graph-view.js' */
|
|
36
|
-
/** @import {
|
|
37
|
-
/** @import {
|
|
39
|
+
/** @import { PropertyRow, PropertySection } from './model.js' */
|
|
40
|
+
/** @import { MenuItem } from './context-menu.js' */
|
|
41
|
+
/** @import { CopyOptions } from './copy-json.js' */
|
|
42
|
+
/** @import { CopyTarget } from './property-view.js' */
|
|
43
|
+
/** @import { TransformMode } from './transform-tool.js' */
|
|
38
44
|
|
|
39
45
|
/**
|
|
40
46
|
* Options for {@link Inspector}.
|
|
@@ -109,13 +115,17 @@ const TAB_TIPS = {
|
|
|
109
115
|
meshes: 'The meshes of the app, found through the components, layers and assets using them, largest first',
|
|
110
116
|
materials: 'The materials of the app, found through the mesh instances and assets using them, most used first',
|
|
111
117
|
scripts: 'The script classes of the app, registered or found on its entities, with the entities using each and its source',
|
|
112
|
-
memory: '
|
|
118
|
+
memory: 'Video memory by kind of resource, and every buffer on the device with what uses it',
|
|
113
119
|
shaders: 'The compiled shaders, with their sources',
|
|
114
120
|
physics: 'The rigid bodies and joints of the physics world, and its debug drawing'
|
|
115
121
|
};
|
|
116
122
|
|
|
117
123
|
const CHANNELS_TIP = 'Which channels of the texture to show. A single channel shows as grayscale';
|
|
118
124
|
|
|
125
|
+
// how many links the deep copy follows until changed, and at most
|
|
126
|
+
const COPY_DEPTH = 3;
|
|
127
|
+
const MAX_COPY_DEPTH = 20;
|
|
128
|
+
|
|
119
129
|
// events the panel swallows so that they never reach the input handlers of the app underneath
|
|
120
130
|
const SWALLOWED_EVENTS = ['keydown', 'keyup', 'keypress', 'pointerdown', 'mousedown', 'wheel', 'touchstart', 'contextmenu'];
|
|
121
131
|
|
|
@@ -170,7 +180,7 @@ function isTextTarget(e) {
|
|
|
170
180
|
}
|
|
171
181
|
|
|
172
182
|
/**
|
|
173
|
-
* An in-page inspector for a running application. It docks a panel over the canvas with
|
|
183
|
+
* An in-page inspector for a running application. It docks a panel over the canvas with twelve
|
|
174
184
|
* tabs above a live property view of whatever is selected:
|
|
175
185
|
*
|
|
176
186
|
* - Hierarchy: the entity tree. The property view shows the node's transform, every component it
|
|
@@ -179,9 +189,12 @@ function isTextTarget(e) {
|
|
|
179
189
|
* - Cameras: every camera in render order, with its target, viewport, layers and render mode. The
|
|
180
190
|
* render mode of a camera can be switched to a debug view of the material inputs, the whole scene
|
|
181
191
|
* drawn in wireframe, and any camera flown.
|
|
192
|
+
* - Assets: every asset in the registry with its file, load state and the components using it.
|
|
193
|
+
* Asset references on a component link here, and a texture names the asset it came from.
|
|
182
194
|
* - Frame graph: the render passes of the last frame in execution order, as the render pass trace
|
|
183
195
|
* prints them, with the layer steps of forward passes, the light of shadow passes and optional
|
|
184
|
-
* GPU timings. Render target cells link to the next tab.
|
|
196
|
+
* GPU timings. Render target cells link to the next tab. With the debug engine, the debug frame
|
|
197
|
+
* draws a forward pass only up to a chosen draw, stepped one draw at a time with the arrow keys.
|
|
185
198
|
* - Render targets: every render target on the device including the backbuffer, with its
|
|
186
199
|
* attachments and the passes that rendered into it this frame, linking back to the frame graph.
|
|
187
200
|
* The selected target's attachment can be previewed live in a corner of the viewport.
|
|
@@ -196,20 +209,21 @@ function isTextTarget(e) {
|
|
|
196
209
|
* - Scripts: every script class the script registry holds or an entity uses, with the entities using
|
|
197
210
|
* it, its declared attributes and its source as the browser keeps it. The script sections of an
|
|
198
211
|
* entity link here.
|
|
199
|
-
* - Memory: video memory by kind of resource,
|
|
200
|
-
* after the mesh, material or asset
|
|
212
|
+
* - Memory: video memory by kind of resource, each kind a group headed by its count and size that
|
|
213
|
+
* opens to list its buffers largest first, named after the mesh, material or asset each was found
|
|
214
|
+
* to belong to. Buffer values elsewhere link here.
|
|
201
215
|
* - Shaders: every shader on the device with its language, state and vertex attributes. The
|
|
202
216
|
* compiled variants listed on a material link here.
|
|
203
|
-
* - Assets: every asset in the registry with its file, load state and the components using it.
|
|
204
|
-
* Asset references on a component link here, and a texture names the asset it came from.
|
|
205
217
|
* - Physics: the rigid bodies and joints of the scene, with the physics world drawn over the scene
|
|
206
218
|
* through the engine's debug drawer when Ammo is loaded.
|
|
207
219
|
*
|
|
208
220
|
* The app can be paused and stepped a frame at a time, and the panel can be popped out into its own
|
|
209
|
-
* window to leave the canvas unobscured.
|
|
221
|
+
* window to leave the canvas unobscured. In the view, an entity can be picked to select it, and the
|
|
222
|
+
* camera flown, or orbited around the selected entity, without moving the app's own camera.
|
|
210
223
|
*
|
|
211
|
-
* The
|
|
212
|
-
* enabled flag
|
|
224
|
+
* The inspector is read-only, apart from the checkbox on each hierarchy row, which flips the node's
|
|
225
|
+
* enabled flag, pausing and stepping the app, and view-only overrides: render modes, wireframe and
|
|
226
|
+
* a flown or orbited camera, which it removes when it closes.
|
|
213
227
|
*
|
|
214
228
|
* ```javascript
|
|
215
229
|
* const inspector = new Inspector(app, { dock: 'left' });
|
|
@@ -452,6 +466,38 @@ class Inspector {
|
|
|
452
466
|
*/
|
|
453
467
|
_bodyList;
|
|
454
468
|
|
|
469
|
+
/**
|
|
470
|
+
* The gizmo that moves, rotates or scales the selected entity, while one of its buttons is on.
|
|
471
|
+
*
|
|
472
|
+
* @type {TransformTool|null}
|
|
473
|
+
* @private
|
|
474
|
+
*/
|
|
475
|
+
_transformTool = null;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The buttons of the gizmos, by what each does.
|
|
479
|
+
*
|
|
480
|
+
* @type {Record<TransformMode, HTMLButtonElement>}
|
|
481
|
+
* @private
|
|
482
|
+
*/
|
|
483
|
+
_transformBtns;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* The menu opened with a right click, which copies what it was opened on.
|
|
487
|
+
*
|
|
488
|
+
* @type {ContextMenu|null}
|
|
489
|
+
* @private
|
|
490
|
+
*/
|
|
491
|
+
_menu = null;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* How many links the menu's deep copy follows.
|
|
495
|
+
*
|
|
496
|
+
* @type {number}
|
|
497
|
+
* @private
|
|
498
|
+
*/
|
|
499
|
+
_copyDepth = COPY_DEPTH;
|
|
500
|
+
|
|
455
501
|
/**
|
|
456
502
|
* Draws the selected render target's texture over the canvas, straight from the GPU.
|
|
457
503
|
*
|
|
@@ -721,18 +767,6 @@ class Inspector {
|
|
|
721
767
|
*/
|
|
722
768
|
_instancePages = new Map();
|
|
723
769
|
|
|
724
|
-
/**
|
|
725
|
-
* @type {HTMLSelectElement}
|
|
726
|
-
* @private
|
|
727
|
-
*/
|
|
728
|
-
_bufferKind;
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* @type {HTMLElement}
|
|
732
|
-
* @private
|
|
733
|
-
*/
|
|
734
|
-
_memoryNote;
|
|
735
|
-
|
|
736
770
|
/**
|
|
737
771
|
* Model builder for the property view when a buffer is selected.
|
|
738
772
|
*
|
|
@@ -769,7 +803,11 @@ class Inspector {
|
|
|
769
803
|
*/
|
|
770
804
|
_cameraModel = camera => buildCameraModel(camera, {
|
|
771
805
|
app: this._app,
|
|
772
|
-
cameraActions: {
|
|
806
|
+
cameraActions: {
|
|
807
|
+
fly: target => this._startFly(target),
|
|
808
|
+
flying: this._fly?.camera ?? null,
|
|
809
|
+
unavailable: this._transformTool ? 'Turn the gizmo off to fly a camera' : null
|
|
810
|
+
}
|
|
773
811
|
});
|
|
774
812
|
|
|
775
813
|
/**
|
|
@@ -1007,6 +1045,9 @@ class Inspector {
|
|
|
1007
1045
|
this._restoring = false;
|
|
1008
1046
|
|
|
1009
1047
|
window.addEventListener('keydown', this._onKeyDown);
|
|
1048
|
+
// ahead of every listener of the app and of the panel's own modes added later, so a gizmo
|
|
1049
|
+
// being dragged keeps the pointer to itself
|
|
1050
|
+
for (const type of TRANSFORM_POINTER_EVENTS) window.addEventListener(type, this._onTransformPointer, { capture: true, passive: false });
|
|
1010
1051
|
// the app fires 'update' after every component system has updated, so the physics step of
|
|
1011
1052
|
// the frame is done by the time the world is drawn
|
|
1012
1053
|
app.on('update', this._onUpdate, this);
|
|
@@ -1025,6 +1066,7 @@ class Inspector {
|
|
|
1025
1066
|
app.off('update', this._onUpdate, this);
|
|
1026
1067
|
app.off('destroy', this.destroy, this);
|
|
1027
1068
|
window.removeEventListener('keydown', this._onKeyDown);
|
|
1069
|
+
for (const type of TRANSFORM_POINTER_EVENTS) window.removeEventListener(type, this._onTransformPointer, { capture: true });
|
|
1028
1070
|
this._setDebugFrame(false);
|
|
1029
1071
|
this._endViewportModes();
|
|
1030
1072
|
this._picker?.destroy();
|
|
@@ -1039,6 +1081,8 @@ class Inspector {
|
|
|
1039
1081
|
this._hiddenBodies.clear();
|
|
1040
1082
|
|
|
1041
1083
|
if (this._popup) this._dockBack();
|
|
1084
|
+
this._menu?.destroy();
|
|
1085
|
+
this._menu = null;
|
|
1042
1086
|
this._textures.destroy();
|
|
1043
1087
|
this._host?.remove();
|
|
1044
1088
|
this._host = null;
|
|
@@ -1183,6 +1227,7 @@ class Inspector {
|
|
|
1183
1227
|
this._popup.focus();
|
|
1184
1228
|
return;
|
|
1185
1229
|
}
|
|
1230
|
+
this._menu?.hide();
|
|
1186
1231
|
|
|
1187
1232
|
const height = Math.max(480, Math.round(window.innerHeight * 0.9));
|
|
1188
1233
|
const popup = window.open('', 'pc-inspector', `popup=yes,width=${this._width},height=${height}`);
|
|
@@ -1216,6 +1261,7 @@ class Inspector {
|
|
|
1216
1261
|
const popup = this._popup;
|
|
1217
1262
|
if (!popup) return;
|
|
1218
1263
|
this._popup = null;
|
|
1264
|
+
this._menu?.hide();
|
|
1219
1265
|
|
|
1220
1266
|
popup.removeEventListener('pagehide', this._onPopupHide);
|
|
1221
1267
|
popup.removeEventListener('keydown', this._onKeyDown);
|
|
@@ -1346,6 +1392,19 @@ class Inspector {
|
|
|
1346
1392
|
setTip(this._pickBtn, 'Pick an entity in the view: hover to see it outlined, click to select it. Esc stops');
|
|
1347
1393
|
setTip(this._flyBtn, 'Fly the camera of the view with the mouse and WASD, without moving the app\'s own camera. Esc stops');
|
|
1348
1394
|
setTip(this._orbitBtn, 'Orbit the camera of the view around the selected entity: drag to orbit, right-drag to pan, the wheel to zoom, without moving the app\'s own camera. Esc stops');
|
|
1395
|
+
this._transformBtns = {
|
|
1396
|
+
translate: iconButton('translate', 'Move'),
|
|
1397
|
+
rotate: iconButton('rotate', 'Rotate'),
|
|
1398
|
+
scale: iconButton('scale', 'Scale')
|
|
1399
|
+
};
|
|
1400
|
+
const transformTips = { translate: 'Move', rotate: 'Rotate', scale: 'Scale' };
|
|
1401
|
+
for (const [mode, button] of Object.entries(this._transformBtns)) {
|
|
1402
|
+
setTip(button, TransformTool.supported ?
|
|
1403
|
+
`${transformTips[mode]} the selected entity with a gizmo in the view: drag its handles. Away from them the app has the view as usual; Pick, Fly and Orbit are off meanwhile. Click again or press Esc to stop` :
|
|
1404
|
+
'The gizmos of this engine cannot be driven by the inspector');
|
|
1405
|
+
button.disabled = !TransformTool.supported;
|
|
1406
|
+
button.addEventListener('click', () => this._setTransformMode(this._transformTool?.mode === mode ? null : /** @type {TransformMode} */ (mode)));
|
|
1407
|
+
}
|
|
1349
1408
|
this._popBtn = iconButton('popout', 'Pop out');
|
|
1350
1409
|
const closeBtn = iconButton('close', 'Hide');
|
|
1351
1410
|
const toggleLabel = Inspector._keyLabel(this._toggleKey);
|
|
@@ -1353,7 +1412,8 @@ class Inspector {
|
|
|
1353
1412
|
toolbar.append(
|
|
1354
1413
|
title,
|
|
1355
1414
|
this._pauseBtn, this._stepBtn, el('span', 'pci-sep'),
|
|
1356
|
-
this._pickBtn, this._flyBtn, this._orbitBtn,
|
|
1415
|
+
this._pickBtn, this._flyBtn, this._orbitBtn, el('span', 'pci-sep'),
|
|
1416
|
+
this._transformBtns.translate, this._transformBtns.rotate, this._transformBtns.scale,
|
|
1357
1417
|
el('span', 'pci-spacer'),
|
|
1358
1418
|
this._popBtn, closeBtn
|
|
1359
1419
|
);
|
|
@@ -1507,21 +1567,17 @@ class Inspector {
|
|
|
1507
1567
|
const scriptList = el('div', 'pci-list');
|
|
1508
1568
|
scriptPanel.append(scriptList);
|
|
1509
1569
|
|
|
1510
|
-
// memory:
|
|
1570
|
+
// memory: a group per kind of resource, each opening to its buffers
|
|
1511
1571
|
const memoryPanel = el('div', 'pci-listpanel');
|
|
1512
|
-
const memoryBar = el('div', 'pci-subbar');
|
|
1513
|
-
this._bufferKind = this._makeSelect(memoryBar, 'Show', BUFFER_KINDS, 'List and total only the buffers of this kind');
|
|
1514
|
-
this._memoryNote = el('div', 'pci-note pci-note-info');
|
|
1515
|
-
this._memoryNote.style.whiteSpace = 'pre-line';
|
|
1516
1572
|
const bufferList = el('div', 'pci-list');
|
|
1517
|
-
memoryPanel.append(
|
|
1573
|
+
memoryPanel.append(bufferList);
|
|
1518
1574
|
|
|
1519
1575
|
// shaders: a plain list
|
|
1520
1576
|
const shaderPanel = el('div', 'pci-listpanel');
|
|
1521
1577
|
const shaderList = el('div', 'pci-list');
|
|
1522
1578
|
shaderPanel.append(shaderList);
|
|
1523
1579
|
|
|
1524
|
-
for (const input of [this._previewToggle, this._previewAttachment, this._previewChannels, this._texturePreviewToggle, this._textureChannels, this._assetSort
|
|
1580
|
+
for (const input of [this._previewToggle, this._previewAttachment, this._previewChannels, this._texturePreviewToggle, this._textureChannels, this._assetSort]) {
|
|
1525
1581
|
input.addEventListener('change', () => this._saveSettings());
|
|
1526
1582
|
}
|
|
1527
1583
|
|
|
@@ -1644,6 +1700,10 @@ class Inspector {
|
|
|
1644
1700
|
installTooltip(panel);
|
|
1645
1701
|
shadow.append(style, panel);
|
|
1646
1702
|
|
|
1703
|
+
this._menu?.destroy();
|
|
1704
|
+
this._menu = new ContextMenu(panel);
|
|
1705
|
+
panel.addEventListener('contextmenu', this._onContextMenu);
|
|
1706
|
+
|
|
1647
1707
|
// keep the app's input handlers from seeing interaction with the panel
|
|
1648
1708
|
for (const type of SWALLOWED_EVENTS) {
|
|
1649
1709
|
host.addEventListener(type, (e) => {
|
|
@@ -1661,10 +1721,12 @@ class Inspector {
|
|
|
1661
1721
|
this._selected = node;
|
|
1662
1722
|
if (this._tab === 'hierarchy') this._properties.setSubject(node, buildNodeModel);
|
|
1663
1723
|
if (node && this._fly instanceof CameraOrbit) this._fly.setTarget(node);
|
|
1664
|
-
this.
|
|
1724
|
+
this._transformTool?.attach(node);
|
|
1725
|
+
this._applyViewToolState();
|
|
1665
1726
|
this._updateStatus();
|
|
1666
1727
|
});
|
|
1667
1728
|
this._hierarchy.isLocked = node => this._isLocked(node);
|
|
1729
|
+
this._hierarchy.isHidden = node => node === this._transformTool?.root;
|
|
1668
1730
|
this._hierarchy.onToggle = () => this._properties.refresh();
|
|
1669
1731
|
this._passList = new ListView(passList, (item, key) => {
|
|
1670
1732
|
if (this._tab === 'passes') this._properties.setSubject(item, this._passListModel(item), key);
|
|
@@ -1717,11 +1779,7 @@ class Inspector {
|
|
|
1717
1779
|
const onHover = (el, target) => {
|
|
1718
1780
|
this._hoverLink = el && target ? { el, target } : null;
|
|
1719
1781
|
};
|
|
1720
|
-
const
|
|
1721
|
-
this._properties, this._passList, this._targetList, this._textureList, this._shaderList, this._meshList,
|
|
1722
|
-
this._materialList, this._scriptList, this._cameraList, this._bufferList, this._assetList, this._bodyList
|
|
1723
|
-
];
|
|
1724
|
-
for (const view of views) view.onHover = onHover;
|
|
1782
|
+
for (const view of [this._properties, ...this._lists()]) view.onHover = onHover;
|
|
1725
1783
|
}
|
|
1726
1784
|
|
|
1727
1785
|
/**
|
|
@@ -1830,7 +1888,7 @@ class Inspector {
|
|
|
1830
1888
|
if (typeof stored.targetPreview.channels === 'string') this._previewChannels.value = stored.targetPreview.channels;
|
|
1831
1889
|
}
|
|
1832
1890
|
if (typeof stored.assetSort === 'string') this._assetSort.value = stored.assetSort;
|
|
1833
|
-
if (typeof stored.
|
|
1891
|
+
if (typeof stored.copyDepth === 'number') this._setCopyDepth(stored.copyDepth);
|
|
1834
1892
|
if (typeof stored.filterBy === 'string') {
|
|
1835
1893
|
this._filterBy.value = stored.filterBy;
|
|
1836
1894
|
this._hierarchy.filterBy = /** @type {any} */ (this._filterBy.value);
|
|
@@ -1868,8 +1926,8 @@ class Inspector {
|
|
|
1868
1926
|
targetPreview: { enabled: this._previewToggle.checked, channels: this._previewChannels.value },
|
|
1869
1927
|
texturePreview: { enabled: this._texturePreviewToggle.checked, channels: this._textureChannels.value },
|
|
1870
1928
|
assetSort: this._assetSort.value,
|
|
1871
|
-
|
|
1872
|
-
|
|
1929
|
+
filterBy: this._filterBy.value,
|
|
1930
|
+
copyDepth: this._copyDepth
|
|
1873
1931
|
}));
|
|
1874
1932
|
} catch (e) {
|
|
1875
1933
|
// storage unavailable or full: settings simply do not persist
|
|
@@ -2481,6 +2539,7 @@ class Inspector {
|
|
|
2481
2539
|
*/
|
|
2482
2540
|
_setTab(tab) {
|
|
2483
2541
|
this._tab = tab;
|
|
2542
|
+
this._menu?.hide();
|
|
2484
2543
|
this._filterBy.style.display = tab === 'hierarchy' ? '' : 'none';
|
|
2485
2544
|
this._updateFilterHint();
|
|
2486
2545
|
for (const [id, button] of Object.entries(this._tabButtons)) {
|
|
@@ -2565,8 +2624,7 @@ class Inspector {
|
|
|
2565
2624
|
this._properties.setSubject(cls, this._scriptModel, this._scriptList.selectedKey);
|
|
2566
2625
|
}
|
|
2567
2626
|
} else if (this._tab === 'memory') {
|
|
2568
|
-
|
|
2569
|
-
this._bufferList.setRows(bufferRows(device, bufferOwners(this._app), this._bufferKind.value));
|
|
2627
|
+
this._bufferList.setRows(memoryRows(device, bufferOwners(this._app)));
|
|
2570
2628
|
const buffer = this._bufferList.selected;
|
|
2571
2629
|
if (buffer !== this._properties.subject) {
|
|
2572
2630
|
this._properties.setSubject(buffer, this._bufferModel, this._bufferList.selectedKey);
|
|
@@ -2629,6 +2687,229 @@ class Inspector {
|
|
|
2629
2687
|
this._properties.refresh();
|
|
2630
2688
|
}
|
|
2631
2689
|
|
|
2690
|
+
/**
|
|
2691
|
+
* @returns {Record<string, ListView>} The list of each tab, all but the hierarchy, by tab.
|
|
2692
|
+
* @private
|
|
2693
|
+
*/
|
|
2694
|
+
_tabLists() {
|
|
2695
|
+
return {
|
|
2696
|
+
passes: this._passList,
|
|
2697
|
+
targets: this._targetList,
|
|
2698
|
+
textures: this._textureList,
|
|
2699
|
+
shaders: this._shaderList,
|
|
2700
|
+
meshes: this._meshList,
|
|
2701
|
+
materials: this._materialList,
|
|
2702
|
+
scripts: this._scriptList,
|
|
2703
|
+
cameras: this._cameraList,
|
|
2704
|
+
memory: this._bufferList,
|
|
2705
|
+
assets: this._assetList,
|
|
2706
|
+
physics: this._bodyList
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
/**
|
|
2711
|
+
* @returns {ListView[]} The lists of the tabs, all but the hierarchy.
|
|
2712
|
+
* @private
|
|
2713
|
+
*/
|
|
2714
|
+
_lists() {
|
|
2715
|
+
return Object.values(this._tabLists());
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
/**
|
|
2719
|
+
* Opens the copy menu on what was right-clicked. Text fields keep the browser's own menu, to
|
|
2720
|
+
* paste into them.
|
|
2721
|
+
*
|
|
2722
|
+
* @param {MouseEvent} e - The event.
|
|
2723
|
+
* @private
|
|
2724
|
+
*/
|
|
2725
|
+
_onContextMenu = (e) => {
|
|
2726
|
+
if (isTextTarget(e)) return;
|
|
2727
|
+
const copy = this._copyTargetAt(/** @type {Node} */ (e.composedPath()[0]));
|
|
2728
|
+
if (!copy) return;
|
|
2729
|
+
e.preventDefault();
|
|
2730
|
+
this._menu?.show(e.clientX, e.clientY, copy.title, this._copyItems(copy));
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* What a right click copies: a row or section of the property view, or anywhere else in it
|
|
2735
|
+
* the subject. A row of a list or of the hierarchy is selected first, the way a click selects
|
|
2736
|
+
* it, and the subject it shows is copied; the header of a group copies the group, and a row
|
|
2737
|
+
* that selects nothing its figures. A tab is opened first, the way a click opens it, and
|
|
2738
|
+
* everything it lists is copied.
|
|
2739
|
+
*
|
|
2740
|
+
* @param {Node} target - What was right-clicked.
|
|
2741
|
+
* @returns {CopyTarget|null} What to copy, or null for a part of the panel nothing is copied
|
|
2742
|
+
* from, such as the toolbar.
|
|
2743
|
+
* @private
|
|
2744
|
+
*/
|
|
2745
|
+
_copyTargetAt(target) {
|
|
2746
|
+
const property = this._properties.copyTargetAt(target);
|
|
2747
|
+
if (property) return property;
|
|
2748
|
+
|
|
2749
|
+
const node = this._hierarchy.nodeAt(target);
|
|
2750
|
+
if (node) {
|
|
2751
|
+
this._hierarchy.select(node);
|
|
2752
|
+
return this._properties.subjectCopyTarget();
|
|
2753
|
+
}
|
|
2754
|
+
for (const list of this._lists()) {
|
|
2755
|
+
const row = list.rowAt(target);
|
|
2756
|
+
if (!row) continue;
|
|
2757
|
+
if (row.header) return { title: row.name, copy: options => copyGroup(list.rows, row.key, options) };
|
|
2758
|
+
if (row.inert) return { title: row.name, copy: () => copyListRow(row) };
|
|
2759
|
+
list.select(row.key);
|
|
2760
|
+
return this._properties.subjectCopyTarget();
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
const tab = Object.keys(this._tabButtons).find(id => this._tabButtons[id].contains(target));
|
|
2764
|
+
if (tab) {
|
|
2765
|
+
this._setTab(/** @type {any} */ (tab));
|
|
2766
|
+
return this._tabCopyTarget(tab);
|
|
2767
|
+
}
|
|
2768
|
+
return null;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* @param {string} tab - A tab.
|
|
2773
|
+
* @returns {CopyTarget|null} A copy of everything the tab lists: the hierarchy from its root,
|
|
2774
|
+
* or every row of the tab's list, whatever its filter shows.
|
|
2775
|
+
* @private
|
|
2776
|
+
*/
|
|
2777
|
+
_tabCopyTarget(tab) {
|
|
2778
|
+
const title = this._tabButtons[tab].textContent ?? tab;
|
|
2779
|
+
if (tab === 'hierarchy') {
|
|
2780
|
+
const root = this._app.root;
|
|
2781
|
+
return { title, copy: options => copySubject(root, buildNodeModel(root), options) };
|
|
2782
|
+
}
|
|
2783
|
+
const list = this._tabLists()[tab];
|
|
2784
|
+
return list ? { title, copy: options => copyList(title, list.rows, options) } : null;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
/**
|
|
2788
|
+
* @param {CopyTarget} copy - What the menu copies.
|
|
2789
|
+
* @returns {MenuItem[]} The entries of the menu: on its own, a
|
|
2790
|
+
* number of links deep, and every link there is.
|
|
2791
|
+
* @private
|
|
2792
|
+
*/
|
|
2793
|
+
_copyItems(copy) {
|
|
2794
|
+
const levels = n => `${n} level${n === 1 ? '' : 's'}`;
|
|
2795
|
+
return [{
|
|
2796
|
+
text: () => 'Copy as JSON',
|
|
2797
|
+
title: 'Copy it on its own: what it links to is named, not copied',
|
|
2798
|
+
run: () => this._copy(copy, 0)
|
|
2799
|
+
}, {
|
|
2800
|
+
text: () => `Copy ${levels(this._copyDepth)} deep`,
|
|
2801
|
+
title: 'Copy it with what it links to, up to this many links away: children, mesh instances, materials, textures',
|
|
2802
|
+
run: () => this._copy(copy, this._copyDepth),
|
|
2803
|
+
buttons: [{
|
|
2804
|
+
text: '−',
|
|
2805
|
+
title: 'One level less',
|
|
2806
|
+
disabled: () => this._copyDepth <= 1,
|
|
2807
|
+
run: () => this._setCopyDepth(this._copyDepth - 1)
|
|
2808
|
+
}, {
|
|
2809
|
+
text: '+',
|
|
2810
|
+
title: 'One level more',
|
|
2811
|
+
disabled: () => this._copyDepth >= MAX_COPY_DEPTH,
|
|
2812
|
+
run: () => this._setCopyDepth(this._copyDepth + 1)
|
|
2813
|
+
}]
|
|
2814
|
+
}, {
|
|
2815
|
+
text: () => 'Copy all levels',
|
|
2816
|
+
title: 'Copy it with everything it links to, however far, such as the whole hierarchy below a node',
|
|
2817
|
+
run: () => this._copy(copy, Infinity)
|
|
2818
|
+
}];
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
/**
|
|
2822
|
+
* @param {number} depth - How many links the deep copy follows.
|
|
2823
|
+
* @private
|
|
2824
|
+
*/
|
|
2825
|
+
_setCopyDepth(depth) {
|
|
2826
|
+
this._copyDepth = Math.max(1, Math.min(MAX_COPY_DEPTH, Math.round(depth)));
|
|
2827
|
+
this._saveSettings();
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
/**
|
|
2831
|
+
* Copies to the clipboard as JSON, and notes how much was copied.
|
|
2832
|
+
*
|
|
2833
|
+
* @param {CopyTarget} copy - What to copy.
|
|
2834
|
+
* @param {number} depth - How many links to follow, see {@link CopyOptions#depth}.
|
|
2835
|
+
* @private
|
|
2836
|
+
*/
|
|
2837
|
+
_copy(copy, depth) {
|
|
2838
|
+
const ctx = { ...this._context(), backlinks: false };
|
|
2839
|
+
const opaque = this._opaqueObjects();
|
|
2840
|
+
let result;
|
|
2841
|
+
let text;
|
|
2842
|
+
try {
|
|
2843
|
+
result = copy.copy({
|
|
2844
|
+
depth,
|
|
2845
|
+
modelFor: obj => this._copyModel(obj, ctx),
|
|
2846
|
+
opaque: obj => opaque.has(obj),
|
|
2847
|
+
exclude: obj => obj === this._transformTool?.root
|
|
2848
|
+
});
|
|
2849
|
+
text = stringifyCopy(result.json);
|
|
2850
|
+
} catch (e) {
|
|
2851
|
+
this._menu?.note(`Could not copy: ${e?.message ?? e}`);
|
|
2852
|
+
return;
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
const size = formatBytes(text.length);
|
|
2856
|
+
const note = `Copied ${result.objects ? `${result.objects} object${result.objects === 1 ? '' : 's'}, ` : ''}${size}` +
|
|
2857
|
+
`${result.truncated ? ', stopped at the object limit' : ''}`;
|
|
2858
|
+
// the clipboard of the window the panel is in, which is the one with focus once popped out
|
|
2859
|
+
const clipboard = (this._panel.ownerDocument.defaultView ?? window).navigator.clipboard;
|
|
2860
|
+
if (!clipboard) {
|
|
2861
|
+
this._menu?.note('The page has no access to the clipboard');
|
|
2862
|
+
return;
|
|
2863
|
+
}
|
|
2864
|
+
clipboard.writeText(text).then(
|
|
2865
|
+
() => this._menu?.note(note),
|
|
2866
|
+
e => this._menu?.note(`Could not copy: ${e?.message ?? e}`)
|
|
2867
|
+
);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
/**
|
|
2871
|
+
* @returns {Set<object>} The app's own objects, which a copy never follows, as through them it
|
|
2872
|
+
* would reach everything else.
|
|
2873
|
+
* @private
|
|
2874
|
+
*/
|
|
2875
|
+
_opaqueObjects() {
|
|
2876
|
+
const app = /** @type {any} */ (this._app);
|
|
2877
|
+
const objects = new Set([app, app.scene?.layers]);
|
|
2878
|
+
for (const value of Object.values(app)) {
|
|
2879
|
+
if (value && typeof value === 'object') objects.add(value);
|
|
2880
|
+
}
|
|
2881
|
+
for (const system of app.systems?.list ?? []) objects.add(system);
|
|
2882
|
+
for (const layer of app.scene?.layers?.layerList ?? []) objects.add(layer);
|
|
2883
|
+
return objects;
|
|
2884
|
+
}
|
|
2885
|
+
|
|
2886
|
+
/**
|
|
2887
|
+
* The model a copy follows a link into: what the tab the link opens on shows, see
|
|
2888
|
+
* {@link Inspector#_selectAny}, without the lists of what uses the object.
|
|
2889
|
+
*
|
|
2890
|
+
* @param {object} obj - An object reached through a link.
|
|
2891
|
+
* @param {PassModelContext & { app: AppBase, backlinks: boolean }} ctx - What the model
|
|
2892
|
+
* builders need besides their subject.
|
|
2893
|
+
* @returns {PropertySection[]|PropertyRow[]|null} The model, or null for an object no tab shows.
|
|
2894
|
+
* @private
|
|
2895
|
+
*/
|
|
2896
|
+
_copyModel(obj, ctx) {
|
|
2897
|
+
if (obj instanceof GraphNode) return buildNodeModel(obj);
|
|
2898
|
+
if (obj instanceof Component) return buildComponentModel(obj);
|
|
2899
|
+
if (obj instanceof MeshInstance) return meshInstanceRows(obj);
|
|
2900
|
+
if (obj instanceof RenderTarget) return buildRenderTargetModel(obj, ctx);
|
|
2901
|
+
if (obj instanceof FramePass) return buildPassModel(obj, ctx);
|
|
2902
|
+
if (obj instanceof LayerStepSelection) return buildStepModel(obj, ctx);
|
|
2903
|
+
if (obj instanceof Texture) return buildTextureModel(obj, ctx);
|
|
2904
|
+
if (obj instanceof Shader) return buildShaderModel(obj);
|
|
2905
|
+
if (obj instanceof Asset) return buildAssetModel(obj, ctx);
|
|
2906
|
+
if (isScriptClass(obj)) return buildScriptModel(/** @type {Function} */ (obj), ctx);
|
|
2907
|
+
if (obj instanceof Material) return buildMaterialModel(obj, ctx);
|
|
2908
|
+
if (obj instanceof Mesh) return buildMeshModel(obj, ctx);
|
|
2909
|
+
if (bufferKind(obj)) return buildBufferModel(obj, ctx);
|
|
2910
|
+
return null;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2632
2913
|
/**
|
|
2633
2914
|
* Reveals a linked object in the tab that lists it: nodes in the hierarchy, passes in the frame
|
|
2634
2915
|
* graph, render targets in their list.
|
|
@@ -2665,8 +2946,6 @@ class Inspector {
|
|
|
2665
2946
|
this._setTab('meshes');
|
|
2666
2947
|
this._meshList.selectItem(target);
|
|
2667
2948
|
} else if (bufferKind(target)) {
|
|
2668
|
-
// a filter hiding the buffer's kind would leave nothing to select
|
|
2669
|
-
if (this._bufferKind.value !== 'all' && this._bufferKind.value !== bufferKind(target)) this._bufferKind.value = 'all';
|
|
2670
2949
|
this._setTab('memory');
|
|
2671
2950
|
this._bufferList.selectItem(target);
|
|
2672
2951
|
}
|
|
@@ -2731,6 +3010,7 @@ class Inspector {
|
|
|
2731
3010
|
*/
|
|
2732
3011
|
_applyVisibility() {
|
|
2733
3012
|
if (!this._host) return;
|
|
3013
|
+
if (!this._visible) this._menu?.hide();
|
|
2734
3014
|
this._host.style.display = this._visible ? '' : 'none';
|
|
2735
3015
|
}
|
|
2736
3016
|
|
|
@@ -2864,11 +3144,10 @@ class Inspector {
|
|
|
2864
3144
|
break;
|
|
2865
3145
|
}
|
|
2866
3146
|
case 'memory': {
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
selected = buffer ? `${buffer.constructor.name} #${idOf(buffer)}` : '';
|
|
3147
|
+
counts = `${formatBytes(videoMemory(device))} of video memory`;
|
|
3148
|
+
// a buffer whose owner was not found is dimmed, and its name says only that
|
|
3149
|
+
const row = this._bufferList.selectedRow;
|
|
3150
|
+
selected = row ? `${KIND_NAMES[bufferKind(row.item)]}${row.dim ? '' : ` of ${row.name}`}` : '';
|
|
2872
3151
|
break;
|
|
2873
3152
|
}
|
|
2874
3153
|
case 'assets': {
|
|
@@ -2918,7 +3197,7 @@ class Inspector {
|
|
|
2918
3197
|
* @private
|
|
2919
3198
|
*/
|
|
2920
3199
|
_setPicking(on) {
|
|
2921
|
-
if (on === (this._canvasMode === 'pick')) return;
|
|
3200
|
+
if (on === (this._canvasMode === 'pick') || (on && this._transformTool)) return;
|
|
2922
3201
|
this._releaseCanvas();
|
|
2923
3202
|
if (on) {
|
|
2924
3203
|
this._stopFly();
|
|
@@ -3010,6 +3289,7 @@ class Inspector {
|
|
|
3010
3289
|
* @private
|
|
3011
3290
|
*/
|
|
3012
3291
|
_startDrive(kind, camera) {
|
|
3292
|
+
if (this._transformTool) return;
|
|
3013
3293
|
this._stopFly();
|
|
3014
3294
|
this._setPicking(false);
|
|
3015
3295
|
const target = this._selected;
|
|
@@ -3054,16 +3334,22 @@ class Inspector {
|
|
|
3054
3334
|
}
|
|
3055
3335
|
this._flyBtn?.classList.remove('pci-active');
|
|
3056
3336
|
this._orbitBtn?.classList.remove('pci-active');
|
|
3057
|
-
this.
|
|
3337
|
+
this._applyViewToolState();
|
|
3058
3338
|
}
|
|
3059
3339
|
|
|
3060
3340
|
/**
|
|
3061
|
-
* Orbit
|
|
3341
|
+
* Pick, Fly and Orbit take the view from the app, which a gizmo needs to be used in, so their
|
|
3342
|
+
* buttons are off while one is on. Orbit also needs a node to orbit around, so its button is off
|
|
3343
|
+
* until one is selected.
|
|
3062
3344
|
*
|
|
3063
3345
|
* @private
|
|
3064
3346
|
*/
|
|
3065
|
-
|
|
3066
|
-
if (this._orbitBtn)
|
|
3347
|
+
_applyViewToolState() {
|
|
3348
|
+
if (!this._orbitBtn) return;
|
|
3349
|
+
const gizmo = !!this._transformTool;
|
|
3350
|
+
this._pickBtn.disabled = gizmo;
|
|
3351
|
+
this._flyBtn.disabled = gizmo;
|
|
3352
|
+
this._orbitBtn.disabled = gizmo || (!this._selected && !(this._fly instanceof CameraOrbit));
|
|
3067
3353
|
}
|
|
3068
3354
|
|
|
3069
3355
|
/**
|
|
@@ -3113,6 +3399,7 @@ class Inspector {
|
|
|
3113
3399
|
if (!this._pickBtn) return;
|
|
3114
3400
|
this._setPicking(false);
|
|
3115
3401
|
this._stopFly();
|
|
3402
|
+
this._setTransformMode(null);
|
|
3116
3403
|
this._resetRenderOverrides();
|
|
3117
3404
|
this._modeEl.textContent = '';
|
|
3118
3405
|
}
|
|
@@ -3200,10 +3487,70 @@ class Inspector {
|
|
|
3200
3487
|
} else if (this._fly) {
|
|
3201
3488
|
const keys = this._fly.zooms ? 'W S zoom, A D Q E pan' : 'WASD QE move';
|
|
3202
3489
|
text = `FLY · "${this._fly.camera.entity.name}" · ${keys}, drag to look, wheel speed ${this._fly.speed.toFixed(1)}, Shift faster · Esc stops`;
|
|
3490
|
+
} else if (this._transformTool) {
|
|
3491
|
+
const selected = this._selected;
|
|
3492
|
+
text = `${this._transformTool.mode.toUpperCase()} · ${selected ? `drag the gizmo on "${selected.name}"` : 'select an entity'} · Esc stops`;
|
|
3203
3493
|
}
|
|
3204
3494
|
if (this._modeEl.textContent !== text && (text || !this._modeEl.textContent.includes(' · no camera'))) this._modeEl.textContent = text;
|
|
3205
3495
|
}
|
|
3206
3496
|
|
|
3497
|
+
/**
|
|
3498
|
+
* Turns a gizmo on, in place of the one that is on, or turns it off. The gizmo is drawn and
|
|
3499
|
+
* used in the view of the first camera drawing to the screen, which Pick, Fly and Orbit would
|
|
3500
|
+
* take from the app, so they stop and stay off while it is on.
|
|
3501
|
+
*
|
|
3502
|
+
* @param {TransformMode|null} mode - What the gizmo does, or null to turn it off.
|
|
3503
|
+
* @private
|
|
3504
|
+
*/
|
|
3505
|
+
_setTransformMode(mode) {
|
|
3506
|
+
window.removeEventListener('keydown', this._onTransformKey, true);
|
|
3507
|
+
this._transformTool?.destroy();
|
|
3508
|
+
this._transformTool = null;
|
|
3509
|
+
if (mode) {
|
|
3510
|
+
this._setPicking(false);
|
|
3511
|
+
this._stopFly();
|
|
3512
|
+
const camera = collectCameras(this._app).find(isScreenCamera) ?? null;
|
|
3513
|
+
if (camera) {
|
|
3514
|
+
this._transformTool = new TransformTool(this._app, mode, camera);
|
|
3515
|
+
this._transformTool.attach(this._selected);
|
|
3516
|
+
// Esc turns it off, as it ends Pick, Fly and Orbit
|
|
3517
|
+
window.addEventListener('keydown', this._onTransformKey, true);
|
|
3518
|
+
} else {
|
|
3519
|
+
this._modeEl.textContent = `${mode.toUpperCase()} · no camera draws to the screen`;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
for (const [id, button] of Object.entries(this._transformBtns ?? {})) {
|
|
3523
|
+
button.classList.toggle('pci-active', this._transformTool?.mode === id);
|
|
3524
|
+
}
|
|
3525
|
+
this._applyViewToolState();
|
|
3526
|
+
this._hierarchy?.refresh();
|
|
3527
|
+
// the Cameras tab offers to fly only while no gizmo is on
|
|
3528
|
+
this._properties?.refresh();
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
/**
|
|
3532
|
+
* @param {KeyboardEvent} e - A key pressed while a gizmo is on.
|
|
3533
|
+
* @private
|
|
3534
|
+
*/
|
|
3535
|
+
_onTransformKey = (e) => {
|
|
3536
|
+
// Escape in a text field, such as a value being edited, is the field's own
|
|
3537
|
+
if (e.key !== 'Escape' || isTextTarget(e)) return;
|
|
3538
|
+
e.stopImmediatePropagation();
|
|
3539
|
+
this._setTransformMode(null);
|
|
3540
|
+
};
|
|
3541
|
+
|
|
3542
|
+
/**
|
|
3543
|
+
* Hands the pointer to the gizmo first, and keeps from everything else what it keeps.
|
|
3544
|
+
*
|
|
3545
|
+
* @param {Event} e - A pointer event anywhere in the window.
|
|
3546
|
+
* @private
|
|
3547
|
+
*/
|
|
3548
|
+
_onTransformPointer = (e) => {
|
|
3549
|
+
if (!this._transformTool?.handle(e)) return;
|
|
3550
|
+
e.stopImmediatePropagation();
|
|
3551
|
+
if (e.cancelable) e.preventDefault();
|
|
3552
|
+
};
|
|
3553
|
+
|
|
3207
3554
|
/**
|
|
3208
3555
|
* Outlines a node in the viewport for the current frame.
|
|
3209
3556
|
*
|