@mertdogar/phaser-procedural-walls 0.3.0 → 0.4.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.
- package/README.md +17 -4
- package/dist/WallEditor.d.ts +54 -0
- package/dist/editor/assets/{index-DvPiYA-G.js → index-BEDA_QpG.js} +1298 -1298
- package/dist/editor/index.html +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +236 -38
- package/package.json +11 -12
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ A Phaser 4 scene plugin that draws top-down floorplan walls from a few lines of
|
|
|
12
12
|
- One depth-sorted Container per wall; use `sprite.setDepth(sprite.y)` with automatic wall depths
|
|
13
13
|
- Optional Arcade static bodies matching each wall's bottom footprint
|
|
14
14
|
- Pure geometry module with unit tests, no Phaser needed to test it
|
|
15
|
+
- Embeddable `WallEditor` for drawing, selection, endpoint handles, and window dragging in an existing Phaser scene
|
|
15
16
|
- Wallcraft editor prototype: draw walls, drag endpoints and windows, edit height and drawing order, and manage presets
|
|
16
17
|
- Resizable layers and inspector panels with wall selection, duplication, deletion, and reordering
|
|
17
18
|
- Full-pane canvas with origin axes, two-finger scrolling to pan, and pinching to zoom
|
|
@@ -128,10 +129,22 @@ scene with player collisions.” The skill is distributed in Git, not in the npm
|
|
|
128
129
|
package. Its bundled references track the repository, including changes made
|
|
129
130
|
after the original 0.2.0 release.
|
|
130
131
|
|
|
132
|
+
## 0.4.0 release notes
|
|
133
|
+
|
|
134
|
+
Version 0.4.0 exports `WallEditor`, extracted from Wallcraft's canvas interactions.
|
|
135
|
+
Attach it to your existing Phaser scene to draw snapped walls, select walls,
|
|
136
|
+
drag endpoints, and move windows. Your application owns data, UI, rendering,
|
|
137
|
+
camera navigation, and accepting or refusing edits.
|
|
138
|
+
|
|
139
|
+
The standalone editor now uses this component. Open `/?embedded` in the demo
|
|
140
|
+
or packaged editor for a small Phaser-only example with property controls.
|
|
141
|
+
See the [embedding guide](docs/wallcraft.md#embed-the-wall-editor-in-your-game)
|
|
142
|
+
and [API reference](docs/api.md#walleditor). Existing renderer and geometry APIs
|
|
143
|
+
are unchanged.
|
|
144
|
+
|
|
131
145
|
## 0.3.0 release notes
|
|
132
146
|
|
|
133
|
-
Version 0.3.0
|
|
134
|
-
update. It adds large-map navigation, resizable layers and inspector panels,
|
|
147
|
+
Version 0.3.0 adds large-map navigation, resizable layers and inspector panels,
|
|
135
148
|
bulk height and thickness settings, window-width controls, and a Help dialog.
|
|
136
149
|
Select and Draw now live in the top bar. Preview handles player occlusion with
|
|
137
150
|
custom wall drawing orders. Documentation, screenshots, and the repository's
|
|
@@ -151,7 +164,7 @@ Review existing maps before upgrading your game:
|
|
|
151
164
|
absolute drawing orders. Consumer games still need character sorting that
|
|
152
165
|
accounts for these values; `setDepth(player.y)` assumes automatic wall depths.
|
|
153
166
|
|
|
154
|
-
|
|
167
|
+
Launch this specific version with
|
|
155
168
|
`npx @mertdogar/phaser-procedural-walls@0.3.0 editor` or
|
|
156
169
|
`pnpx @mertdogar/phaser-procedural-walls@0.3.0 editor`.
|
|
157
170
|
|
|
@@ -160,7 +173,7 @@ After publication, launch this specific version with
|
|
|
160
173
|
```bash
|
|
161
174
|
pnpm install
|
|
162
175
|
pnpm dev # wall editor prototype: draw walls and import/export WallMapConfig JSON
|
|
163
|
-
pnpm test # geometry
|
|
176
|
+
pnpm test # geometry and editor interaction tests
|
|
164
177
|
pnpm typecheck
|
|
165
178
|
pnpm lint
|
|
166
179
|
pnpm build # library in dist/ and bundled app in dist/editor/
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Phaser from "phaser";
|
|
2
|
+
import type { WallMapConfig, WallSpec } from "./types";
|
|
3
|
+
export type WallEditorTool = "select" | "wall";
|
|
4
|
+
export interface WallEditorCallbacks {
|
|
5
|
+
onAddWall: (wall: WallSpec) => void;
|
|
6
|
+
onSelectWall: (index: number | null) => void;
|
|
7
|
+
onUpdateWall: (index: number, patch: Partial<WallSpec>) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface WallEditorState {
|
|
10
|
+
config: WallMapConfig;
|
|
11
|
+
selectedIndex: number | null;
|
|
12
|
+
tool: WallEditorTool;
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface WallEditorOptions extends WallEditorState, WallEditorCallbacks {
|
|
16
|
+
camera?: Phaser.Cameras.Scene2D.Camera;
|
|
17
|
+
gridSize?: number;
|
|
18
|
+
overlayDepth?: number;
|
|
19
|
+
newWall?: Partial<Pick<WallSpec, "thickness" | "height" | "preset">>;
|
|
20
|
+
}
|
|
21
|
+
export declare class WallEditor {
|
|
22
|
+
private readonly scene;
|
|
23
|
+
private configData;
|
|
24
|
+
private selectedIndex;
|
|
25
|
+
private tool;
|
|
26
|
+
private enabled;
|
|
27
|
+
private readonly camera;
|
|
28
|
+
private readonly gridSize;
|
|
29
|
+
private readonly overlay;
|
|
30
|
+
private readonly callbacks;
|
|
31
|
+
private newWall;
|
|
32
|
+
private drawStart;
|
|
33
|
+
private pointerPosition;
|
|
34
|
+
private anchorDrag;
|
|
35
|
+
private windowDrag;
|
|
36
|
+
constructor(scene: Phaser.Scene, options: WallEditorOptions);
|
|
37
|
+
setState(state: WallEditorState): void;
|
|
38
|
+
setNewWall(wall: Partial<Pick<WallSpec, "thickness" | "height" | "preset">>): void;
|
|
39
|
+
get dragging(): boolean;
|
|
40
|
+
cancel(): void;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
private handlePointerDown;
|
|
43
|
+
private handlePointerMove;
|
|
44
|
+
private handlePointerUp;
|
|
45
|
+
refresh(): void;
|
|
46
|
+
private findWall;
|
|
47
|
+
private findAnchor;
|
|
48
|
+
private findWindow;
|
|
49
|
+
private getWindowRects;
|
|
50
|
+
private moveWindow;
|
|
51
|
+
private moveEndpoint;
|
|
52
|
+
private snapPoint;
|
|
53
|
+
private axisLock;
|
|
54
|
+
}
|