89 lines
1.9 KiB
Vue
Raw Normal View History

2022-03-15 17:49:02 +08:00
<template>
<sketch-rule
:thick="thick"
:scale="scale"
:width="width"
:height="height"
:startX="startX"
:startY="startY"
:lines="lines"
></sketch-rule>
</template>
<script setup lang="ts">
import { toRefs, computed } from 'vue'
2022-03-15 17:49:02 +08:00
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
import { useDesignStore } from '@/store/modules/designStore/designStore'
const chartEditStore = useChartEditStore()
const designStore = useDesignStore()
const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
// 初始化标尺的缩放
const scale = 1
2022-03-15 17:49:02 +08:00
// x轴标尺开始的坐标数值
const startX = 20
2022-03-15 17:49:02 +08:00
// y轴标尺开始的坐标数值
const startY = 20
2022-03-15 17:49:02 +08:00
// 标尺的厚度
const thick = 20
// 初始化水平标尺上的参考线
const lines = {
h: [],
v: []
}
// 颜色
const themeColor = computed(() => {
return designStore.getAppTheme
})
2022-03-15 17:49:02 +08:00
</script>
<style>
2022-03-15 19:06:19 +08:00
/* 使 SCSS 使 CSS
此库有计划 Vue3 版本但是开发的时候还没发布 */
#mb-ruler {
top: 0;
left: 0;
}
2022-03-15 17:49:02 +08:00
/* 横线 */
#mb-ruler .v-container .lines .line {
/* 最大缩放 200% */
2022-03-17 20:18:46 +08:00
width: 200vw!important;
2022-03-15 17:49:02 +08:00
border-top: 1px dashed v-bind('themeColor') !important;
2022-03-15 17:49:02 +08:00
}
#mb-ruler .v-container .indicator {
border-bottom: 1px dashed v-bind('themeColor') !important;
}
/* 竖线 */
#mb-ruler .h-container .lines .line {
/* 最大缩放 200% */
height: 200vh!important;
2022-03-15 17:49:02 +08:00
border-left: 1px dashed v-bind('themeColor') !important;
}
#mb-ruler .h-container .indicator {
border-left: 1px dashed v-bind('themeColor') !important;
}
/* 坐标数值背景颜色 */
#mb-ruler .indicator .value {
background-color: rgba(0, 0, 0, 0);
}
/* 删除按钮 */
#mb-ruler .line .del {
padding: 0;
color: v-bind('themeColor');
font-size: 26px;
font-weight: bolder;
}
2022-03-15 17:49:02 +08:00
#mb-ruler .corner{
border-width: 0!important;
}
</style>