Showing
1 changed file
with
15 additions
and
2 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-01-22 11:40:12 | 2 | * @Date: 2025-01-22 11:40:12 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-03-05 11:21:28 | 4 | + * @LastEditTime: 2025-03-05 16:10:58 |
| 5 | * @FilePath: /map-demo/src/views/mapCutter.vue | 5 | * @FilePath: /map-demo/src/views/mapCutter.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -421,7 +421,20 @@ const imageRotation = ref(0); | ... | @@ -421,7 +421,20 @@ const imageRotation = ref(0); |
| 421 | const rotateMap = (deltaAngle) => { | 421 | const rotateMap = (deltaAngle) => { |
| 422 | if (!imageLayer.value || !imageURL.value || !bounds.value) return; | 422 | if (!imageLayer.value || !imageURL.value || !bounds.value) return; |
| 423 | 423 | ||
| 424 | - imageRotation.value = (imageRotation.value + deltaAngle) % 360; | 424 | + // 计算新的旋转角度 |
| 425 | + const newRotation = imageRotation.value + deltaAngle; | ||
| 426 | + | ||
| 427 | + // 检查是否超出 -10 到 10 的范围 | ||
| 428 | + if (newRotation > 10 || newRotation < -10) { | ||
| 429 | + ElMessage({ | ||
| 430 | + message: '超过操作范围', | ||
| 431 | + type: 'warning', | ||
| 432 | + plain: true, | ||
| 433 | + }) | ||
| 434 | + return; // 如果超出范围则不执行旋转 | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + imageRotation.value = newRotation; | ||
| 425 | 438 | ||
| 426 | const img = new Image(); | 439 | const img = new Image(); |
| 427 | img.src = imageURL.value; | 440 | img.src = imageURL.value; | ... | ... |
-
Please register or login to post a comment