@combos-fun/plugin-renderer-nine-patch 0.0.45 → 0.0.47

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.
Files changed (2) hide show
  1. package/agent-skill.md +21 -37
  2. 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
- 9-patch (nine-slice) panels for the 2D pipeline. Stretches the centre of a texture while keeping corner sizes fixed — used for resizable buttons, panels, dialog frames.
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'`, `systemName = 'NinePatch'` (class is `NinePatchSystem` — use `game.getSystem(NinePatchSystem)`, not the string).
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
- | Symptom | Fix |
37
- |---------|-----|
38
- | Border distorted | Border widths must add up to texture size; otherwise corners overlap |
39
- | Panel collapses to corners | Set `Transform.size` to the desired stretched dimensions |
40
- | Wrong slice | Atlas (`SPRITE`) types need `spriteName` matching the atlas frame |
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
- ## Minimal example
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, topHeight: 16, rightWidth: 16, bottomHeight: 16,
27
+ leftWidth: 16,
28
+ topHeight: 16,
29
+ rightWidth: 16,
30
+ bottomHeight: 16,
49
31
  }));
50
32
  ```
51
33
 
52
- ## Verification
34
+ Output size follows `Transform.size`. Keep opposite borders within the source texture dimensions.
53
35
 
54
- `pnpm --filter @combos-fun/plugin-renderer-nine-patch run build`.
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.45",
3
+ "version": "0.0.47",
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-adapter": "0.0.45",
41
- "@combos-fun/engine": "0.0.45",
42
- "@combos-fun/plugin-renderer": "0.0.45",
43
- "@combos-fun/inspector-decorator": "0.0.45"
40
+ "@combos-fun/plugin-renderer": "0.0.47",
41
+ "@combos-fun/inspector-decorator": "0.0.47",
42
+ "@combos-fun/renderer-adapter": "0.0.47",
43
+ "@combos-fun/engine": "0.0.47"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "node ../../scripts/build-package.mjs"