hookehuyr

fix 控制图片旋转角度范围,避免多次旋转拉伸过于严重

<!--
* @Date: 2025-01-22 11:40:12
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-05 11:21:28
* @LastEditTime: 2025-03-05 16:10:58
* @FilePath: /map-demo/src/views/mapCutter.vue
* @Description: 文件描述
-->
......@@ -421,7 +421,20 @@ const imageRotation = ref(0);
const rotateMap = (deltaAngle) => {
if (!imageLayer.value || !imageURL.value || !bounds.value) return;
imageRotation.value = (imageRotation.value + deltaAngle) % 360;
// 计算新的旋转角度
const newRotation = imageRotation.value + deltaAngle;
// 检查是否超出 -10 到 10 的范围
if (newRotation > 10 || newRotation < -10) {
ElMessage({
message: '超过操作范围',
type: 'warning',
plain: true,
})
return; // 如果超出范围则不执行旋转
}
imageRotation.value = newRotation;
const img = new Image();
img.src = imageURL.value;
......