From a85a9ee17bf116a6fe56b858550335f8df6cde01 Mon Sep 17 00:00:00 2001 From: TimSpan Date: Wed, 13 Nov 2024 11:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E6=94=B9=E5=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../police/dailyInspection/dailyInspection.vue | 2 -- .../src/subPages/select/signature/signature.vue | 12 +++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/collect_information/src/subPages/police/dailyInspection/dailyInspection.vue b/collect_information/src/subPages/police/dailyInspection/dailyInspection.vue index 6f455ea..5d78af5 100644 --- a/collect_information/src/subPages/police/dailyInspection/dailyInspection.vue +++ b/collect_information/src/subPages/police/dailyInspection/dailyInspection.vue @@ -46,7 +46,6 @@ - @@ -56,7 +55,6 @@ - diff --git a/collect_information/src/subPages/select/signature/signature.vue b/collect_information/src/subPages/select/signature/signature.vue index 99f3468..f0b3643 100644 --- a/collect_information/src/subPages/select/signature/signature.vue +++ b/collect_information/src/subPages/select/signature/signature.vue @@ -27,7 +27,6 @@ const _index = ref(0) import { useDailyStore } from '@/store/daily' const store = useDailyStore() - const width = ref(0) const height = ref(300) const points = ref([]) // 画笔路径点集合 @@ -40,7 +39,6 @@ useLoad((options) => { Taro.setNavigationBarTitle({ title: options.name, }) - }) const ctx = ref(null) onMounted(() => { @@ -110,12 +108,13 @@ const handleConfirm = () => { const tempPath = res.tempFilePath const ctx = Taro.createCanvasContext('camCacnvs', that) + const scale = 0.5 var targetWidth var targetHeight // 前置图片旋转处理 ___________________________________________________________________ if (direction.value) { - targetWidth = height.value * 0.5 - targetHeight = width.value * 0.5 + targetWidth = height.value * scale + targetHeight = width.value * scale // 计算旋转后的外接矩形尺寸 const angle = (270 * Math.PI) / 180 // 逆时针旋转 270 度 const rotatedWidth = Math.abs(width.value * Math.cos(angle)) + Math.abs(height.value * Math.sin(angle)) @@ -129,8 +128,8 @@ const handleConfirm = () => { ctx.rotate(angle) ctx.drawImage(tempPath, 0, 0, targetHeight, targetWidth) } else { - targetWidth = width.value * 0.5 - targetHeight = height.value * 0.5 + targetWidth = width.value * scale + targetHeight = height.value * scale ctx.drawImage(tempPath, 0, 0, targetWidth, targetHeight) } @@ -172,5 +171,4 @@ const changeDirection = () => { direction.value = !direction.value Taro.vibrateShort({ type: 'medium' }).then() } -