Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
map-demo
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-03-05 16:11:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
05384b77335e2ee022dc9ed178045a80ff6de30d
05384b77
1 parent
b4d9901f
fix 控制图片旋转角度范围,避免多次旋转拉伸过于严重
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
src/views/mapCutter.vue
src/views/mapCutter.vue
View file @
05384b7
<!--
* @Date: 2025-01-22 11:40:12
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-03-05 1
1:21:2
8
* @LastEditTime: 2025-03-05 1
6:10:5
8
* @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;
...
...
Please
register
or
login
to post a comment