@mertdogar/phaser-procedural-walls 0.3.0 → 0.4.1
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 +23 -4
- package/dist/WallEditor.d.ts +58 -0
- package/dist/editor/assets/{index-DvPiYA-G.js → index-BIMJ5usj.js} +1298 -1298
- package/dist/editor/index.html +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +264 -35
- 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, whole-wall movement, 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,28 @@ 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.1 release notes
|
|
133
|
+
|
|
134
|
+
Drag a selected wall's green centerline to move the entire segment with a
|
|
135
|
+
grid-snapped preview. Endpoint resizing and window dragging remain available.
|
|
136
|
+
Hosts can cancel through `WallEditor.cancel()`; Wallcraft binds this to Escape.
|
|
137
|
+
|
|
138
|
+
## 0.4.0 release notes
|
|
139
|
+
|
|
140
|
+
Version 0.4.0 exports `WallEditor`, extracted from Wallcraft's canvas interactions.
|
|
141
|
+
Attach it to your existing Phaser scene to draw snapped walls, select walls,
|
|
142
|
+
drag endpoints, and move windows. Your application owns data, UI, rendering,
|
|
143
|
+
camera navigation, and accepting or refusing edits.
|
|
144
|
+
|
|
145
|
+
The standalone editor now uses this component. Open `/?embedded` in the demo
|
|
146
|
+
or packaged editor for a small Phaser-only example with property controls.
|
|
147
|
+
See the [embedding guide](docs/wallcraft.md#embed-the-wall-editor-in-your-game)
|
|
148
|
+
and [API reference](docs/api.md#walleditor). Existing renderer and geometry APIs
|
|
149
|
+
are unchanged.
|
|
150
|
+
|
|
131
151
|
## 0.3.0 release notes
|
|
132
152
|
|
|
133
|
-
Version 0.3.0
|
|
134
|
-
update. It adds large-map navigation, resizable layers and inspector panels,
|
|
153
|
+
Version 0.3.0 adds large-map navigation, resizable layers and inspector panels,
|
|
135
154
|
bulk height and thickness settings, window-width controls, and a Help dialog.
|
|
136
155
|
Select and Draw now live in the top bar. Preview handles player occlusion with
|
|
137
156
|
custom wall drawing orders. Documentation, screenshots, and the repository's
|
|
@@ -151,7 +170,7 @@ Review existing maps before upgrading your game:
|
|
|
151
170
|
absolute drawing orders. Consumer games still need character sorting that
|
|
152
171
|
accounts for these values; `setDepth(player.y)` assumes automatic wall depths.
|
|
153
172
|
|
|
154
|
-
|
|
173
|
+
Launch this specific version with
|
|
155
174
|
`npx @mertdogar/phaser-procedural-walls@0.3.0 editor` or
|
|
156
175
|
`pnpx @mertdogar/phaser-procedural-walls@0.3.0 editor`.
|
|
157
176
|
|
|
@@ -160,7 +179,7 @@ After publication, launch this specific version with
|
|
|
160
179
|
```bash
|
|
161
180
|
pnpm install
|
|
162
181
|
pnpm dev # wall editor prototype: draw walls and import/export WallMapConfig JSON
|
|
163
|
-
pnpm test # geometry
|
|
182
|
+
pnpm test # geometry and editor interaction tests
|
|
164
183
|
pnpm typecheck
|
|
165
184
|
pnpm lint
|
|
166
185
|
pnpm build # library in dist/ and bundled app in dist/editor/
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
private wallDrag;
|
|
37
|
+
private wallPreview;
|
|
38
|
+
constructor(scene: Phaser.Scene, options: WallEditorOptions);
|
|
39
|
+
setState(state: WallEditorState): void;
|
|
40
|
+
setNewWall(wall: Partial<Pick<WallSpec, "thickness" | "height" | "preset">>): void;
|
|
41
|
+
get dragging(): boolean;
|
|
42
|
+
cancel(): void;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
private handlePointerDown;
|
|
45
|
+
private handlePointerMove;
|
|
46
|
+
private handlePointerUp;
|
|
47
|
+
refresh(): void;
|
|
48
|
+
private findWall;
|
|
49
|
+
private onSelectedLine;
|
|
50
|
+
private moveWall;
|
|
51
|
+
private findAnchor;
|
|
52
|
+
private findWindow;
|
|
53
|
+
private getWindowRects;
|
|
54
|
+
private moveWindow;
|
|
55
|
+
private moveEndpoint;
|
|
56
|
+
private snapPoint;
|
|
57
|
+
private axisLock;
|
|
58
|
+
}
|