"focused" -> "highlighted, selected"

This commit is contained in:
Jörn-Michael Miehe 2023-01-17 22:33:11 +00:00
parent cc1ab7be90
commit b4492dcb73
3 changed files with 31 additions and 9 deletions

View file

@ -23,10 +23,8 @@ export default class CalendarImage extends Vue {
}; };
private on_resize() { private on_resize() {
this.$refs.container.style.setProperty( this.$refs.container.style.height =
"height", this.$refs.background.offsetHeight + "px";
this.$refs.background.offsetHeight + "px"
);
} }
public mounted() { public mounted() {

View file

@ -1,6 +1,6 @@
<template> <template>
<rect <rect
:class="focused ? 'focused' : ''" :class="classes"
:x="rectangle.left" :x="rectangle.left"
:y="rectangle.top" :y="rectangle.top"
:width="rectangle.width" :width="rectangle.width"
@ -14,7 +14,11 @@ import { Rectangle } from "./rectangles";
@Options({ @Options({
props: { props: {
focused: { selected: {
type: Boolean,
default: false,
},
highlighted: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
@ -22,8 +26,23 @@ import { Rectangle } from "./rectangles";
}, },
}) })
export default class Rect extends Vue { export default class Rect extends Vue {
private focused!: boolean; private selected!: boolean;
private highlighted!: boolean;
private rectangle!: Rectangle; private rectangle!: Rectangle;
private get classes(): string {
let result: string[] = [];
if (this.selected) {
result.push("select");
}
if (this.highlighted) {
result.push("highlight");
}
return result.join(" ");
}
} }
</script> </script>
@ -35,7 +54,12 @@ rect {
stroke-opacity: 0.9; stroke-opacity: 0.9;
stroke-width: 1; stroke-width: 1;
&.focused { &.select {
fill-opacity: 0.4;
stroke-opacity: 1;
}
&.highlight {
fill: gold; fill: gold;
stroke: yellow; stroke: yellow;
} }

View file

@ -9,7 +9,7 @@
> >
<Rect <Rect
v-if="preview_state.visible" v-if="preview_state.visible"
:focused="true" :highlighted="true"
:rectangle="preview_rectangle" :rectangle="preview_rectangle"
/> />
<Rect <Rect