2022-01-20 21:25:35 +08:00
|
|
|
<template>
|
2022-01-29 23:58:56 +08:00
|
|
|
<div
|
|
|
|
class="go-edit-range"
|
2022-02-16 19:18:39 +08:00
|
|
|
:style="rangeStyle"
|
2022-01-30 14:20:28 +08:00
|
|
|
@mousedown="mousedownHandleUnStop($event, undefined)"
|
2022-01-29 23:58:56 +08:00
|
|
|
>
|
2022-01-20 21:25:35 +08:00
|
|
|
<slot></slot>
|
|
|
|
</div>
|
2022-02-16 19:18:39 +08:00
|
|
|
<div class="go-edit-range-model" :style="rangeModelStyle"></div>
|
2022-01-20 21:25:35 +08:00
|
|
|
</template>
|
|
|
|
|
2022-01-27 23:16:51 +08:00
|
|
|
<script setup lang="ts">
|
2022-02-06 21:35:38 +08:00
|
|
|
import { toRefs, computed } from 'vue'
|
2022-02-06 01:04:05 +08:00
|
|
|
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
|
2022-01-27 23:16:51 +08:00
|
|
|
import { useSizeStyle } from '../../hooks/useStyle.hook'
|
2022-02-16 19:18:39 +08:00
|
|
|
import { mousedownHandleUnStop } from '../../hooks/useDrag.hook'
|
2022-01-29 23:58:56 +08:00
|
|
|
|
2022-02-06 01:04:05 +08:00
|
|
|
const chartEditStoreStore = useChartEditStoreStore()
|
|
|
|
|
2022-02-16 19:18:39 +08:00
|
|
|
const { getEditCanvasConfig, getEditCanvas } = toRefs(chartEditStoreStore)
|
2022-02-06 01:04:05 +08:00
|
|
|
|
|
|
|
const size = computed(() => {
|
|
|
|
return {
|
2022-02-06 21:35:38 +08:00
|
|
|
w: getEditCanvasConfig.value.width,
|
|
|
|
h: getEditCanvasConfig.value.height
|
2022-02-06 01:04:05 +08:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-02-16 19:18:39 +08:00
|
|
|
const rangeStyle = computed(() => {
|
2022-02-06 21:35:38 +08:00
|
|
|
const background = getEditCanvasConfig.value.background
|
|
|
|
const backgroundImage = getEditCanvasConfig.value.backgroundImage
|
|
|
|
const selectColor = getEditCanvasConfig.value.selectColor
|
|
|
|
const backgroundColor = background ? background : null
|
2022-02-16 19:18:39 +08:00
|
|
|
const computedBackground = selectColor
|
2022-02-06 21:35:38 +08:00
|
|
|
? { background: backgroundColor }
|
|
|
|
: { background: `url(${backgroundImage}) no-repeat center/100% !important` }
|
2022-02-06 01:04:05 +08:00
|
|
|
// @ts-ignore
|
2022-02-16 19:18:39 +08:00
|
|
|
return { ...useSizeStyle(size.value), ...computedBackground }
|
|
|
|
})
|
|
|
|
|
|
|
|
// 模态层
|
|
|
|
const rangeModelStyle = computed(() => {
|
|
|
|
const dragStyle = getEditCanvas.value.isDrag && {'z-index': 99999 }
|
|
|
|
// @ts-ignore
|
|
|
|
return { ...useSizeStyle(size.value), ...dragStyle}
|
2022-02-06 01:04:05 +08:00
|
|
|
})
|
2022-01-27 23:16:51 +08:00
|
|
|
</script>
|
2022-01-20 21:25:35 +08:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@include go(edit-range) {
|
|
|
|
position: relative;
|
|
|
|
border: 1px solid;
|
2022-01-23 01:12:49 +08:00
|
|
|
border-radius: 15px;
|
2022-02-06 21:35:38 +08:00
|
|
|
background: url('@/assets/images/canvas/pageBg.png');
|
2022-01-20 21:25:35 +08:00
|
|
|
@include fetch-theme('box-shadow');
|
|
|
|
@include filter-border-color('hover-border-color');
|
|
|
|
@include fetch-theme-custom('border-color', 'background-color4');
|
|
|
|
}
|
2022-02-16 19:18:39 +08:00
|
|
|
@include go(edit-range-model) {
|
|
|
|
z-index: -1;
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
border-radius: 15px;
|
|
|
|
border: 1px solid rgba(0, 0, 0, 0);
|
|
|
|
}
|
2022-01-20 21:25:35 +08:00
|
|
|
</style>
|