@combos-fun/plugin-renderer-nine-patch 0.0.44 → 0.0.46
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.
- package/agent-skill.md +21 -37
- package/package.json +5 -5
package/agent-skill.md
CHANGED
|
@@ -1,54 +1,38 @@
|
|
|
1
1
|
# `@combos-fun/plugin-renderer-nine-patch` — Agent notes
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## When to read
|
|
6
|
-
|
|
7
|
-
Read for any stretchable UI panel: buttons, dialog backgrounds, tooltip frames, list backgrounds.
|
|
8
|
-
|
|
9
|
-
## Public API
|
|
3
|
+
Read only for a resizable panel whose corners and edge widths must stay fixed.
|
|
10
4
|
|
|
11
5
|
```ts
|
|
12
6
|
import { NinePatch, NinePatchSystem, type NinePatchParams } from '@combos-fun/plugin-renderer-nine-patch';
|
|
13
7
|
```
|
|
14
8
|
|
|
15
|
-
`componentName = 'NinePatch'
|
|
16
|
-
|
|
17
|
-
### `NinePatchParams`
|
|
18
|
-
|
|
19
|
-
| Field | Type | Notes |
|
|
20
|
-
|-------|------|-------|
|
|
21
|
-
| `resource` | `string` | Engine resource name. Supports `RESOURCE_TYPE.IMAGE` and `RESOURCE_TYPE.SPRITE` |
|
|
22
|
-
| `spriteName` | `string?` | Required when `resource` is a SPRITE atlas |
|
|
23
|
-
| `leftWidth` | `number` | Left fixed border (px) |
|
|
24
|
-
| `topHeight` | `number` | Top fixed border (px) |
|
|
25
|
-
| `rightWidth` | `number` | Right fixed border (px) |
|
|
26
|
-
| `bottomHeight` | `number` | Bottom fixed border (px) |
|
|
27
|
-
|
|
28
|
-
The actual stretched size comes from `Transform.size`. Set `size: { width: 300, height: 100 }` on the GameObject constructor (not `{ x, y }`).
|
|
29
|
-
|
|
30
|
-
## Required setup
|
|
31
|
-
|
|
32
|
-
`RendererSystem` then `NinePatchSystem`. Resource must be loaded before the component is added (use `preload: true`).
|
|
33
|
-
|
|
34
|
-
## Common pitfalls
|
|
9
|
+
`NinePatch.componentName = 'NinePatch'`; `NinePatchSystem.systemName = 'NinePatch'`.
|
|
35
10
|
|
|
36
|
-
|
|
|
37
|
-
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
11
|
+
| Field | Type | Use |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `resource` | `string` | IMAGE or SPRITE resource name |
|
|
14
|
+
| `spriteName` | `string?` | Atlas frame; required for SPRITE |
|
|
15
|
+
| `leftWidth` | `number?` | Left fixed border |
|
|
16
|
+
| `topHeight` | `number?` | Top fixed border |
|
|
17
|
+
| `rightWidth` | `number?` | Right fixed border |
|
|
18
|
+
| `bottomHeight` | `number?` | Bottom fixed border |
|
|
41
19
|
|
|
42
|
-
|
|
20
|
+
Pass all four border values, including zero. Although optional in TypeScript,
|
|
21
|
+
omitted borders in a supplied params object overwrite the initial `0` with
|
|
22
|
+
`undefined`.
|
|
43
23
|
|
|
44
24
|
```ts
|
|
45
|
-
const panel = new GameObject('panel', { position: { x: 100, y: 100 }, size: { width: 300, height: 120 } });
|
|
46
25
|
panel.addComponent(new NinePatch({
|
|
47
26
|
resource: 'panel-bg',
|
|
48
|
-
leftWidth: 16,
|
|
27
|
+
leftWidth: 16,
|
|
28
|
+
topHeight: 16,
|
|
29
|
+
rightWidth: 16,
|
|
30
|
+
bottomHeight: 16,
|
|
49
31
|
}));
|
|
50
32
|
```
|
|
51
33
|
|
|
52
|
-
|
|
34
|
+
Output size follows `Transform.size`. Keep opposite borders within the source texture dimensions.
|
|
53
35
|
|
|
54
|
-
|
|
36
|
+
For SPRITE resources, import `@combos-fun/plugin-renderer-sprite` and provide an
|
|
37
|
+
exact `spriteName`; atlas parsing registers the prefixed key in Pixi's Texture
|
|
38
|
+
cache.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@combos-fun/plugin-renderer-nine-patch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"description": "9-patch (nine-slice) panels",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-nine-patch.esm.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"author": "sun668 <q947692259@gmail.com>",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"pixi.js": "^8.18.1",
|
|
40
|
-
"@combos-fun/renderer
|
|
41
|
-
"@combos-fun/
|
|
42
|
-
"@combos-fun/engine": "0.0.
|
|
43
|
-
"@combos-fun/
|
|
40
|
+
"@combos-fun/plugin-renderer": "0.0.46",
|
|
41
|
+
"@combos-fun/renderer-adapter": "0.0.46",
|
|
42
|
+
"@combos-fun/engine": "0.0.46",
|
|
43
|
+
"@combos-fun/inspector-decorator": "0.0.46"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "node ../../scripts/build-package.mjs"
|