From 78f2b981e3701d1e743b95c4f4e1efb131176df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 1 Feb 2023 16:53:24 +0000 Subject: [PATCH] WIP: Door class (breaking) --- ui/src/components/DoorMapEditor.vue | 2 ++ ui/src/components/door_map/DoorPlacer.vue | 20 ++++++++----------- .../components/door_map/RectangleCanvas.vue | 8 +++++++- ui/src/components/door_map/calendar.ts | 11 ++++++++++ 4 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 ui/src/components/door_map/calendar.ts diff --git a/ui/src/components/DoorMapEditor.vue b/ui/src/components/DoorMapEditor.vue index f732234..77d65bb 100644 --- a/ui/src/components/DoorMapEditor.vue +++ b/ui/src/components/DoorMapEditor.vue @@ -12,6 +12,7 @@ diff --git a/ui/src/components/door_map/DoorPlacer.vue b/ui/src/components/door_map/DoorPlacer.vue index 4085207..91b6c46 100644 --- a/ui/src/components/door_map/DoorPlacer.vue +++ b/ui/src/components/door_map/DoorPlacer.vue @@ -9,14 +9,14 @@
- +
diff --git a/ui/src/components/door_map/RectangleCanvas.vue b/ui/src/components/door_map/RectangleCanvas.vue index aaeeae7..d4e1507 100644 --- a/ui/src/components/door_map/RectangleCanvas.vue +++ b/ui/src/components/door_map/RectangleCanvas.vue @@ -34,6 +34,10 @@ enum CanvasState { ThouCanvas, SVGRect, }, + props: { + rectangles: Array, + }, + emits: ["add_rect", "edit_rect", "remove_rect"], }) export default class extends Vue { private readonly min_rect_area = 300; @@ -41,7 +45,7 @@ export default class extends Vue { private preview_rect = new Rectangle(); private drag_rect?: Rectangle; private drag_origin = new Vector2D(); - public rectangles: Rectangle[] = []; + private rectangles: Rectangle[] = []; private get preview_visible(): boolean { return this.state !== CanvasState.Idle; @@ -78,6 +82,7 @@ export default class extends Vue { } this.rectangles.push(this.preview_rect); + this.$emit("add_rect", this.preview_rect); } private drag_start(event: MouseEvent, point: Vector2D) { @@ -107,6 +112,7 @@ export default class extends Vue { this.state = CanvasState.Idle; this.rectangles.push(this.preview_rect); + this.$emit("edit_rect", this.drag_rect, this.preview_rect); } private on_mousemove(event: MouseEvent, point: Vector2D) { diff --git a/ui/src/components/door_map/calendar.ts b/ui/src/components/door_map/calendar.ts new file mode 100644 index 0000000..b61cad4 --- /dev/null +++ b/ui/src/components/door_map/calendar.ts @@ -0,0 +1,11 @@ +import { Rectangle } from "../rects/rectangles"; + +export class Door { + public day: number; + public readonly position: Rectangle; + + constructor(day: number, position: Rectangle) { + this.day = day; + this.position = position; + } +} \ No newline at end of file