advent22/ui/src/components/door_map/DoorPlacer.vue

48 lines
1,023 B
Vue
Raw Normal View History

2023-01-19 17:59:18 +00:00
<template>
<section>
<div class="content">
<ul>
<li>Linksklick + Ziehen: Neues Türchen erstellen</li>
<li>Rechtsklick + Ziehen: Türchen verschieben</li>
<li>Doppel- oder Mittelklick: Türchen löschen</li>
</ul>
</div>
<figure class="image">
<img src="@/assets/adventskalender.jpg" />
2023-02-01 16:53:24 +00:00
<RectangleCanvas v-model="rectangles" />
2023-01-19 17:59:18 +00:00
</figure>
</section>
</template>
<script lang="ts">
import { Vue, Options } from "vue-class-component";
2023-02-01 16:53:24 +00:00
import { Door } from "./calendar";
2023-01-27 00:23:41 +00:00
import RectangleCanvas from "./RectangleCanvas.vue";
2023-01-19 17:59:18 +00:00
@Options({
components: {
2023-01-27 00:23:41 +00:00
RectangleCanvas,
2023-01-19 17:59:18 +00:00
},
2023-01-23 23:37:23 +00:00
props: {
2023-02-01 16:53:24 +00:00
doors: Array,
2023-01-23 23:37:23 +00:00
},
2023-02-01 16:53:24 +00:00
emits: ["update:doors"],
2023-01-19 17:59:18 +00:00
})
2023-01-24 23:19:25 +00:00
export default class extends Vue {
2023-02-01 16:53:24 +00:00
private doors!: Door[];
2023-01-23 23:37:23 +00:00
2023-02-01 16:53:24 +00:00
private get rectangles() {
return this.doors.filter((door) => door.position);
2023-01-23 23:37:23 +00:00
}
public beforeUnmount() {
2023-02-01 16:53:24 +00:00
this.$emit("update:doors", this.doors);
2023-01-23 23:37:23 +00:00
}
}
2023-01-19 17:59:18 +00:00
</script>
<style lang="scss" scoped>
section > figure {
user-select: none;
}
</style>