diff --git a/ui/src/components/DoorMapEditor.vue b/ui/src/components/DoorMapEditor.vue
index 3b608e7..7891951 100644
--- a/ui/src/components/DoorMapEditor.vue
+++ b/ui/src/components/DoorMapEditor.vue
@@ -6,12 +6,15 @@
-
+
+
+
+
diff --git a/ui/src/lib/door.ts b/ui/src/lib/door.ts
index 17b244e..aff4492 100644
--- a/ui/src/lib/door.ts
+++ b/ui/src/lib/door.ts
@@ -1,4 +1,13 @@
import { Rectangle } from "./rectangle";
+import { Vector2D } from "./vector2d";
+
+export interface DoorSerialized {
+ day: number;
+ x1: number;
+ y1: number;
+ x2: number;
+ y2: number;
+}
export class Door {
private _day = -1;
@@ -25,4 +34,24 @@ export class Door {
this._day = Math.max(Math.floor(result), -1);
}
}
+
+ public static deserialize(serialized: DoorSerialized): Door {
+ return new Door(
+ new Rectangle(
+ new Vector2D(serialized.x1, serialized.y1),
+ new Vector2D(serialized.x2, serialized.y2),
+ ),
+ serialized.day,
+ );
+ }
+
+ public get serialized(): DoorSerialized {
+ return {
+ day: this.day,
+ x1: this.position.origin.x,
+ y1: this.position.origin.y,
+ x2: this.position.corner.x,
+ y2: this.position.corner.y,
+ };
+ }
}