|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="stage-wrapper" ref="stageWrapperRef" :style="getWrapperStyle">
|
|
<div class="stage-wrapper" ref="stageWrapperRef" :style="getWrapperStyle">
|
|
|
<div class="stage" ref="stageRef" :style="getStyles.stageStyle">
|
|
<div class="stage" ref="stageRef" :style="getStyles.stageStyle">
|
|
|
- <div ref="tipRef" class="tip-txt" :style="getStyles.tipStyle">页面名称</div>
|
|
|
|
|
|
|
+ <div ref="tipRef" class="tip-txt" :style="getStyles.tipStyle">{{ page?.name }}</div>
|
|
|
<div class="absolute transparent-bg" :style="getStyles.transpartBg"></div>
|
|
<div class="absolute transparent-bg" :style="getStyles.transpartBg"></div>
|
|
|
<div
|
|
<div
|
|
|
ref="canvasRef"
|
|
ref="canvasRef"
|
|
@@ -26,23 +26,16 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import type { Ref } from 'vue'
|
|
import type { Ref } from 'vue'
|
|
|
import type { StageState } from './type'
|
|
import type { StageState } from './type'
|
|
|
|
|
+import type { Page } from '@/types/page'
|
|
|
|
|
|
|
|
-import {
|
|
|
|
|
- ref,
|
|
|
|
|
- onMounted,
|
|
|
|
|
- onBeforeUnmount,
|
|
|
|
|
- computed,
|
|
|
|
|
- nextTick,
|
|
|
|
|
- defineExpose,
|
|
|
|
|
- defineProps,
|
|
|
|
|
- defineEmits
|
|
|
|
|
-} from 'vue'
|
|
|
|
|
-
|
|
|
|
|
|
|
+import { ref, onMounted, onBeforeUnmount, computed, nextTick } from 'vue'
|
|
|
import { useScroll, useElementSize, useResizeObserver } from '@vueuse/core'
|
|
import { useScroll, useElementSize, useResizeObserver } from '@vueuse/core'
|
|
|
|
|
+import { useProjectStore } from '@/store/modules/project'
|
|
|
import ComponentWrapper from './ComponentWrapper.vue'
|
|
import ComponentWrapper from './ComponentWrapper.vue'
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
state: StageState
|
|
state: StageState
|
|
|
|
|
+ page?: Page
|
|
|
}>()
|
|
}>()
|
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
|
changeState: [Partial<StageState>]
|
|
changeState: [Partial<StageState>]
|
|
@@ -51,6 +44,7 @@ const stageWrapperRef: Ref<HTMLElement | null> = ref(null)
|
|
|
const stageRef: Ref<HTMLElement | null> = ref(null)
|
|
const stageRef: Ref<HTMLElement | null> = ref(null)
|
|
|
const canvasRef: Ref<HTMLElement | null> = ref(null)
|
|
const canvasRef: Ref<HTMLElement | null> = ref(null)
|
|
|
const { width: clientWidth, height: clientHeight } = useElementSize(stageWrapperRef)
|
|
const { width: clientWidth, height: clientHeight } = useElementSize(stageWrapperRef)
|
|
|
|
|
+const projectStore = useProjectStore()
|
|
|
|
|
|
|
|
const getWrapperStyle = computed(() => {
|
|
const getWrapperStyle = computed(() => {
|
|
|
const { showRuler } = props.state
|
|
const { showRuler } = props.state
|
|
@@ -98,7 +92,9 @@ const getStyles = computed(() => {
|
|
|
const endX = tipLeft + width * scale
|
|
const endX = tipLeft + width * scale
|
|
|
const endY = startY + height * scale
|
|
const endY = startY + height * scale
|
|
|
|
|
|
|
|
- const clipPath = `rect(${startY}px ${endX}px ${endY}px ${tipLeft}px)`
|
|
|
|
|
|
|
+ const offset = props.page?.id === projectStore.activePageId ? 2 : 0
|
|
|
|
|
+ const clipPath = `rect(${startY + offset}px ${endX + offset}px ${endY + offset}px ${tipLeft + offset}px)`
|
|
|
|
|
+ const border = props.page?.id === projectStore.activePageId ? '2px solid #1890ff' : ''
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
// 舞台样式
|
|
// 舞台样式
|
|
@@ -114,7 +110,8 @@ const getStyles = computed(() => {
|
|
|
transform: `scale(${scale})`,
|
|
transform: `scale(${scale})`,
|
|
|
left: `${canvasLeft}px`,
|
|
left: `${canvasLeft}px`,
|
|
|
top: `${canvasTop}px`,
|
|
top: `${canvasTop}px`,
|
|
|
- background: '#fff'
|
|
|
|
|
|
|
+ background: '#fff',
|
|
|
|
|
+ border
|
|
|
},
|
|
},
|
|
|
// 提示样式
|
|
// 提示样式
|
|
|
tipStyle: {
|
|
tipStyle: {
|