add boolean type
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, useTemplateRef, watch } from 'vue';
|
||||
import NumericText from '@/components/NumericText.vue';
|
||||
import BooleanText from '@/components/BooleanText.vue';
|
||||
|
||||
defineProps<{
|
||||
x: number;
|
||||
y: number;
|
||||
value: number;
|
||||
class?: string;
|
||||
value: number | boolean;
|
||||
}>();
|
||||
|
||||
const background_offset = computed(() => 5);
|
||||
@@ -34,7 +34,7 @@ function update_value_text(text: string) {
|
||||
|
||||
<template>
|
||||
<rect
|
||||
:class="$props.class"
|
||||
:class="$attrs.class"
|
||||
:x="x - background_offset"
|
||||
:y="y - y_offset - background_offset"
|
||||
:width="label_width + background_offset * 2"
|
||||
@@ -42,10 +42,16 @@ function update_value_text(text: string) {
|
||||
></rect>
|
||||
<text :class="$props.class" ref="label-ref" :x="x" :y="y">
|
||||
<NumericText
|
||||
v-if="typeof value == 'number'"
|
||||
:value="value"
|
||||
:max_width="6"
|
||||
@update="update_value_text"
|
||||
></NumericText>
|
||||
<BooleanText
|
||||
v-else-if="typeof value == 'boolean'"
|
||||
:value="value"
|
||||
@update="update_value_text"
|
||||
></BooleanText>
|
||||
</text>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user