@combos-fun/plugin-development-tool 0.0.54 → 0.2.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/agent-skill.md +3 -3
- package/dist/plugin-development-tool.cjs.js +51 -14
- package/dist/plugin-development-tool.cjs.js.map +1 -1
- package/dist/plugin-development-tool.cjs.prod.js +1 -1
- package/dist/plugin-development-tool.esm.js +51 -14
- package/dist/plugin-development-tool.esm.js.map +1 -1
- package/package.json +3 -3
package/agent-skill.md
CHANGED
|
@@ -56,13 +56,13 @@ export default defineConfig({
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Do not add `CombosDevelopmentToolTarget` from game code. Opt out of a construct with `// combos-no-target
|
|
59
|
+
Do not add `CombosDevelopmentToolTarget` from game code. Opt out of a construct with `// combos-no-target`.
|
|
60
60
|
|
|
61
61
|
## Runtime behaviour
|
|
62
62
|
|
|
63
63
|
The System starts disabled. In pick mode it shows a full-canvas overlay (`pointer-events: auto`) so game `Event` / `Event3D` do not receive the tap, and it also listens on `window` capture so a DOM HUD above the canvas cannot swallow the tap. Targets are hit-tested from engine transforms projected to overlay CSS pixels. Overlapping hits prefer content: hollow / invisible / low-alpha nodes and rects covering ≥75% of the overlay lose to a smaller target underneath; two covering layers pick the earlier scene-walk item. Target additions/removals are observed automatically; `requestSceneRescan()` is for parent-driven structural refreshes.
|
|
64
64
|
|
|
65
|
-
2D bounds come from `
|
|
65
|
+
2D bounds come from `Transform2D` size plus `GameObject` hierarchy (position, origin, anchor, scale, rotation). Set `Transform2D.size` when the visual does not match a zero size. 3D bounds project `Transform3D` world position through the active `Renderer3DSystem` camera; a mesh bounding box is used when the Three object is available, otherwise a screen-space pad around the projected point.
|
|
66
66
|
|
|
67
67
|
The marker overlay is independent of pick mode and mute. It currently draws a 28×28 canvas badge only for `Sound`; the owner still needs a Target for selection and persistence (the Vite plugin attaches that Target).
|
|
68
68
|
|
|
@@ -90,7 +90,7 @@ Snapshots expose described schema-backed `fieldDescriptors`, not raw fields. For
|
|
|
90
90
|
|
|
91
91
|
## Common pitfalls
|
|
92
92
|
|
|
93
|
-
- 2D picking needs a positive `
|
|
93
|
+
- 2D picking needs a positive `Transform2D.size` to get a usable hit rect.
|
|
94
94
|
- 3D picking needs `Renderer3DSystem` (for the camera) at runtime; there is no package dependency.
|
|
95
95
|
- Pick ranking is not pixel-perfect: a fullscreen `Img` with `alpha: 1` still counts as drawable even if the PNG is mostly transparent.
|
|
96
96
|
- A covering overlay is still selected when it is the only hit under the pointer.
|
|
@@ -501,7 +501,7 @@ function leafDescriptorsFromValue(componentName, options, path, value) {
|
|
|
501
501
|
group: options.group ?? componentName,
|
|
502
502
|
editorKind: mapEditorKind(options, axisType),
|
|
503
503
|
numberMeta: buildNumberMeta(options),
|
|
504
|
-
persistTarget:
|
|
504
|
+
persistTarget: 'component',
|
|
505
505
|
});
|
|
506
506
|
}
|
|
507
507
|
return out;
|
|
@@ -524,7 +524,7 @@ function leafDescriptorsFromValue(componentName, options, path, value) {
|
|
|
524
524
|
editorKind: mapEditorKind(options, valueType),
|
|
525
525
|
enumOptions: options.enumOptions,
|
|
526
526
|
numberMeta: buildNumberMeta(options),
|
|
527
|
-
persistTarget:
|
|
527
|
+
persistTarget: 'component',
|
|
528
528
|
},
|
|
529
529
|
];
|
|
530
530
|
}
|
|
@@ -621,7 +621,10 @@ function syncPhysicsBodyFromTransform(go) {
|
|
|
621
621
|
if (!physics?.body) {
|
|
622
622
|
return;
|
|
623
623
|
}
|
|
624
|
-
const
|
|
624
|
+
const pose = go.getComponent('Transform2D');
|
|
625
|
+
if (!pose)
|
|
626
|
+
return;
|
|
627
|
+
const { x, y } = pose.position;
|
|
625
628
|
if (physics.Body?.setPosition) {
|
|
626
629
|
physics.Body.setPosition(physics.body, { x, y });
|
|
627
630
|
return;
|
|
@@ -634,11 +637,16 @@ function syncMoverOriginFromTransform(go) {
|
|
|
634
637
|
if (!mover) {
|
|
635
638
|
return;
|
|
636
639
|
}
|
|
637
|
-
|
|
638
|
-
|
|
640
|
+
const pose = go.getComponent('Transform2D');
|
|
641
|
+
if (!pose)
|
|
642
|
+
return;
|
|
643
|
+
mover.originX = pose.position.x;
|
|
644
|
+
mover.originY = pose.position.y;
|
|
639
645
|
}
|
|
640
646
|
function applyTransformProperty(go, _comp, path, value) {
|
|
641
|
-
const transform = go.
|
|
647
|
+
const transform = go.getComponent('Transform2D');
|
|
648
|
+
if (!transform)
|
|
649
|
+
return false;
|
|
642
650
|
const transformRecord = transform;
|
|
643
651
|
if (path.length === 1 && path[0] === 'rotation') {
|
|
644
652
|
const next = asNumber(value);
|
|
@@ -696,7 +704,7 @@ function applySoundProperty(_go, comp, path, value) {
|
|
|
696
704
|
return false;
|
|
697
705
|
}
|
|
698
706
|
const APPLY_HOOKS = {
|
|
699
|
-
|
|
707
|
+
Transform2D: applyTransformProperty,
|
|
700
708
|
Text: applyTextProperty,
|
|
701
709
|
Sound: applySoundProperty,
|
|
702
710
|
};
|
|
@@ -980,6 +988,32 @@ function projectTransform3D(transform, camera, css, object3D) {
|
|
|
980
988
|
const scale = Math.max(Math.abs(transform.scaleX ?? 1), Math.abs(transform.scaleY ?? 1), Math.abs(transform.scaleZ ?? 1), 1);
|
|
981
989
|
return padAround(projected, DEFAULT_POINT_EXTENT * scale);
|
|
982
990
|
}
|
|
991
|
+
function asTransform2DPose(value) {
|
|
992
|
+
if (!value || typeof value !== 'object')
|
|
993
|
+
return null;
|
|
994
|
+
const t = value;
|
|
995
|
+
if (!t.position || !t.size)
|
|
996
|
+
return null;
|
|
997
|
+
return {
|
|
998
|
+
position: t.position,
|
|
999
|
+
size: t.size,
|
|
1000
|
+
origin: t.origin ?? { x: 0, y: 0 },
|
|
1001
|
+
anchor: t.anchor ?? { x: 0, y: 0 },
|
|
1002
|
+
scale: t.scale ?? { x: 1, y: 1 },
|
|
1003
|
+
skew: t.skew ?? { x: 0, y: 0 },
|
|
1004
|
+
rotation: t.rotation ?? 0,
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function pose2DFromGameObject(go) {
|
|
1008
|
+
const pose = asTransform2DPose(go.getComponent('Transform2D'));
|
|
1009
|
+
if (!pose)
|
|
1010
|
+
return null;
|
|
1011
|
+
const parentGo = go.parent && go.parent !== go.scene ? go.parent : null;
|
|
1012
|
+
return {
|
|
1013
|
+
...pose,
|
|
1014
|
+
parent: parentGo ? pose2DFromGameObject(parentGo) : null,
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
983
1017
|
function projectGameObjectToScreen(go, opts) {
|
|
984
1018
|
if (opts.css.width <= 0 || opts.css.height <= 0) {
|
|
985
1019
|
return null;
|
|
@@ -988,7 +1022,10 @@ function projectGameObjectToScreen(go, opts) {
|
|
|
988
1022
|
if (t3d && opts.camera) {
|
|
989
1023
|
return projectTransform3D(t3d, opts.camera, opts.css, opts.object3D);
|
|
990
1024
|
}
|
|
991
|
-
|
|
1025
|
+
const t2d = pose2DFromGameObject(go);
|
|
1026
|
+
if (!t2d)
|
|
1027
|
+
return null;
|
|
1028
|
+
return projectTransform2D(t2d, opts.css, opts.design ?? null);
|
|
992
1029
|
}
|
|
993
1030
|
function rectContains(rect, x, y) {
|
|
994
1031
|
return x >= rect.x && y >= rect.y && x <= rect.x + rect.width && y <= rect.y + rect.height;
|
|
@@ -1399,17 +1436,17 @@ let CombosDevelopmentToolSystem$1 = class CombosDevelopmentToolSystem extends en
|
|
|
1399
1436
|
}
|
|
1400
1437
|
collectGameObjects(go, out) {
|
|
1401
1438
|
out.push(go);
|
|
1402
|
-
for (const
|
|
1403
|
-
this.collectGameObjects(
|
|
1439
|
+
for (const child of go.children) {
|
|
1440
|
+
this.collectGameObjects(child, out);
|
|
1404
1441
|
}
|
|
1405
1442
|
}
|
|
1406
1443
|
listSceneObjects() {
|
|
1407
1444
|
const list = [];
|
|
1408
1445
|
const scene = this.game.scene;
|
|
1409
|
-
if (!scene?.
|
|
1446
|
+
if (!scene?.children)
|
|
1410
1447
|
return list;
|
|
1411
|
-
for (const
|
|
1412
|
-
this.collectGameObjects(
|
|
1448
|
+
for (const child of scene.children) {
|
|
1449
|
+
this.collectGameObjects(child, list);
|
|
1413
1450
|
}
|
|
1414
1451
|
return list;
|
|
1415
1452
|
}
|
|
@@ -1696,7 +1733,7 @@ var CombosDevelopmentToolSystem = CombosDevelopmentToolSystem$1;
|
|
|
1696
1733
|
/** Auto-generated by scripts/build-package.mjs — do not edit. */
|
|
1697
1734
|
Object.assign(CombosDevelopmentToolSystem, {
|
|
1698
1735
|
packageName: "@combos-fun/plugin-development-tool",
|
|
1699
|
-
packageVersion: "0.0
|
|
1736
|
+
packageVersion: "0.2.0",
|
|
1700
1737
|
});
|
|
1701
1738
|
|
|
1702
1739
|
function isInternalEditorGo(go) {
|