next2d-development-mcp 1.1.8 → 1.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.
@@ -1286,6 +1286,94 @@ export class TopBtnMolecule extends ButtonAtom {
1286
1286
  }
1287
1287
  ```
1288
1288
 
1289
+ ### DisplayObject の中心点基準配置(scale・rotation アニメーション必須)
1290
+
1291
+ `scaleX` / `scaleY` / `rotation` を変更すると `width` / `height` の値が変わる。
1292
+ **addChild より前にスケール・回転を確定させないと、オフセット計算がずれる。**
1293
+
1294
+ 実装手順(順序厳守):
1295
+
1296
+ ```typescript
1297
+ // ステップ a: scaleX / scaleY / rotation を先に設定(width/height を確定させる)
1298
+ child.scaleX = 2;
1299
+ child.scaleY = 2;
1300
+ child.rotation = 45;
1301
+
1302
+ // ステップ b: 確定した width/height でオフセットを計算し、原点を中心に移動
1303
+ child.x = -child.width / 2;
1304
+ child.y = -child.height / 2;
1305
+
1306
+ // ステップ c: 親 Sprite に addChild(この時点で中心点基準の配置が完成)
1307
+ sprite.addChild(child);
1308
+ ```
1309
+
1310
+ #### Tween で中心点基準のスケールアニメーションを行う場合
1311
+
1312
+ ```typescript
1313
+ export class YourScaleAnimation
1314
+ {
1315
+ private readonly _job: Job;
1316
+
1317
+ constructor (sprite: Sprite, child: Sprite, callback?: () => void)
1318
+ {
1319
+ // ステップ a: 初期スケールを設定して width/height を確定
1320
+ child.scaleX = 0;
1321
+ child.scaleY = 0;
1322
+
1323
+ // ステップ b: 中心点オフセットを計算
1324
+ // scaleX=0 のとき width=0 になるため、最終サイズで計算する
1325
+ // → scaleX=1 にした上で取得し、その後に戻す
1326
+ child.scaleX = 1;
1327
+ child.scaleY = 1;
1328
+ child.x = -child.width / 2;
1329
+ child.y = -child.height / 2;
1330
+ child.scaleX = 0;
1331
+ child.scaleY = 0;
1332
+
1333
+ // ステップ c: addChild してから Tween を設定
1334
+ sprite.addChild(child);
1335
+
1336
+ this._job = Tween.add(child,
1337
+ { "scaleX": 0, "scaleY": 0 },
1338
+ { "scaleX": 1, "scaleY": 1 },
1339
+ 0.3, 0, Easing.outBack
1340
+ );
1341
+
1342
+ if (callback) {
1343
+ this._job.addEventListener(Event.COMPLETE, callback);
1344
+ }
1345
+ }
1346
+
1347
+ start (): void
1348
+ {
1349
+ this._job.start();
1350
+ }
1351
+ }
1352
+ ```
1353
+
1354
+ #### Anti-Patterns
1355
+
1356
+ ```typescript
1357
+ // NG: addChild 後にスケールを変更 → width/height が変わりオフセットがずれる
1358
+ sprite.addChild(child);
1359
+ child.scaleX = 2;
1360
+ child.scaleY = 2;
1361
+ child.x = -child.width / 2; // この時点の width は scaleX=2 適用後なので正しいが、
1362
+ // addChild 済みなので描画順が保証されない
1363
+
1364
+ // NG: スケール設定前にオフセットを計算 → width/height がデフォルト値のまま
1365
+ child.x = -child.width / 2; // scaleX 未設定の width で計算してしまう
1366
+ child.scaleX = 2;
1367
+ sprite.addChild(child);
1368
+
1369
+ // OK: a → b → c の順序を守る
1370
+ child.scaleX = 2; // a: スケール確定
1371
+ child.scaleY = 2;
1372
+ child.x = -child.width / 2; // b: オフセット計算
1373
+ child.y = -child.height / 2;
1374
+ sprite.addChild(child); // c: addChild
1375
+ ```
1376
+
1289
1377
  ---
1290
1378
 
1291
1379
  ## Content (Animation Tool)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "next2d-development-mcp",
3
3
  "displayName": "Next2D Development MCP",
4
- "version": "1.1.8",
4
+ "version": "1.2.0",
5
5
  "description": "MCP server for Next2D application development assistance",
6
6
  "type": "module",
7
7
  "author": "Toshiyuki Ienaga <ienaga@next2d.app>",
@@ -54,14 +54,14 @@
54
54
  "@eslint/js": "^10.0.1",
55
55
  "@types/node": "^25.9.1",
56
56
  "@types/vscode": "^1.120.0",
57
- "@typescript-eslint/eslint-plugin": "^8.60.0",
58
- "@typescript-eslint/parser": "^8.60.0",
57
+ "@typescript-eslint/eslint-plugin": "^8.60.1",
58
+ "@typescript-eslint/parser": "^8.60.1",
59
59
  "@vscode/vsce": "^3.9.1",
60
- "eslint": "^10.4.0",
60
+ "eslint": "^10.4.1",
61
61
  "eslint-plugin-unused-imports": "^4.4.1",
62
62
  "globals": "^17.6.0",
63
63
  "typescript": "^6.0.3",
64
- "vitest": "^4.1.7"
64
+ "vitest": "^4.1.8"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=22.0.0",