54 lines
1.3 KiB
Vue
54 lines
1.3 KiB
Vue
<script setup lang="ts">
|
|
import {ref} from "vue";
|
|
const props = defineProps<{
|
|
isActive: boolean
|
|
colIndex: number
|
|
rowIndex: number
|
|
ledIndex: number
|
|
}>();
|
|
const showTooltip = ref(false);
|
|
</script>
|
|
|
|
<template>
|
|
<div class="led-container" @mouseenter="showTooltip = true" @mouseleave="showTooltip = false">
|
|
<div class="led" :class="{ active: isActive }"></div>
|
|
<div v-if="showTooltip" class="tooltip" @mouseover="showTooltip = false">{{ props.rowIndex }},{{ props.colIndex * 8 + props.ledIndex }}
|
|
0x{{ (props.rowIndex * 8 + props.colIndex).toString(16).toUpperCase().padStart(2, '0') }}
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.led-container {
|
|
position: relative;
|
|
display: inline-block;
|
|
}
|
|
|
|
.led {
|
|
width: 10px;
|
|
height: 10px;
|
|
background-color: rgb(32, 42, 32);
|
|
border-radius: 50%;
|
|
box-shadow: 0 0 5px rgba(32, 42, 32, 0.5);
|
|
margin: 2px;
|
|
}
|
|
|
|
.active {
|
|
background-color: rgb(137, 221, 64);
|
|
box-shadow: 0 0 3px rgba(137, 221, 64, 0.5);
|
|
}
|
|
|
|
.tooltip {
|
|
position: absolute;
|
|
bottom: 100%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background-color: #333;
|
|
color: #fff;
|
|
padding: 5px;
|
|
border-radius: 3px;
|
|
white-space: nowrap;
|
|
z-index: 10;
|
|
opacity: 0.8;
|
|
}
|
|
</style> |