2023-01-17 18:25:56 +00:00
|
|
|
<template>
|
2023-09-07 01:17:14 +00:00
|
|
|
<rect
|
2023-09-20 16:16:45 +00:00
|
|
|
:class="color !== undefined ? `visible ${color}` : ''"
|
2023-09-07 01:17:14 +00:00
|
|
|
:x="rectangle.left"
|
|
|
|
:y="rectangle.top"
|
|
|
|
:width="rectangle.width"
|
|
|
|
:height="rectangle.height"
|
|
|
|
/>
|
2023-01-17 18:25:56 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-09-07 02:08:56 +00:00
|
|
|
import { Rectangle } from "@/lib/rectangle";
|
2023-09-06 16:25:35 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
2023-01-17 18:25:56 +00:00
|
|
|
|
2023-09-20 16:16:45 +00:00
|
|
|
// type RectClass = "red" | "yellow" | "green" | "blue" | "purple";
|
|
|
|
type RectColor = "yellow" | "green";
|
|
|
|
|
2023-01-17 18:25:56 +00:00
|
|
|
@Options({
|
|
|
|
props: {
|
2023-09-20 16:16:45 +00:00
|
|
|
color: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
2023-01-17 18:25:56 +00:00
|
|
|
},
|
|
|
|
rectangle: Rectangle,
|
|
|
|
},
|
|
|
|
})
|
2023-01-24 23:19:25 +00:00
|
|
|
export default class extends Vue {
|
2023-09-20 16:16:45 +00:00
|
|
|
public color?: RectColor;
|
2023-09-06 16:25:35 +00:00
|
|
|
public rectangle!: Rectangle;
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
rect {
|
2023-09-20 16:16:45 +00:00
|
|
|
fill: transparent;
|
|
|
|
|
|
|
|
&.visible {
|
|
|
|
fill-opacity: 0.2;
|
|
|
|
stroke-opacity: 0.9;
|
|
|
|
stroke-width: 1;
|
|
|
|
|
|
|
|
&.yellow {
|
|
|
|
fill: gold;
|
|
|
|
stroke: yellow;
|
|
|
|
}
|
2023-01-17 18:25:56 +00:00
|
|
|
|
2023-09-20 16:16:45 +00:00
|
|
|
&.green {
|
|
|
|
fill: lightgreen;
|
|
|
|
stroke: green;
|
|
|
|
}
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
}
|
2023-09-07 01:17:14 +00:00
|
|
|
</style>
|