hookehuyr

fix 图片旋转时添加节流控制变量

......@@ -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);
};
};
......