2023-01-17 18:25:56 +00:00
|
|
|
<template>
|
|
|
|
<rect
|
2023-01-17 22:33:11 +00:00
|
|
|
:class="classes"
|
2023-01-17 18:25:56 +00:00
|
|
|
:x="rectangle.left"
|
|
|
|
:y="rectangle.top"
|
|
|
|
:width="rectangle.width"
|
|
|
|
:height="rectangle.height"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Vue, Options } from "vue-class-component";
|
|
|
|
import { Rectangle } from "./rectangles";
|
|
|
|
|
|
|
|
@Options({
|
|
|
|
props: {
|
2023-01-17 23:58:46 +00:00
|
|
|
focused: {
|
2023-01-17 18:25:56 +00:00
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
rectangle: Rectangle,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class Rect extends Vue {
|
2023-01-17 23:58:46 +00:00
|
|
|
private focused!: boolean;
|
2023-01-17 18:25:56 +00:00
|
|
|
private rectangle!: Rectangle;
|
2023-01-17 22:33:11 +00:00
|
|
|
|
|
|
|
private get classes(): string {
|
|
|
|
let result: string[] = [];
|
|
|
|
|
2023-01-17 23:58:46 +00:00
|
|
|
if (this.focused) {
|
|
|
|
result.push("focus");
|
2023-01-17 22:33:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return result.join(" ");
|
|
|
|
}
|
2023-01-17 18:25:56 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
rect {
|
|
|
|
fill: lightgreen;
|
|
|
|
stroke: green;
|
|
|
|
fill-opacity: 0.2;
|
|
|
|
stroke-opacity: 0.9;
|
|
|
|
stroke-width: 1;
|
|
|
|
|
2023-01-17 23:58:46 +00:00
|
|
|
&.focus {
|
2023-01-17 18:25:56 +00:00
|
|
|
fill: gold;
|
|
|
|
stroke: yellow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|