|
|
@@ -282,13 +282,14 @@
|
|
|
* @param configHeight 相机Icon的高度
|
|
|
* @author chauncey
|
|
|
*/
|
|
|
- function dymamicdragBoundFunc(configWidth: number, configHeight: number) {
|
|
|
+ function dymamicdragBoundFunc() {
|
|
|
return function (pos: { x: number; y: number }) {
|
|
|
- const scaleX = this.attrs.scaleX;
|
|
|
- const scaleY = this.attrs.scaleY;
|
|
|
+ // 如果没有发生缩放,则返回的scaleX为undefined,需要设置为默认缩放为1
|
|
|
+ const scaleX = this.attrs.scaleX || 1;
|
|
|
+ const scaleY = this.attrs.scaleY || 1;
|
|
|
+ const rotation = ((this.attrs.rotation || 0) * Math.PI) / 180; // 转换为弧度
|
|
|
const width = cameraIconSize.width;
|
|
|
const height = cameraIconSize.height;
|
|
|
- const rotation = (this.attrs.rotation * Math.PI) / 180; // 转换为弧度
|
|
|
|
|
|
// 计算旋转和缩放后的四个角点相对于左上角的偏移
|
|
|
const points = [
|
|
|
@@ -342,7 +343,7 @@
|
|
|
const row = index % maxColumn;
|
|
|
const x = column * cameraIconSize.width;
|
|
|
const y = row * cameraIconSize.height + 16;
|
|
|
- const dragBoundFunc = dymamicdragBoundFunc(cameraIconSize.width, cameraIconSize.height);
|
|
|
+ const dragBoundFunc = dymamicdragBoundFunc();
|
|
|
return {
|
|
|
x,
|
|
|
y,
|
|
|
@@ -562,13 +563,11 @@
|
|
|
});
|
|
|
}
|
|
|
cameras.value = layout.cameraList.map((camera) => {
|
|
|
- const width = camera.config.width * camera.groupConfig.scaleX;
|
|
|
- const height = camera.config.height * camera.groupConfig.scaleY;
|
|
|
return {
|
|
|
...camera,
|
|
|
groupConfig: {
|
|
|
...camera.groupConfig,
|
|
|
- dragBoundFunc: dymamicdragBoundFunc(width, height),
|
|
|
+ dragBoundFunc: dymamicdragBoundFunc(),
|
|
|
},
|
|
|
};
|
|
|
});
|