@umicat/three-sdk 1.24.0 → 1.25.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.
|
@@ -535,6 +535,20 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
535
535
|
// is here because the thing most likely to break on a rebuild is not the
|
|
536
536
|
// geometry (visibly wrong) but the instance SWAP: a gizmo still pointing at
|
|
537
537
|
// the disposed mesh renders its handles and moves nothing.
|
|
538
|
+
// Test-only — which entities are selected, and where one is. Both exist for
|
|
539
|
+
// the ground-marquee regression: the claim there is "the ground did NOT
|
|
540
|
+
// move AND both Parts got selected", and neither half is observable from
|
|
541
|
+
// the host protocol alone (a drag that moves nothing posts nothing).
|
|
542
|
+
globalThis.__umicatSelectedIds =
|
|
543
|
+
() => [...multiSelected].map((o) => entityByObject.get(o)).filter((id) => !!id);
|
|
544
|
+
globalThis.__umicatEntityWorldPos =
|
|
545
|
+
(entityId) => {
|
|
546
|
+
const o = objectByEntity.get(entityId);
|
|
547
|
+
if (!o)
|
|
548
|
+
return null;
|
|
549
|
+
const p = o.getWorldPosition(new THREE.Vector3());
|
|
550
|
+
return { x: p.x, y: p.y, z: p.z };
|
|
551
|
+
};
|
|
538
552
|
globalThis.__umicatEntityMesh =
|
|
539
553
|
(entityId) => {
|
|
540
554
|
const o = objectByEntity.get(entityId);
|
|
@@ -1214,6 +1228,36 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
1214
1228
|
catch { /* enhancement only */ }
|
|
1215
1229
|
return;
|
|
1216
1230
|
}
|
|
1231
|
+
// Drag-to-move applies ONLY to something already selected. Dragging from
|
|
1232
|
+
// an UNSELECTED entity starts a marquee instead, and a click that never
|
|
1233
|
+
// moves still selects it on release.
|
|
1234
|
+
//
|
|
1235
|
+
// Why: a plain left-drag used to mean "move whatever is under the
|
|
1236
|
+
// cursor", which made box-select unreachable in the most ordinary scene
|
|
1237
|
+
// there is. A baseplate-style ground is a real entity covering the whole
|
|
1238
|
+
// viewport, so there was no empty pixel to start a marquee from — the
|
|
1239
|
+
// ⌘/Ctrl path below was added for exactly that, and then nobody could
|
|
1240
|
+
// find it, which this codebase has already learned is the same as not
|
|
1241
|
+
// having it.
|
|
1242
|
+
//
|
|
1243
|
+
// No professional editor binds "move the object" to a bare left-drag:
|
|
1244
|
+
// Unity's scene view always rubber-bands and reserves movement for the
|
|
1245
|
+
// gizmo handles, Unreal gives left-drag to the camera, Blender box-selects
|
|
1246
|
+
// by default. Requiring a selection first is the cheapest rule that gets
|
|
1247
|
+
// the same guarantee — a marquee can always be started — while keeping
|
|
1248
|
+
// click-then-drag, which casual users expect and Roblox has.
|
|
1249
|
+
if (!multiSelected.has(hit.entityRoot)) {
|
|
1250
|
+
pendingClickHit = hit;
|
|
1251
|
+
marqueeCandidate = true;
|
|
1252
|
+
marqueeAdditive = false;
|
|
1253
|
+
marqueeStartX = e.clientX;
|
|
1254
|
+
marqueeStartY = e.clientY;
|
|
1255
|
+
try {
|
|
1256
|
+
renderer.domElement.setPointerCapture(e.pointerId);
|
|
1257
|
+
}
|
|
1258
|
+
catch { /* enhancement only */ }
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1217
1261
|
marqueeCandidate = false;
|
|
1218
1262
|
pendingClickHit = null;
|
|
1219
1263
|
const objectPos = hit.entityRoot.getWorldPosition(new THREE.Vector3());
|
|
@@ -1460,6 +1504,14 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
1460
1504
|
if (hudSelectedId)
|
|
1461
1505
|
selectHudEntity(null);
|
|
1462
1506
|
}
|
|
1507
|
+
else if (!modifierHeldAtDown && pendingClickHit) {
|
|
1508
|
+
// A plain click on an unselected entity. It reaches here rather than
|
|
1509
|
+
// the drag path because selecting is now the precondition FOR
|
|
1510
|
+
// dragging — so the first click selects and the second gesture moves.
|
|
1511
|
+
applySelection([pendingClickHit.entityRoot], pendingClickHit.point);
|
|
1512
|
+
if (hudSelectedId)
|
|
1513
|
+
selectHudEntity(null);
|
|
1514
|
+
}
|
|
1463
1515
|
else if (!modifierHeldAtDown && scene) {
|
|
1464
1516
|
clearWorldSelection();
|
|
1465
1517
|
if (hudSelectedId)
|
|
@@ -1823,6 +1875,15 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
1823
1875
|
if (error)
|
|
1824
1876
|
console.warn('[umicat/editor] 3D model drop failed:', m.entityId, error);
|
|
1825
1877
|
window.parent.postMessage({ type: 'umicat:editor:modelDropped3d', entityId: m.entityId, ok: !error, error, position }, '*');
|
|
1878
|
+
// Select what was just placed. Every editor does this, and since
|
|
1879
|
+
// drag-to-move now REQUIRES a selection, a freshly dropped entity that
|
|
1880
|
+
// was not selected could not be nudged without clicking it first —
|
|
1881
|
+
// which is a strange thing to ask of someone who just put it there.
|
|
1882
|
+
if (!error) {
|
|
1883
|
+
const placed = objectByEntity.get(m.entityId);
|
|
1884
|
+
if (placed)
|
|
1885
|
+
applySelection([placed]);
|
|
1886
|
+
}
|
|
1826
1887
|
};
|
|
1827
1888
|
if (!scene)
|
|
1828
1889
|
return done('no scene loaded yet');
|
|
@@ -1874,6 +1935,15 @@ export async function runEditorDesignPlayer3D(renderer, opts = {}) {
|
|
|
1874
1935
|
if (error)
|
|
1875
1936
|
console.warn('[umicat/editor] 3D primitive drop failed:', m.entityId, error);
|
|
1876
1937
|
window.parent.postMessage({ type: 'umicat:editor:primitiveDropped3d', entityId: m.entityId, ok: !error, error, position, collider }, '*');
|
|
1938
|
+
// Select what was just placed. Every editor does this, and since
|
|
1939
|
+
// drag-to-move now REQUIRES a selection, a freshly dropped entity that
|
|
1940
|
+
// was not selected could not be nudged without clicking it first —
|
|
1941
|
+
// which is a strange thing to ask of someone who just put it there.
|
|
1942
|
+
if (!error) {
|
|
1943
|
+
const placed = objectByEntity.get(m.entityId);
|
|
1944
|
+
if (placed)
|
|
1945
|
+
applySelection([placed]);
|
|
1946
|
+
}
|
|
1877
1947
|
};
|
|
1878
1948
|
if (!scene)
|
|
1879
1949
|
return done('no scene loaded yet');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umicat/three-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Three.js runtime for Umicat games: the scene3d design format, its loader with physics, a kinematic character controller, and the Umicat platform via @umicat/platform-sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|