@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/styles.js
CHANGED
|
@@ -29,7 +29,10 @@ const ICONS = {
|
|
|
29
29
|
fly: '<path d="m16 13 5.22 3.48a.5.5 0 0 0 .78-.42V7.87a.5.5 0 0 0-.75-.43L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/>',
|
|
30
30
|
popout: '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
|
|
31
31
|
dock: '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M15 3v18"/>',
|
|
32
|
-
close: '<path d="M18 6 6 18M6 6l12 12"/>'
|
|
32
|
+
close: '<path d="M18 6 6 18M6 6l12 12"/>',
|
|
33
|
+
translate: '<path d="M12 3v18M3 12h18"/><path d="m9 6 3-3 3 3"/><path d="m9 18 3 3 3-3"/><path d="m6 9-3 3 3 3"/><path d="m18 9 3 3-3 3"/>',
|
|
34
|
+
rotate: '<path d="M20 12a8 8 0 1 1-2.34-5.66"/><path d="M20 3v4h-4"/>',
|
|
35
|
+
scale: '<rect x="3" y="11" width="10" height="10" rx="1"/><path d="m13 11 8-8"/><path d="M15 3h6v6"/>'
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
/**
|
|
@@ -368,7 +371,8 @@ ${ICON_RULES}
|
|
|
368
371
|
.pci-tip {
|
|
369
372
|
display: none;
|
|
370
373
|
position: fixed;
|
|
371
|
-
|
|
374
|
+
/* above the menu, whose entries have tooltips */
|
|
375
|
+
z-index: 3;
|
|
372
376
|
max-width: 320px;
|
|
373
377
|
padding: 5px 8px;
|
|
374
378
|
background: var(--pci-raised);
|
|
@@ -381,6 +385,93 @@ ${ICON_RULES}
|
|
|
381
385
|
pointer-events: none;
|
|
382
386
|
}
|
|
383
387
|
|
|
388
|
+
.pci-menu {
|
|
389
|
+
display: none;
|
|
390
|
+
position: fixed;
|
|
391
|
+
z-index: 2;
|
|
392
|
+
min-width: 200px;
|
|
393
|
+
max-width: 320px;
|
|
394
|
+
padding: 4px 0;
|
|
395
|
+
background: var(--pci-raised);
|
|
396
|
+
color: var(--pci-text);
|
|
397
|
+
border: 1px solid var(--pci-border-strong);
|
|
398
|
+
border-radius: 6px;
|
|
399
|
+
box-shadow: var(--pci-shadow);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.pci-menu-title {
|
|
403
|
+
padding: 2px 10px 5px;
|
|
404
|
+
margin-bottom: 4px;
|
|
405
|
+
color: var(--pci-text-muted);
|
|
406
|
+
border-bottom: 1px solid var(--pci-border);
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
text-overflow: ellipsis;
|
|
409
|
+
white-space: nowrap;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.pci-menu-item {
|
|
413
|
+
display: flex;
|
|
414
|
+
align-items: center;
|
|
415
|
+
gap: 8px;
|
|
416
|
+
padding: 3px 10px;
|
|
417
|
+
cursor: pointer;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.pci-menu-item:hover {
|
|
421
|
+
background: var(--pci-selected);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.pci-menu-label {
|
|
425
|
+
flex: 1 1 auto;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.pci-menu-buttons {
|
|
429
|
+
display: flex;
|
|
430
|
+
gap: 2px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.pci-menu-button {
|
|
434
|
+
font: inherit;
|
|
435
|
+
line-height: 16px;
|
|
436
|
+
min-width: 20px;
|
|
437
|
+
padding: 0 4px;
|
|
438
|
+
color: var(--pci-text-secondary);
|
|
439
|
+
background: rgba(255, 255, 255, 0.07);
|
|
440
|
+
border: none;
|
|
441
|
+
border-radius: 4px;
|
|
442
|
+
cursor: pointer;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.pci-menu-button:not(:disabled):hover {
|
|
446
|
+
color: #ffffff;
|
|
447
|
+
background: var(--pci-accent-strong);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.pci-menu-button:disabled {
|
|
451
|
+
opacity: 0.35;
|
|
452
|
+
cursor: default;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.pci-toast {
|
|
456
|
+
display: none;
|
|
457
|
+
position: absolute;
|
|
458
|
+
z-index: 2;
|
|
459
|
+
left: 50%;
|
|
460
|
+
bottom: 36px;
|
|
461
|
+
transform: translateX(-50%);
|
|
462
|
+
max-width: calc(100% - 24px);
|
|
463
|
+
padding: 5px 10px;
|
|
464
|
+
background: var(--pci-raised);
|
|
465
|
+
color: var(--pci-text);
|
|
466
|
+
border: 1px solid var(--pci-border-strong);
|
|
467
|
+
border-radius: 6px;
|
|
468
|
+
box-shadow: var(--pci-shadow);
|
|
469
|
+
white-space: nowrap;
|
|
470
|
+
overflow: hidden;
|
|
471
|
+
text-overflow: ellipsis;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
}
|
|
474
|
+
|
|
384
475
|
.pci-check {
|
|
385
476
|
display: inline-flex;
|
|
386
477
|
align-items: center;
|
|
@@ -509,6 +600,70 @@ ${ICON_RULES}
|
|
|
509
600
|
opacity: 0.45;
|
|
510
601
|
}
|
|
511
602
|
|
|
603
|
+
/* the head of a group of rows, which opens and closes it */
|
|
604
|
+
.pci-lrow.pci-lrow-header {
|
|
605
|
+
background-color: var(--pci-raised);
|
|
606
|
+
color: var(--pci-text);
|
|
607
|
+
font-weight: 600;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.pci-lrow.pci-lrow-header ~ .pci-lrow.pci-lrow-header {
|
|
611
|
+
border-top: 1px solid var(--pci-border);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.pci-lrow.pci-lrow-header::before {
|
|
615
|
+
content: "▸";
|
|
616
|
+
flex: 0 0 10px;
|
|
617
|
+
color: var(--pci-text-label);
|
|
618
|
+
font-size: 12px;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.pci-lrow.pci-lrow-header.pci-open::before {
|
|
622
|
+
content: "▾";
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.pci-lrow.pci-lrow-header.pci-leaf::before {
|
|
626
|
+
content: "";
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.pci-lrow.pci-lrow-header:hover {
|
|
630
|
+
background-color: #263133;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/* rows that only show figures, and headers with nothing to open */
|
|
634
|
+
.pci-lrow.pci-inert,
|
|
635
|
+
.pci-lrow.pci-lrow-header.pci-leaf {
|
|
636
|
+
cursor: default;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.pci-lrow.pci-inert:hover {
|
|
640
|
+
background-color: transparent;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.pci-lrow.pci-lrow-header.pci-leaf:hover {
|
|
644
|
+
background-color: var(--pci-raised);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/* a count and a size in columns of their own, lining up from row to row */
|
|
648
|
+
.pci-cell-count {
|
|
649
|
+
flex-shrink: 0;
|
|
650
|
+
margin-left: auto;
|
|
651
|
+
min-width: 5ch;
|
|
652
|
+
text-align: right;
|
|
653
|
+
color: var(--pci-text-label);
|
|
654
|
+
font-family: var(--pci-mono);
|
|
655
|
+
font-size: 10.5px;
|
|
656
|
+
font-weight: normal;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.pci-cell-size {
|
|
660
|
+
flex-shrink: 0;
|
|
661
|
+
min-width: 11ch;
|
|
662
|
+
text-align: right;
|
|
663
|
+
font-family: var(--pci-mono);
|
|
664
|
+
font-size: 10.5px;
|
|
665
|
+
}
|
|
666
|
+
|
|
512
667
|
.pci-cell {
|
|
513
668
|
flex: 0 1 auto;
|
|
514
669
|
min-width: 0;
|
|
@@ -782,6 +937,45 @@ ${ICON_RULES}
|
|
|
782
937
|
.pci-v-ref { color: #4fc1ff; }
|
|
783
938
|
.pci-v-err { color: #f14c4c; }
|
|
784
939
|
|
|
940
|
+
/* an editable value reads as a text field, and its editor opens in the same place at the same size */
|
|
941
|
+
.pci-prop.pci-editable .pci-value {
|
|
942
|
+
box-sizing: border-box;
|
|
943
|
+
margin: -1px 0;
|
|
944
|
+
padding: 0 4px;
|
|
945
|
+
cursor: text;
|
|
946
|
+
background: var(--pci-input);
|
|
947
|
+
border: 1px solid var(--pci-border-strong);
|
|
948
|
+
border-radius: 3px;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
.pci-prop.pci-editable .pci-value:hover {
|
|
952
|
+
border-color: var(--pci-text-muted);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.pci-prop.pci-editing .pci-value {
|
|
956
|
+
margin: 0;
|
|
957
|
+
padding: 0;
|
|
958
|
+
background: none;
|
|
959
|
+
border: none;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
.pci-edit {
|
|
963
|
+
box-sizing: border-box;
|
|
964
|
+
width: 100%;
|
|
965
|
+
margin: -1px 0;
|
|
966
|
+
padding: 0 4px;
|
|
967
|
+
font: inherit;
|
|
968
|
+
color: var(--pci-text);
|
|
969
|
+
background: var(--pci-input);
|
|
970
|
+
border: 1px solid var(--pci-accent);
|
|
971
|
+
border-radius: 3px;
|
|
972
|
+
outline: none;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
.pci-edit.pci-invalid {
|
|
976
|
+
border-color: #f14c4c;
|
|
977
|
+
}
|
|
978
|
+
|
|
785
979
|
.pci-link {
|
|
786
980
|
cursor: pointer;
|
|
787
981
|
text-decoration: underline dotted;
|
package/src/texture-view.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
import { containerParts, resourceAssets } from './asset-view.js';
|
|
6
6
|
import { describeValue } from './describe.js';
|
|
7
|
-
import { formatBytes, formatName, makeSection, push, read, reflectRows } from './model.js';
|
|
7
|
+
import { backlink, formatBytes, formatName, makeSection, push, read, reflectRows } from './model.js';
|
|
8
8
|
|
|
9
9
|
/** @import { AppBase } from 'playcanvas' */
|
|
10
10
|
/** @import { GraphicsDevice } from 'playcanvas' */
|
|
@@ -154,15 +154,15 @@ function buildTextureModel(texture, ctx) {
|
|
|
154
154
|
push(general, 'from asset', describeValue(asset));
|
|
155
155
|
// a texture a glb carries comes from the container that loaded it
|
|
156
156
|
const container = containerParts(registry).parentOf.get(asset);
|
|
157
|
-
if (container) push(general, 'from container', describeValue(container));
|
|
157
|
+
if (container) push(general, 'from container', backlink(describeValue(container)));
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
const owners = attachmentTargets(ctx.device).get(texture) ?? [];
|
|
161
|
-
push(general, 'attached to', {
|
|
161
|
+
push(general, 'attached to', backlink({
|
|
162
162
|
text: owners.length ? `${owners.length} render target${owners.length === 1 ? '' : 's'}` : 'no render target',
|
|
163
163
|
cls: owners.length ? 'obj' : 'null',
|
|
164
164
|
items: owners.map(rt => ({ label: '', text: rt.name || '(unnamed)', cls: 'ref', target: rt }))
|
|
165
|
-
});
|
|
165
|
+
}));
|
|
166
166
|
sections.push(general);
|
|
167
167
|
|
|
168
168
|
const sampling = makeSection('sampling', 'Sampling');
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Gizmo, RotateGizmo, ScaleGizmo, TransformGizmo, TranslateGizmo } from 'playcanvas';
|
|
2
|
+
|
|
3
|
+
import { syncBody } from './node-model.js';
|
|
4
|
+
|
|
5
|
+
/** @import { AppBase } from 'playcanvas' */
|
|
6
|
+
/** @import { CameraComponent } from 'playcanvas' */
|
|
7
|
+
/** @import { Entity } from 'playcanvas' */
|
|
8
|
+
/** @import { GraphNode } from 'playcanvas' */
|
|
9
|
+
/** @import { Layer } from 'playcanvas' */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {'translate'|'rotate'|'scale'} TransformMode
|
|
13
|
+
* @ignore
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** @type {Record<TransformMode, typeof TranslateGizmo|typeof RotateGizmo|typeof ScaleGizmo>} */
|
|
17
|
+
const GIZMOS = { translate: TranslateGizmo, rotate: RotateGizmo, scale: ScaleGizmo };
|
|
18
|
+
|
|
19
|
+
// the input the tool sees first, ahead of the app, so a handle being dragged keeps it to itself
|
|
20
|
+
const POINTER_EVENTS = [
|
|
21
|
+
'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'mousedown', 'mousemove', 'mouseup', 'click',
|
|
22
|
+
'dblclick', 'wheel', 'contextmenu', 'touchstart', 'touchmove', 'touchend'
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Moves, rotates or scales a node in the view with one of the engine's transform gizmos, drawn on
|
|
27
|
+
* a layer of its own over the view of a camera. The gizmo listens to the canvas itself, after the
|
|
28
|
+
* app's own listeners, so a drag of its handles would also reach the app and move its camera too.
|
|
29
|
+
* The tool takes those listeners away and hands the gizmo the pointer itself: a press on a handle
|
|
30
|
+
* and the drag that follows go to the gizmo alone, and everything else to the app as usual.
|
|
31
|
+
*
|
|
32
|
+
* The gizmo has no public way to be handed input, so it is handed its own pointer handlers. Engines
|
|
33
|
+
* whose gizmos lack them get no tool, see {@link TransformTool.supported}.
|
|
34
|
+
*
|
|
35
|
+
* @ignore
|
|
36
|
+
*/
|
|
37
|
+
class TransformTool {
|
|
38
|
+
/**
|
|
39
|
+
* Whether the engine's gizmos can be driven by the tool.
|
|
40
|
+
*
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
static get supported() {
|
|
44
|
+
const proto = /** @type {any} */ (Gizmo.prototype);
|
|
45
|
+
return ['_onPointerDown', '_onPointerMove', '_onPointerUp'].every(name => typeof proto[name] === 'function');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* What the tool does to the node.
|
|
50
|
+
*
|
|
51
|
+
* @type {TransformMode}
|
|
52
|
+
*/
|
|
53
|
+
mode;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @type {AppBase}
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
_app;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @type {Layer}
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
_layer;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @type {any}
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
_gizmo;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Whether a handle is being dragged, which keeps the pointer from the app until it is let go.
|
|
75
|
+
*
|
|
76
|
+
* @type {boolean}
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
_dragging = false;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether the click that follows the end of a drag is still to come, to keep it from the app.
|
|
83
|
+
*
|
|
84
|
+
* @type {boolean}
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
_endingDrag = false;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {AppBase} app - The app.
|
|
91
|
+
* @param {TransformMode} mode - What the tool does to the node.
|
|
92
|
+
* @param {CameraComponent} camera - The camera whose view the gizmo is drawn and used in.
|
|
93
|
+
* @param {() => void} [onTransform] - Called whenever the gizmo changes the node.
|
|
94
|
+
*/
|
|
95
|
+
constructor(app, mode, camera, onTransform) {
|
|
96
|
+
this._app = app;
|
|
97
|
+
this.mode = mode;
|
|
98
|
+
this._layer = Gizmo.createLayer(app, 'Inspector gizmo');
|
|
99
|
+
const gizmo = new GIZMOS[mode](camera, this._layer);
|
|
100
|
+
this._gizmo = gizmo;
|
|
101
|
+
|
|
102
|
+
const canvas = app.graphicsDevice.canvas;
|
|
103
|
+
canvas.removeEventListener('pointerdown', gizmo._onPointerDown);
|
|
104
|
+
canvas.removeEventListener('pointermove', gizmo._onPointerMove);
|
|
105
|
+
canvas.removeEventListener('pointerup', gizmo._onPointerUp);
|
|
106
|
+
|
|
107
|
+
gizmo.on(Gizmo.EVENT_POINTERDOWN, (x, y, meshInstance) => {
|
|
108
|
+
this._dragging = !!meshInstance;
|
|
109
|
+
});
|
|
110
|
+
gizmo.on(TransformGizmo.EVENT_TRANSFORMMOVE, () => {
|
|
111
|
+
for (const node of gizmo.nodes) syncBody(node);
|
|
112
|
+
onTransform?.();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The entity of the gizmo, which the app's hierarchy holds while the tool is on.
|
|
118
|
+
*
|
|
119
|
+
* @type {Entity}
|
|
120
|
+
*/
|
|
121
|
+
get root() {
|
|
122
|
+
return this._gizmo.root;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Puts the gizmo on a node, or takes it off.
|
|
127
|
+
*
|
|
128
|
+
* @param {GraphNode|null} node - The node, or null for none.
|
|
129
|
+
*/
|
|
130
|
+
attach(node) {
|
|
131
|
+
this._gizmo.detach();
|
|
132
|
+
this._dragging = false;
|
|
133
|
+
if (node) this._gizmo.attach([node]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Hands the gizmo a pointer event on the canvas, ahead of everything else listening to it.
|
|
138
|
+
*
|
|
139
|
+
* @param {Event} e - The event.
|
|
140
|
+
* @returns {boolean} Whether the gizmo keeps the event, which nothing else is then to see.
|
|
141
|
+
*/
|
|
142
|
+
handle(e) {
|
|
143
|
+
const gizmo = this._gizmo;
|
|
144
|
+
const onCanvas = e.target === this._app.graphicsDevice.canvas;
|
|
145
|
+
switch (e.type) {
|
|
146
|
+
case 'pointerdown':
|
|
147
|
+
if (!onCanvas) return false;
|
|
148
|
+
this._endingDrag = false;
|
|
149
|
+
gizmo._onPointerDown(e);
|
|
150
|
+
return this._dragging;
|
|
151
|
+
case 'pointermove':
|
|
152
|
+
// the gizmo lights up the handle under the pointer, whether it keeps the event or not
|
|
153
|
+
if (onCanvas || this._dragging) gizmo._onPointerMove(e);
|
|
154
|
+
return this._dragging;
|
|
155
|
+
case 'pointerup':
|
|
156
|
+
case 'pointercancel': {
|
|
157
|
+
if (onCanvas || this._dragging) gizmo._onPointerUp(e);
|
|
158
|
+
const dragged = this._dragging;
|
|
159
|
+
this._dragging = false;
|
|
160
|
+
this._endingDrag = dragged;
|
|
161
|
+
return dragged;
|
|
162
|
+
}
|
|
163
|
+
case 'click':
|
|
164
|
+
case 'dblclick': {
|
|
165
|
+
const ending = this._endingDrag;
|
|
166
|
+
this._endingDrag = false;
|
|
167
|
+
return ending;
|
|
168
|
+
}
|
|
169
|
+
default:
|
|
170
|
+
return this._dragging;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Takes the gizmo, its layer and its entity out of the app.
|
|
176
|
+
*/
|
|
177
|
+
destroy() {
|
|
178
|
+
const camera = this._gizmo.camera;
|
|
179
|
+
this._gizmo.destroy();
|
|
180
|
+
camera.layers = camera.layers.filter(id => id !== this._layer.id);
|
|
181
|
+
this._app.scene.layers.remove(this._layer);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { POINTER_EVENTS as TRANSFORM_POINTER_EVENTS, TransformTool };
|
package/types/asset-view.d.ts
CHANGED
|
@@ -28,11 +28,13 @@ export function assetUsers(app: AppBase, asset: Asset): {
|
|
|
28
28
|
* into (linked), the components using it (linked), and every other public property.
|
|
29
29
|
*
|
|
30
30
|
* @param {Asset} asset - The asset.
|
|
31
|
-
* @param {{ app: AppBase }} ctx - The app, to find the asset's users
|
|
31
|
+
* @param {{ app: AppBase, backlinks?: boolean }} ctx - The app, to find the asset's users, and
|
|
32
|
+
* whether to find them at all, which a copy has no use for.
|
|
32
33
|
* @returns {PropertySection[]} The sections.
|
|
33
34
|
*/
|
|
34
35
|
export function buildAssetModel(asset: Asset, ctx: {
|
|
35
36
|
app: AppBase;
|
|
37
|
+
backlinks?: boolean;
|
|
36
38
|
}): PropertySection[];
|
|
37
39
|
/**
|
|
38
40
|
* Every asset in the registry, in the requested order. Assets with no file sort last by size, and
|
package/types/camera-view.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export type CameraActions = {
|
|
|
10
10
|
* - The camera being flown, if any.
|
|
11
11
|
*/
|
|
12
12
|
flying: CameraComponent | null;
|
|
13
|
+
/**
|
|
14
|
+
* - Why no camera can be flown now, such as a gizmo being on.
|
|
15
|
+
*/
|
|
16
|
+
unavailable?: string | null;
|
|
13
17
|
};
|
|
14
18
|
/**
|
|
15
19
|
* Everything the property view shows for a camera: where and how it draws, the layers it renders,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An entry of a context menu.
|
|
3
|
+
*/
|
|
4
|
+
export type MenuItem = object;
|
|
5
|
+
export type MenuButton = object;
|
|
6
|
+
/**
|
|
7
|
+
* A menu opened where the pointer is, and a note shown briefly at the bottom of the panel, such as
|
|
8
|
+
* for what was copied. Both live in the panel, so they move with it into a popped-out window. The
|
|
9
|
+
* menu closes on a choice, a press anywhere outside it, Escape, scrolling and leaving the window.
|
|
10
|
+
*
|
|
11
|
+
* @ignore
|
|
12
|
+
*/
|
|
13
|
+
export class ContextMenu {
|
|
14
|
+
/**
|
|
15
|
+
* @param {HTMLElement} panel - The panel to show the menu and notes in.
|
|
16
|
+
*/
|
|
17
|
+
constructor(panel: HTMLElement);
|
|
18
|
+
/**
|
|
19
|
+
* @type {HTMLElement}
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private _panel;
|
|
23
|
+
/**
|
|
24
|
+
* @type {HTMLElement}
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private _menu;
|
|
28
|
+
/**
|
|
29
|
+
* @type {HTMLElement}
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
private _note;
|
|
33
|
+
/**
|
|
34
|
+
* @type {number}
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
private _noteTimer;
|
|
38
|
+
/**
|
|
39
|
+
* The document the closing listeners are on while the menu is open.
|
|
40
|
+
*
|
|
41
|
+
* @type {Document|null}
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private _doc;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the menu is open.
|
|
47
|
+
*
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
*/
|
|
50
|
+
get open(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Opens the menu at a point, in place of any menu already open.
|
|
53
|
+
*
|
|
54
|
+
* @param {number} x - The point, in client pixels.
|
|
55
|
+
* @param {number} y - The point, in client pixels.
|
|
56
|
+
* @param {string} title - What the menu acts on.
|
|
57
|
+
* @param {MenuItem[]} items - The entries.
|
|
58
|
+
*/
|
|
59
|
+
show(x: number, y: number, title: string, items: MenuItem[]): void;
|
|
60
|
+
/**
|
|
61
|
+
* Closes the menu, if it is open.
|
|
62
|
+
*/
|
|
63
|
+
hide: () => void;
|
|
64
|
+
/**
|
|
65
|
+
* Shows a note at the bottom of the panel for a moment.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} text - The note.
|
|
68
|
+
*/
|
|
69
|
+
note(text: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* Closes the menu and removes its elements.
|
|
72
|
+
*/
|
|
73
|
+
destroy(): void;
|
|
74
|
+
/**
|
|
75
|
+
* @param {MenuItem} item - An entry.
|
|
76
|
+
* @returns {HTMLElement} Its element.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
private _entry;
|
|
80
|
+
/**
|
|
81
|
+
* @param {PointerEvent} e - The event.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
private _onPointerDown;
|
|
85
|
+
/**
|
|
86
|
+
* @param {KeyboardEvent} e - The event.
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
private _onKeyDown;
|
|
90
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How far a copy follows the links of what it copies.
|
|
3
|
+
*/
|
|
4
|
+
export type CopyOptions = object;
|
|
5
|
+
export type CopyResult = object;
|
|
6
|
+
/**
|
|
7
|
+
* Copies a group of a list, under its title. See {@link JsonCopy#group}.
|
|
8
|
+
*
|
|
9
|
+
* @param {ListRow[]} rows - The rows of the list.
|
|
10
|
+
* @param {string} key - The key of the group's header.
|
|
11
|
+
* @param {CopyOptions} options - How far to follow links from each entry.
|
|
12
|
+
* @returns {CopyResult} The copy, empty when the group is gone.
|
|
13
|
+
*/
|
|
14
|
+
export function copyGroup(rows: ListRow[], key: string, options: CopyOptions): CopyResult;
|
|
15
|
+
/**
|
|
16
|
+
* Copies a list, such as everything a tab lists, under its name. See {@link JsonCopy#listRows}.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} title - The name of the list.
|
|
19
|
+
* @param {ListRow[]} rows - Its rows, all of them, whatever its filter shows.
|
|
20
|
+
* @param {CopyOptions} options - How far to follow links from each entry.
|
|
21
|
+
* @returns {CopyResult} The copy.
|
|
22
|
+
*/
|
|
23
|
+
export function copyList(title: string, rows: ListRow[], options: CopyOptions): CopyResult;
|
|
24
|
+
/**
|
|
25
|
+
* Copies the figures of a row of a list that selects nothing, such as the size of a pool.
|
|
26
|
+
*
|
|
27
|
+
* @param {ListRow} row - The row.
|
|
28
|
+
* @returns {CopyResult} The copy.
|
|
29
|
+
*/
|
|
30
|
+
export function copyListRow(row: ListRow): CopyResult;
|
|
31
|
+
/**
|
|
32
|
+
* Copies a row. A row standing for an object copies the object, counting the links followed from
|
|
33
|
+
* it; a list copies its entries the same way, each as if it was copied on its own. Anything else
|
|
34
|
+
* is copied under its label.
|
|
35
|
+
*
|
|
36
|
+
* @param {PropertyRow} row - The row.
|
|
37
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
38
|
+
* @returns {CopyResult} The copy.
|
|
39
|
+
*/
|
|
40
|
+
export function copyRow(row: PropertyRow, options: CopyOptions): CopyResult;
|
|
41
|
+
/**
|
|
42
|
+
* Copies a section of the subject, under its title.
|
|
43
|
+
*
|
|
44
|
+
* @param {PropertySection} section - The section.
|
|
45
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
46
|
+
* @returns {CopyResult} The copy.
|
|
47
|
+
*/
|
|
48
|
+
export function copySection(section: PropertySection, options: CopyOptions): CopyResult;
|
|
49
|
+
/**
|
|
50
|
+
* Copies the subject of the panel, which is where the links followed are counted from.
|
|
51
|
+
*
|
|
52
|
+
* @param {object} subject - The subject.
|
|
53
|
+
* @param {PropertySection[]} sections - What the panel shows for it.
|
|
54
|
+
* @param {CopyOptions} options - How far to follow links.
|
|
55
|
+
* @returns {CopyResult} The copy.
|
|
56
|
+
*/
|
|
57
|
+
export function copySubject(subject: object, sections: PropertySection[], options: CopyOptions): CopyResult;
|
|
58
|
+
/**
|
|
59
|
+
* Prints a copy as indented JSON, the way `JSON.stringify` does, except that a list of plain
|
|
60
|
+
* values stays on one line, so a vector reads as `[0, 1, 0]` rather than taking five lines.
|
|
61
|
+
*
|
|
62
|
+
* @param {*} json - The copy.
|
|
63
|
+
* @param {string} [indent] - The indentation of the line the value starts on.
|
|
64
|
+
* @returns {string} The text.
|
|
65
|
+
*/
|
|
66
|
+
export function stringifyCopy(json: any, indent?: string): string;
|
|
67
|
+
import type { ListRow } from './list-view.js';
|
|
68
|
+
import type { PropertyRow } from './model.js';
|
|
69
|
+
import type { PropertySection } from './model.js';
|
package/types/describe.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function collectProperties(obj: object, stopPrototypes: object[], skip?:
|
|
|
22
22
|
*
|
|
23
23
|
* @param {*} value - The value to describe.
|
|
24
24
|
* @param {number} [depth] - The nesting depth. Nested values are kept to a short type name.
|
|
25
|
-
* @returns {Described} The description
|
|
25
|
+
* @returns {Described} The description, carrying the value as `raw`.
|
|
26
26
|
*/
|
|
27
27
|
export function describeValue(value: any, depth?: number): Described;
|
|
28
28
|
/**
|
|
@@ -41,6 +41,13 @@ export class HierarchyView {
|
|
|
41
41
|
* @type {(node: GraphNode) => boolean}
|
|
42
42
|
*/
|
|
43
43
|
isLocked: (node: GraphNode) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Decides which nodes are left out of the tree, with everything below them, such as the
|
|
46
|
+
* entity of a gizmo the panel adds to the hierarchy. Defaults to none.
|
|
47
|
+
*
|
|
48
|
+
* @type {(node: GraphNode) => boolean}
|
|
49
|
+
*/
|
|
50
|
+
isHidden: (node: GraphNode) => boolean;
|
|
44
51
|
/**
|
|
45
52
|
* The root of the rendered hierarchy.
|
|
46
53
|
*
|
|
@@ -118,6 +125,12 @@ export class HierarchyView {
|
|
|
118
125
|
* Synchronizes the rendered tree with the hierarchy.
|
|
119
126
|
*/
|
|
120
127
|
refresh(): void;
|
|
128
|
+
/**
|
|
129
|
+
* @param {Node} element - An element, such as the target of a context menu event.
|
|
130
|
+
* @returns {GraphNode|null} The node whose row it is in, or null when it is in none. The rows
|
|
131
|
+
* of a node's children are nested under its element, so only the row itself is matched.
|
|
132
|
+
*/
|
|
133
|
+
nodeAt(element: Node): GraphNode | null;
|
|
121
134
|
/**
|
|
122
135
|
* Selects a node, expanding its ancestors and scrolling it into view.
|
|
123
136
|
*
|