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
feat(viewport): transform selections around individual origins
yhh9d9ccee9db35
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 6157d4461..6e99430aa 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -717,6 +717,17 @@ jobs:path: output/gizmo-hover-ci/retention-days: 3+ - name: Check Individual Origins gestures and transaction recovery+ if: matrix.shard == 1+ run: node tools/verify-gizmo-origins.mjs+ - name: Upload Individual Origins acceptance evidence+ if: always() && matrix.shard == 1+ uses: actions/upload-artifact@v7+ with:+ name: gizmo-origins-editor-checks+ path: output/gizmo-origins-ci/+ retention-days: 3+# Between the two heavy steps, so the disk each one costs is attributable.# The report at the bottom cannot do that, and it is the report that dies# with the runner: a full disk takes the log that would name what filled it,diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8713a8d16..d377375f8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -24,6 +24,8 @@ published separately; it ships inside the editor.### Added+- **Multi-selection transforms support Individual Origins.** The viewport pivot control cycles Center, active-object Pivot and Individual Origins, with direct View menu and Command Palette choices. Individual rotation and scale keep each transform target's position, while translation, hierarchy pruning, locks, snapping and the existing undo/Alt-copy path remain shared. Each gesture captures its pivot policy.+- **Transform handle size is configurable.** Editor settings scale move/scale handles, rotation rings and hit areas together from 0.5 to 2, with the legacy size as default. The preference persists across sessions; active handle drags keep their captured size and sensitivity until release or cancellation.## [0.85.0] - 2026-10-15diff --git a/desktop b/desktopindex 6e4ffe629..da6cf0e06 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 6e4ffe6295dbeffbfd6d76b132ace682bd478c92+Subproject commit da6cf0e06afd8f4954ff7a34ecbb405f78d33d15diff --git a/docs/astro/src/content/docs/editor/viewport.mdx b/docs/astro/src/content/docs/editor/viewport.mdxindex 2f4582e4c..dd5e11de7 100644--- a/docs/astro/src/content/docs/editor/viewport.mdx+++ b/docs/astro/src/content/docs/editor/viewport.mdx@@ -42,10 +42,18 @@ arrows, center plane, rotation rings and hit areas together from 0.5 to 2 (defau1). The preference persists across editor sessions. Changing it during a handledrag takes effect after release; the current drag retains its size and sensitivity.-Dragging a handle transforms the whole selection as one, about a shared pivot, and-each drag is a single undo step. **Alt-drag** a selection to duplicate it and drag the-copies. Nudge the selection with the **arrow keys** (one grid step; hold **Shift** for-×10).+The viewport pivot button cycles **Center → Pivot → Individual Origins**. Center+uses the selection's centroid; Pivot uses the active object's position. Individual+Origins draws one handle at the selection center, but rotation and scale keep each+target's position and change its own pose. Translation is the same in all modes.+Choose a mode directly from the **View** menu or the Command Palette. If a parent+and child are both selected, the parent still carries its subtree to avoid applying+the gesture twice. Locked targets stay excluded. The pivot policy is captured at+the start of a drag, so changing it during that drag applies to the next gesture.++Each drag is a single undo step; **Esc** cancels it. **Alt-drag** a selection to+duplicate it and drag the copies. Nudge the selection with the **arrow keys** (one+grid step; hold **Shift** for ×10).**Align & distribute** — select two or more entities and a strip of alignment buttonsappears in the viewport overlay: align **left / centre / right** edges and **top / middle /diff --git a/docs/astro/src/content/docs/zh-cn/editor/viewport.mdx b/docs/astro/src/content/docs/zh-cn/editor/viewport.mdxindex 95712a20d..78023dc7c 100644--- a/docs/astro/src/content/docs/zh-cn/editor/viewport.mdx+++ b/docs/astro/src/content/docs/zh-cn/editor/viewport.mdx@@ -37,8 +37,15 @@ description: "视口导航、变换 gizmo、对齐与分布、显示开关、Sce旋转环和命中范围,范围为 0.5–2,默认 1,并在重启编辑器后保留。拖动手柄期间修改尺寸会在松开后生效;当前拖拽保持原有尺寸与操作灵敏度。-拖动手柄会把整个选择当作一体、绕共享轴心变换,每次拖动是一步撤销。**Alt 拖动**选择可复制它并-拖动副本。用**方向键**微移选择(一格;按 **Shift** 为 ×10)。+视口轴心按钮依次切换**中心 → 轴心 → 各自原点**。中心使用所选内容的平均位置,+轴心使用活动对象的位置。各自原点仍在选择中心显示一个手柄,但旋转与缩放时+保持每个变换对象的位置,只改变其自身姿态;平移行为在三种模式下相同。+也可从**视图**菜单或命令面板直接选择模式。父子同时选中时,仍由父对象带动+子树,避免重复变换;锁定对象仍被排除。每次拖拽开始时固定轴心策略,+拖拽中修改模式会在下次操作生效。++每次拖动是一步撤销,按 **Esc** 取消。**Alt 拖动**选择可复制并拖动副本。+用**方向键**微移选择(一格;按 **Shift** 为 ×10)。**对齐与分布**——选中两个或更多实体,视口浮层里会出现一排对齐按钮:对齐**左 / 中 / 右**边和**上 / 中 / 下**边。选中三个或更多时,另有两个**分布**按钮可把水平或垂直间距均分。每个都是一步diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 315d7d2a4..86e604b47 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -32,6 +32,8 @@ export const NOTED = {{ note: 'Plain-text wrapping avoids repeated whole-line glyph measurements.' },'perf(text): trim overflowing plain text with prefix advances':{ note: 'Long plain-text overflow trims with linear glyph measurement work.' },+ 'feat(viewport): transform selections around individual origins':+ { note: 'Multi-selection transforms support Individual Origins.' },'perf(text): bound page-free glyph caches':{ note: 'Page-free text glyph caches stay bounded.' },'feat(viewport): configure transform handle size':diff --git a/tools/verify-gizmo-origins.mjs b/tools/verify-gizmo-origins.mjsnew file mode 100644index 000000000..6df4a3582--- /dev/null+++ b/tools/verify-gizmo-origins.mjs@@ -0,0 +1,93 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+import fs from 'node:fs';+import path from 'node:path';+import assert from 'node:assert/strict';+import { fileURLToPath } from 'node:url';+import { runElectron } from './lib/electronRun.mjs';+if (!process.env.CI) throw Error('Editor acceptance runs only in CI. Do not launch the local editor.');+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const out = path.join(root, 'output/gizmo-origins-ci');+fs.mkdirSync(out, { recursive: true });+const project = fs.mkdtempSync(path.join(out, 'project-'));+fs.mkdirSync(path.join(project, 'assets/scenes'), { recursive: true });+fs.mkdirSync(path.join(project, 'src'));+fs.writeFileSync(path.join(project, 'project.esproject'), JSON.stringify({+ formatVersion: '1', name: 'Individual origins acceptance', defaultScene: 'assets/scenes/main.esscene', spineVersion: 'none',+}));+fs.writeFileSync(path.join(project, 'assets/scenes/main.esscene'), JSON.stringify({+ version: '1.0', name: 'Main', entities: [1, 2].map(id => ({+ id, name: 'Sprite ' + id, parent: null, children: [], visible: true, components: [+ { type: 'Transform', data: { position: { x: id === 1 ? -100 : 100, y: 0, z: 0 } } },+ { type: 'Sprite', data: { size: { x: 60, y: 60 }, color: { r: 1, g: 0, b: 1, a: 1 } } },+ ],+ })),+}));+fs.writeFileSync(path.join(project, 'src/main.ts'), 'export {};');+fs.writeFileSync(path.join(project, 'src/components.ts'), 'export {};');+// Capture the actual gesture, then check that one undo restores all its targets.+// PNGs show the restored scene after undo or Escape, rather than the changed pose.+const read = `(() => {+ const e=window.__estellaEditor;+ const snapshot=()=>e.surface.serializeScene().entities.map(entity=>{+ const t=entity.components.find(c=>c.type==='Transform').data;+ return {id:entity.id,position:t.position??{x:0,y:0,z:0},rotation:t.rotation??{x:0,y:0,z:0,w:1},scale:t.scale??{x:1,y:1,z:1}};+ });+ const scene=snapshot();+ if(!window.__originsRead){window.__originsRead=true;return {scene};}+ e.surface.undo();return {scene,undone:snapshot()};+})()`;+const near = (a, b) => assert(Math.abs(a - b) < 1e-4, `${a} differs from ${b}`);+const records = [];+try {+ const cases = [+ ...['center', 'individual'].flatMap(pivot => [+ { pivot, mode: 'rotate', ox: 42, dx: -42, dy: -42 },+ { pivot, mode: 'scale', ox: 58, dx: 58, dy: 0 },+ { pivot, mode: 'move', ox: 50, dx: 25, dy: 0 },+ ]),+ { pivot: 'individual', mode: 'scale', ox: 58, dx: 58, dy: 0, cancel: true },+ { pivot: 'individual', mode: 'rotate', ox: 42, dx: -42, dy: -42, alt: true },+ ];+ for (const c of cases) {+ const name = `${c.pivot}-${c.mode}${c.cancel ? '-escape' : c.alt ? '-duplicate' : ''}`;+ const run = runElectron(['.'], { via: 'npx', encoding: 'utf8', cwd: path.join(root, 'desktop'), timeout: 180000, env: {+ ESTELLA_SHOT: path.join(out, name + '.png'), ESTELLA_SHOT_PROJECT: project,+ ESTELLA_SHOT_SCENE: 'assets/scenes/main.esscene',+ ESTELLA_SHOT_EVAL: `(async()=>{const e=window.__estellaEditor;e.runCommand('mode.scene');e.runCommand('view.resetOrbit');e.runCommand('view.pivot${c.pivot === 'individual' ? 'Individual' : 'Center'}');e.surface.selectMany([1,2],1);e.frame([1,2]);await new Promise(r=>setTimeout(r,750));e.runCommand('tool.${c.mode}');return true;})()`,+ ESTELLA_SHOT_EDITOR_DRAG: JSON.stringify({ selector: '.viewport__stage canvas', ...c, read }),+ } });+ assert.equal(run.status, 0, run.stderr);+ const line = run.stdout.split('\n').find(line => line.startsWith('[editorDrag] '));+ assert(line, 'No trusted drag observation');+ const result = JSON.parse(line.slice('[editorDrag] '.length));+ const before = result.before.scene, after = result.after.scene;+ assert.deepEqual(result.after.undone, before, 'A single undo did not restore all targets');+ if (c.cancel) assert.deepEqual(after, before, 'Escape failed to restore the transaction');+ else {+ assert.notDeepEqual(after, before, 'Gesture did not change the scene');+ if (c.alt) {+ assert.equal(after.length, 4, 'Alt did not duplicate the selection');+ for (const initial of before) assert.deepEqual(after.find(t=>t.id===initial.id), initial, 'Alt modified an original');+ }+ for (const t of c.alt ? after.filter(t => !before.some(b => b.id === t.id)) : after) {+ const initial = c.alt ? before.find(b => b.position.x === t.position.x) : before.find(b => b.id === t.id);+ assert(initial, 'Missing starting target');+ if (c.mode === 'move') assert.notDeepEqual(t.position, initial.position);+ else if (c.pivot === 'individual') assert.deepEqual(t.position, initial.position, 'Individual origin moved');+ else assert.notDeepEqual(t.position, initial.position, 'Shared center did not move target');+ if (c.mode === 'rotate') assert.notDeepEqual(t.rotation, initial.rotation);+ if (c.mode === 'scale') { near(t.scale.x, 2); near(t.scale.y, 1); near(t.scale.z, 1); }+ }+ }+ assert(fs.existsSync(path.join(out, name + '.png')), 'Missing restored-scene PNG');+ records.push({ name, ...result });+ }+ assert.deepEqual(records.find(r=>r.name==='individual-move').after.scene,+ records.find(r=>r.name==='center-move').after.scene, 'Translation changed with the pivot policy');+ fs.writeFileSync(path.join(out, 'checks.json'), JSON.stringify({ status: 'checks-passed', records }, null, 2));+ console.log('Individual Origins CI: rotate/scale/move, one-step undo, Escape and Alt duplication pass');+} finally {+ if (!project.startsWith(out + path.sep)) throw Error('Unexpected cleanup directory');+ fs.rmSync(project, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });+}