next2d-development-mcp 1.2.0 → 1.3.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.
|
@@ -241,6 +241,7 @@ DisplayObjectは、Next2D Playerにおける全ての表示オブジェクトの
|
|
|
241
241
|
| `mouseX` | number | 対象のDisplayObjectの基準点からのマウスのX座標(ピクセル) |
|
|
242
242
|
| `mouseY` | number | 対象のDisplayObjectの基準点からのマウスのY座標(ピクセル) |
|
|
243
243
|
| `root` | MovieClip \| Sprite \| null | DisplayObjectのルートであるDisplayObjectContainer |
|
|
244
|
+
| `namespace` | string | クラスの空間名(例: `"next2d.display.Sprite"`)を返却。クラス判定に使用する(詳細は[クラス判定](#クラス判定namespace)を参照) |
|
|
244
245
|
|
|
245
246
|
### 読み書きプロパティ
|
|
246
247
|
|
|
@@ -480,6 +481,45 @@ sprite.cacheAsBitmap = null;
|
|
|
480
481
|
- `stage.rendererScale`が変更されるとキャッシュが自動的に無効化されます
|
|
481
482
|
- `filter`と`cacheAsBitmap`を同時に設定した場合、`cacheAsBitmap`が優先されます
|
|
482
483
|
|
|
484
|
+
## クラス判定(namespace)
|
|
485
|
+
|
|
486
|
+
クラスの種類を判定する際に `constructor.name` を使用してはいけません。プロダクションビルドでは minify によってクラス名が短縮・変更されるため、開発環境では動作してもビルド後に判定が壊れます。
|
|
487
|
+
|
|
488
|
+
代わりに `namespace` プロパティを使用します。`namespace` はハードコードされた文字列(例: `"next2d.display.Stage"`)を返すため、minify の影響を受けません。インスタンスの getter と static getter の両方が用意されています。
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
const { Stage, Sprite } = next2d.display;
|
|
492
|
+
|
|
493
|
+
// ❌ NG: minify でクラス名が変わるため、ビルド後に判定が壊れる
|
|
494
|
+
if (displayObject.constructor.name === "Stage") { /* ... */ }
|
|
495
|
+
|
|
496
|
+
// ✅ OK: インスタンスの namespace で判定
|
|
497
|
+
if (displayObject.namespace === "next2d.display.Stage") { /* ... */ }
|
|
498
|
+
|
|
499
|
+
// ✅ OK: static の namespace と比較するとタイポも防げる
|
|
500
|
+
if (displayObject.namespace === Stage.namespace) { /* ... */ }
|
|
501
|
+
|
|
502
|
+
// ✅ OK: Sprite かどうかの判定
|
|
503
|
+
if (displayObject.namespace === Sprite.namespace) { /* ... */ }
|
|
504
|
+
|
|
505
|
+
// ✅ OK: Stage 判定は isStage フラグも使用可能(Stage のみが持つ readonly プロパティ)
|
|
506
|
+
if (displayObject.isStage) { /* ... */ }
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
**namespace を持つ主なクラス:**
|
|
510
|
+
|
|
511
|
+
| クラス | namespace の値 |
|
|
512
|
+
|--------|----------------|
|
|
513
|
+
| `Stage` | `"next2d.display.Stage"` |
|
|
514
|
+
| `Sprite` | `"next2d.display.Sprite"` |
|
|
515
|
+
| `MovieClip` | `"next2d.display.MovieClip"` |
|
|
516
|
+
| `Shape` | `"next2d.display.Shape"` |
|
|
517
|
+
| `Loader` | `"next2d.display.Loader"` |
|
|
518
|
+
| `TextField` | `"next2d.display.TextField"` |
|
|
519
|
+
| `Video` | `"next2d.media.Video"` |
|
|
520
|
+
|
|
521
|
+
**補足:** 継承を含めた機能判定(「Sprite の機能を持っているか」など)には `isStage` / `isSprite` / `isShape` / `isText` / `isVideo` / `isContainerEnabled` / `isTimelineEnabled` の各フラグを使用します。`namespace` は完全一致のクラス判定に使用します。
|
|
522
|
+
|
|
483
523
|
## 関連項目
|
|
484
524
|
|
|
485
525
|
- [MovieClip](/ja/reference/player/movie-clip)
|
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.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "MCP server for Next2D application development assistance",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Toshiyuki Ienaga <ienaga@next2d.app>",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@eslint/js": "^10.0.1",
|
|
55
|
-
"@types/node": "^25.9.
|
|
56
|
-
"@types/vscode": "^1.
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
58
|
-
"@typescript-eslint/parser": "^8.
|
|
59
|
-
"@vscode/vsce": "^3.9.
|
|
55
|
+
"@types/node": "^25.9.3",
|
|
56
|
+
"@types/vscode": "^1.115.0",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.61.0",
|
|
58
|
+
"@typescript-eslint/parser": "^8.61.0",
|
|
59
|
+
"@vscode/vsce": "^3.9.2",
|
|
60
60
|
"eslint": "^10.4.1",
|
|
61
61
|
"eslint-plugin-unused-imports": "^4.4.1",
|
|
62
62
|
"globals": "^17.6.0",
|