fix: directiveでのtooltip表示との競合を解消 (#265)

(cherry picked from commit 6d15d379a76b1b153ec2996e22bf0fc29ced5fda)
This commit is contained in:
CaffeinePower 2024-09-05 16:14:10 +09:00 committed by kakkokari-gtyih
parent 837a8e15d8
commit 8a37adcffe
1 changed files with 15 additions and 8 deletions

View File

@ -5,7 +5,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div class="timctyfi" :class="{ disabled, easing }"> <div class="timctyfi" :class="{ disabled, easing }">
<div class="label"><slot name="label"></slot></div> <div class="label">
<slot name="label"></slot>
</div>
<div v-adaptive-border class="body"> <div v-adaptive-border class="body">
<div ref="containerEl" class="container"> <div ref="containerEl" class="container">
<div class="track"> <div class="track">
@ -14,16 +16,21 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="steps && showTicks" class="ticks"> <div v-if="steps && showTicks" class="ticks">
<div v-for="i in (steps + 1)" class="tick" :style="{ left: (((i - 1) / steps) * 100) + '%' }"></div> <div v-for="i in (steps + 1)" class="tick" :style="{ left: (((i - 1) / steps) * 100) + '%' }"></div>
</div> </div>
<div ref="thumbEl" v-tooltip="textConverter(finalValue)" class="thumb" :style="{ left: thumbPosition + 'px' }" @mousedown="onMousedown" @touchstart="onMousedown"></div> <div
ref="thumbEl" class="thumb" :style="{ left: thumbPosition + 'px' }"
@mousedown="onMousedown" @touchstart="onMousedown"
></div>
</div> </div>
</div> </div>
<div class="caption"><slot name="caption"></slot></div> <div class="caption">
<slot name="caption"></slot>
</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, watch, shallowRef } from 'vue'; import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import * as os from '@/os.js'; import { popup } from '@/os.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
modelValue: number; modelValue: number;
@ -105,7 +112,7 @@ function onMousedown(ev: MouseEvent | TouchEvent) {
ev.preventDefault(); ev.preventDefault();
const tooltipShowing = ref(true); const tooltipShowing = ref(true);
const { dispose } = os.popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), { const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), {
showing: tooltipShowing, showing: tooltipShowing,
text: computed(() => { text: computed(() => {
return props.textConverter(finalValue.value); return props.textConverter(finalValue.value);
@ -261,12 +268,12 @@ function onMousedown(ev: MouseEvent | TouchEvent) {
> .container { > .container {
> .track { > .track {
> .highlight { > .highlight {
transition: width 0.2s cubic-bezier(0,0,0,1); transition: width 0.2s cubic-bezier(0, 0, 0, 1);
} }
} }
> .thumb { > .thumb {
transition: left 0.2s cubic-bezier(0,0,0,1); transition: left 0.2s cubic-bezier(0, 0, 0, 1);
} }
} }
} }