Merge branch 'feature/remove-svg-rect' into develop
This commit is contained in:
commit
15309e6710
5 changed files with 54 additions and 35 deletions
|
@ -10,6 +10,7 @@
|
||||||
:key="`door-${index}`"
|
:key="`door-${index}`"
|
||||||
:door="door"
|
:door="door"
|
||||||
:visible="store.is_touch_device"
|
:visible="store.is_touch_device"
|
||||||
|
:title="$advent22.name_door(door.day)"
|
||||||
@click="door_click(door.day)"
|
@click="door_click(door.day)"
|
||||||
/>
|
/>
|
||||||
</ThouCanvas>
|
</ThouCanvas>
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<SVGRect
|
<SVGRect
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
:variant="visible || hovered ? 'primary' : undefined"
|
variant="primary"
|
||||||
|
:visible="store.is_touch_device || force_visible"
|
||||||
:rectangle="door.position"
|
:rectangle="door.position"
|
||||||
@mouseenter="hovered = true"
|
|
||||||
@mouseleave="hovered = false"
|
|
||||||
>
|
>
|
||||||
<div class="has-text-danger">{{ door.day }}</div>
|
<div class="has-text-danger">{{ door.day }}</div>
|
||||||
</SVGRect>
|
</SVGRect>
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Door } from "@/lib/door";
|
import { Door } from "@/lib/door";
|
||||||
|
import { advent22Store } from "@/plugins/store";
|
||||||
import { Options, Vue } from "vue-class-component";
|
import { Options, Vue } from "vue-class-component";
|
||||||
|
|
||||||
import SVGRect from "./SVGRect.vue";
|
import SVGRect from "./SVGRect.vue";
|
||||||
|
@ -22,16 +22,16 @@ import SVGRect from "./SVGRect.vue";
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
door: Door,
|
door: Door,
|
||||||
visible: {
|
force_visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public door!: Door;
|
public readonly store = advent22Store();
|
||||||
public visible!: boolean;
|
|
||||||
|
|
||||||
public hovered = false;
|
public door!: Door;
|
||||||
|
public force_visible!: boolean;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,22 +7,14 @@
|
||||||
:style="`transform: scaleX(${1 / store.calendar_aspect_ratio})`"
|
:style="`transform: scaleX(${1 / store.calendar_aspect_ratio})`"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="variant !== undefined"
|
|
||||||
xmlns="http://www.w3.org/1999/xhtml"
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
class="px-4 is-flex is-align-items-center is-justify-content-center is-size-1 has-text-weight-bold"
|
:class="`px-4 is-flex is-align-items-center is-justify-content-center is-size-1 has-text-weight-bold ${extra_classes}`"
|
||||||
style="height: inherit"
|
style="height: inherit"
|
||||||
|
:title="title"
|
||||||
>
|
>
|
||||||
<slot name="default" />
|
<slot name="default" />
|
||||||
</div>
|
</div>
|
||||||
</foreignObject>
|
</foreignObject>
|
||||||
<rect
|
|
||||||
v-bind="$attrs"
|
|
||||||
:class="variant !== undefined ? variant : ''"
|
|
||||||
:x="rectangle.left"
|
|
||||||
:y="rectangle.top"
|
|
||||||
:width="rectangle.width"
|
|
||||||
:height="rectangle.height"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -40,34 +32,54 @@ type BulmaVariant =
|
||||||
|
|
||||||
@Options({
|
@Options({
|
||||||
props: {
|
props: {
|
||||||
variant: {
|
variant: String,
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
rectangle: Rectangle,
|
||||||
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
rectangle: Rectangle,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
public variant?: BulmaVariant;
|
|
||||||
public rectangle!: Rectangle;
|
|
||||||
|
|
||||||
public readonly store = advent22Store();
|
public readonly store = advent22Store();
|
||||||
|
|
||||||
|
private variant!: BulmaVariant;
|
||||||
|
private visible!: boolean;
|
||||||
|
public rectangle!: Rectangle;
|
||||||
|
public title?: string;
|
||||||
|
|
||||||
|
public get extra_classes(): string {
|
||||||
|
let result = this.variant;
|
||||||
|
|
||||||
|
if (this.visible) result += " visible";
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "@/bulma-scheme";
|
@import "@/bulma-scheme";
|
||||||
|
|
||||||
rect {
|
foreignObject > div {
|
||||||
fill: transparent;
|
&:not(.visible, :hover):deep() > * {
|
||||||
fill-opacity: 0.3;
|
display: none;
|
||||||
stroke-opacity: 0.9;
|
}
|
||||||
stroke-width: 1;
|
|
||||||
|
|
||||||
@each $name, $color in $advent22-colors {
|
&.visible,
|
||||||
&.#{$name} {
|
&:hover {
|
||||||
fill: $color;
|
border-width: 3px;
|
||||||
stroke: $color;
|
border-style: solid;
|
||||||
|
|
||||||
|
@each $name, $color in $advent22-colors {
|
||||||
|
&.#{$name} {
|
||||||
|
background-color: rgba($color, 0.3);
|
||||||
|
border-color: rgba($color, 0.9);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
:key="`door-${index}`"
|
:key="`door-${index}`"
|
||||||
:door="door"
|
:door="door"
|
||||||
style="cursor: inherit"
|
style="cursor: inherit"
|
||||||
visible
|
force_visible
|
||||||
/>
|
/>
|
||||||
<SVGRect
|
<SVGRect
|
||||||
v-if="preview_visible"
|
v-if="preview_visible"
|
||||||
variant="success"
|
variant="success"
|
||||||
:rectangle="preview_rect"
|
:rectangle="preview_rect"
|
||||||
|
visible
|
||||||
/>
|
/>
|
||||||
</ThouCanvas>
|
</ThouCanvas>
|
||||||
</template>
|
</template>
|
||||||
|
@ -146,8 +147,12 @@ export default class extends Vue {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
* {
|
svg {
|
||||||
cursor: crosshair;
|
cursor: crosshair;
|
||||||
|
|
||||||
|
* {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
:rectangle="door.position"
|
:rectangle="door.position"
|
||||||
:variant="editing ? 'success' : 'primary'"
|
:variant="editing ? 'success' : 'primary'"
|
||||||
@click.left="on_click"
|
@click.left="on_click"
|
||||||
|
visible
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-if="editing"
|
v-if="editing"
|
||||||
|
@ -52,7 +53,7 @@ export default class extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
public on_click(event: MouseEvent) {
|
public on_click(event: MouseEvent) {
|
||||||
if (!(event.currentTarget instanceof SVGRectElement)) {
|
if (!(event.target instanceof HTMLDivElement)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue