A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): vector fields show mixed per-axis, not whole-field
yhh380077551d42
diff --git a/desktop/src/engine/SceneQuery.ts b/desktop/src/engine/SceneQuery.tsindex f65a89575..f9f1df5d8 100644--- a/desktop/src/engine/SceneQuery.ts+++ b/desktop/src/engine/SceneQuery.ts@@ -125,8 +125,24 @@ export function buildMultiInspector(? { ...enableBase, mixed: !datas.every((d) => (componentEnable(name, d)?.value ?? enableBase.value) === enableBase.value) }: undefined;const fields = inspectorFields(name, datas[0], baseOf?.(name)).filter((f) => f.key !== enable?.key);+ // A vector axis reads from either the raw {x,y,z,w} object or an array form.+ const VKEYS = ['x', 'y', 'z', 'w'] as const;+ const axisOf = (raw: unknown, i: number): unknown =>+ Array.isArray(raw) ? raw[i] : raw && typeof raw === 'object' ? (raw as Record<string, unknown>)[VKEYS[i]] : undefined;for (const f of fields) {- if (!datas.every((d) => deepEqual(d[f.key], datas[0][f.key]))) f.mixed = true;+ if (Array.isArray(f.value)) {+ // Per-axis mixed for vectors: flag only the axes that actually disagree so+ // shared axes still read their value (multi-select Transform shows X when+ // only Y differs, instead of blanking all three). The raw component data+ // stores vectors as {x,y,z} objects, so compare axis-wise, not deepEqual.+ const axes = f.value.map((_, i) => {+ const p = axisOf(datas[0][f.key], i);+ return !datas.every((d) => deepEqual(axisOf(d[f.key], i), p));+ });+ if (axes.some(Boolean)) { f.mixed = true; f.mixedAxes = axes; }+ } else if (!datas.every((d) => deepEqual(d[f.key], datas[0][f.key]))) {+ f.mixed = true;+ }}out.push({ name, label, fields, enable, notice: componentNotice(name, primary) ?? undefined });}diff --git a/desktop/src/panels/Details.tsx b/desktop/src/panels/Details.tsxindex 97cb715de..69d07a978 100644--- a/desktop/src/panels/Details.tsx+++ b/desktop/src/panels/Details.tsx@@ -214,11 +214,12 @@ function VecField({export function VecControl({value,mixed,+ mixedAxes,onBegin,onEnd,onCancel,onChange,-}: ControlGesture & { value: number[]; mixed?: boolean; onChange: (v: number[]) => void }) {+}: ControlGesture & { value: number[]; mixed?: boolean; mixedAxes?: boolean[]; onChange: (v: number[]) => void }) {return (<div className="vec">{value.map((n, i) => (@@ -226,7 +227,9 @@ export function VecControl({key={i}axis={AXES[i]}value={n}- mixed={mixed}+ // Per-axis mixed when the merge computed it (only the disagreeing axes+ // read `—`); else fall back to the whole-field flag.+ mixed={mixedAxes ? mixedAxes[i] : mixed}onBegin={onBegin}onEnd={onEnd}onCancel={onCancel}@@ -1268,7 +1271,7 @@ function FieldRow({ entities, comp, field, write }: { entities: EntityId[]; compcase 'vec2':case 'vec3':case 'vec4':- control = <VecControl value={field.value as number[]} mixed={mixed} onBegin={begin} onEnd={end} onCancel={cancel} onChange={apply} />;+ control = <VecControl value={field.value as number[]} mixed={mixed} mixedAxes={field.mixedAxes} onBegin={begin} onEnd={end} onCancel={cancel} onChange={apply} />;break;case 'dimension':control = <DimControl value={field.value as DimensionValue} mixed={mixed} onBegin={begin} onEnd={end} onChange={apply} />;diff --git a/desktop/src/types.ts b/desktop/src/types.tsindex 0424a36c1..3ab47ecf1 100644--- a/desktop/src/types.ts+++ b/desktop/src/types.ts@@ -130,6 +130,12 @@ export interface InspectorField {* holds the primary entity's value (shown muted); an edit fans out to all.*/mixed?: boolean;+ /**+ * Multi-selection, vector fields only: which axes actually disagree. Lets the+ * inspector show `—` on just the differing axis (Y) while a shared axis (X)+ * still shows its value, instead of masking the whole vector.+ */+ mixedAxes?: boolean[];}export interface InspectorComponent {