|
|
@@ -8,25 +8,20 @@
|
|
|
>
|
|
|
<div class="workspace flex flex-col">
|
|
|
<div class="h-32px bg-bg-secondary stage-title border-b-1px border-b-solid border-border">
|
|
|
- <div class="px-12px leading-32px text-text-primary font-bold">屏幕</div>
|
|
|
+ <div class="px-12px leading-32px text-text-primary font-bold">{{ $t('screen') }}</div>
|
|
|
</div>
|
|
|
<div class="workspace-top">
|
|
|
<!-- 画布 -->
|
|
|
- <DesignerCanvas
|
|
|
- :state="state"
|
|
|
- :page="currentScreenActivePage"
|
|
|
- ref="canvasRef"
|
|
|
- @changeState="handleSetState"
|
|
|
- />
|
|
|
+ <DesignerCanvas :state="state" :page="page" ref="canvasRef" @changeState="handleSetState" />
|
|
|
<!-- 标尺 -->
|
|
|
- <Scaleplate :state="state" :page="currentScreenActivePage" v-show="state.showRuler" />
|
|
|
+ <Scaleplate :state="state" :page="page" v-show="state.showRuler" />
|
|
|
</div>
|
|
|
<!-- 底部工具栏 -->
|
|
|
<div
|
|
|
class="workspace-bottom flex justify-between items-center overflow-hidden bg-bg-secondary"
|
|
|
>
|
|
|
<div class="bottom-left flex items-center">
|
|
|
- <span style="margin-right: 12px">画布尺寸:</span>
|
|
|
+ <span style="margin-right: 12px">{{ $t('canvasSize') }}</span>
|
|
|
<span>{{ state.width }} * {{ state.height }}</span>
|
|
|
</div>
|
|
|
<div class="bottom-right flex items-center gap-8px">
|
|
|
@@ -85,8 +80,9 @@
|
|
|
<script setup lang="ts">
|
|
|
import type { StageState } from './type'
|
|
|
import type { Screen } from '@/types/screen'
|
|
|
+import type { Page } from '@/types/page'
|
|
|
|
|
|
-import { ref, reactive, watch, nextTick, computed } from 'vue'
|
|
|
+import { ref, reactive, watch, nextTick } from 'vue'
|
|
|
import Scaleplate from './Scaleplate.vue'
|
|
|
import DesignerCanvas from './DesignerCanvas.vue'
|
|
|
import { throttle } from 'lodash'
|
|
|
@@ -102,7 +98,8 @@ import { useProjectStore } from '@/store/modules/project'
|
|
|
import { useAppStore } from '@/store/modules/app'
|
|
|
|
|
|
const props = defineProps<{
|
|
|
- data?: Screen
|
|
|
+ screen?: Screen
|
|
|
+ page?: Page
|
|
|
}>()
|
|
|
|
|
|
const projectStore = useProjectStore()
|
|
|
@@ -127,15 +124,9 @@ const state = reactive<StageState>({
|
|
|
showBgGrid: false,
|
|
|
showReferenceLine: true
|
|
|
})
|
|
|
-// 当前活动页面ID
|
|
|
-const currentPageId = ref<string>()
|
|
|
-// 当前屏幕活动页面
|
|
|
-const currentScreenActivePage = computed(() => {
|
|
|
- return props.data?.pages.find((item) => item.id === currentPageId.value)
|
|
|
-})
|
|
|
|
|
|
watch(
|
|
|
- () => props.data,
|
|
|
+ () => props.screen,
|
|
|
async (val) => {
|
|
|
if (val) {
|
|
|
state.width = val.width
|
|
|
@@ -143,9 +134,6 @@ watch(
|
|
|
await nextTick()
|
|
|
handleCenter()
|
|
|
}
|
|
|
- if (!currentPageId.value && val?.pages.length) {
|
|
|
- currentPageId.value = val.pages[0].id
|
|
|
- }
|
|
|
}
|
|
|
)
|
|
|
|