|
@@ -4,8 +4,8 @@
|
|
|
<CloseB class="close" @click="close" />
|
|
|
</template>
|
|
|
|
|
|
- <div class="paint-container">
|
|
|
- <canvas id="digitalTrackpadCanvas" width="578" height="240"></canvas>
|
|
|
+ <div class="paint-container" ref="paintContainer">
|
|
|
+ <canvas id="digitalTrackpadCanvas" :width="canvasWidth" :height="canvasHeight"></canvas>
|
|
|
</div>
|
|
|
|
|
|
<template #footer>
|
|
@@ -17,10 +17,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed, watch, toRaw } from 'vue'
|
|
|
+import { computed, watch, ref, nextTick } from 'vue'
|
|
|
import { useViewerStore } from '@/stores/modules/viewer'
|
|
|
import { useDocumentStore } from '@/stores/modules/document'
|
|
|
import core from '@/core'
|
|
|
+import { isMobileDevice } from '@/helpers/device'
|
|
|
|
|
|
const emits = defineEmits(['modifyImage'])
|
|
|
const dialogName = 'digitalSignCreatePanel'
|
|
@@ -30,6 +31,22 @@ const useDocument = useDocumentStore()
|
|
|
|
|
|
const show = computed(() => useViewer.isElementOpen(dialogName))
|
|
|
|
|
|
+const canvasWidth = ref(578)
|
|
|
+const canvasHeight = ref(270)
|
|
|
+const paintContainer = ref()
|
|
|
+
|
|
|
+watch(() => show.value, (newValue, oldValue) => {
|
|
|
+ if (newValue) {
|
|
|
+ if (isMobileDevice) {
|
|
|
+ nextTick(() => {
|
|
|
+ const { clientWidth, clientHeight } = paintContainer.value
|
|
|
+ clientWidth && canvasWidth.value !== clientWidth && (canvasWidth.value = clientWidth)
|
|
|
+ clientHeight && canvasHeight.value !== clientHeight && (canvasHeight.value = clientHeight)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
const close = () => {
|
|
|
useViewer.closeElement(dialogName)
|
|
|
clear()
|