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:28:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a6e7501b19231ff61129e29f3a0beb1b637478fe
a6e7501b
1 parent
05384b77
fix 图片旋转时添加节流控制变量
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
src/views/mapCutter.vue
src/views/mapCutter.vue
View file @
a6e7501
...
...
@@ -418,7 +418,12 @@ const scaleImage = (factor) => {
const imageRotation = ref(0);
// 修改 rotateMap 方法,只旋转图片
// 添加节流控制变量
const isRotating = ref(false);
const rotateMap = (deltaAngle) => {
// 如果正在旋转中,直接返回
if (isRotating.value) return;
if (!imageLayer.value || !imageURL.value || !bounds.value) return;
// 计算新的旋转角度
...
...
@@ -434,6 +439,9 @@ const rotateMap = (deltaAngle) => {
return; // 如果超出范围则不执行旋转
}
// 设置正在旋转标志
isRotating.value = true;
imageRotation.value = newRotation;
const img = new Image();
...
...
@@ -508,6 +516,11 @@ const rotateMap = (deltaAngle) => {
map.value.add(imageLayer.value);
bounds.value = newBounds;
// 1秒后重置旋转状态
setTimeout(() => {
isRotating.value = false;
}, 1000);
};
};
...
...
Please
register
or
login
to post a comment