|
@@ -159,34 +159,35 @@ export default {
|
|
|
let maxWidth = MaxWidth;
|
|
|
// 显示时 初始 最大高度
|
|
|
let maxHeight = MaxHeight;
|
|
|
+ const path = e.path || (e.composedPath && e.composedPath());
|
|
|
if (
|
|
|
- e.path[0].naturalWidth <= maxWidth &&
|
|
|
- e.path[0].naturalHeight <= maxHeight
|
|
|
+ path[0].naturalWidth <= maxWidth &&
|
|
|
+ path[0].naturalHeight <= maxHeight
|
|
|
) {
|
|
|
- _this[StrWidth] = e.path[0].naturalWidth + "px";
|
|
|
- _this[StrHeight] = e.path[0].naturalHeight + "px";
|
|
|
+ _this[StrWidth] = path[0].naturalWidth + "px";
|
|
|
+ _this[StrHeight] = path[0].naturalHeight + "px";
|
|
|
} else {
|
|
|
- _this[StrWidth] = e.path[0].naturalWidth + "px";
|
|
|
- _this[StrHeight] = e.path[0].naturalHeight + "px";
|
|
|
+ _this[StrWidth] = path[0].naturalWidth + "px";
|
|
|
+ _this[StrHeight] = path[0].naturalHeight + "px";
|
|
|
if (
|
|
|
- e.path[0].naturalWidth > maxWidth &&
|
|
|
- e.path[0].naturalHeight <= maxHeight
|
|
|
+ path[0].naturalWidth > maxWidth &&
|
|
|
+ path[0].naturalHeight <= maxHeight
|
|
|
) {
|
|
|
- let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
|
|
|
+ let ratio = path[0].naturalWidth / path[0].naturalHeight;
|
|
|
_this[StrWidth] = "1600px";
|
|
|
_this[StrHeight] = maxWidth / ratio + "px";
|
|
|
} else if (
|
|
|
- e.path[0].naturalWidth <= maxWidth &&
|
|
|
- e.path[0].naturalHeight > maxHeight
|
|
|
+ path[0].naturalWidth <= maxWidth &&
|
|
|
+ path[0].naturalHeight > maxHeight
|
|
|
) {
|
|
|
- let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
|
|
|
+ let ratio = path[0].naturalWidth / path[0].naturalHeight;
|
|
|
_this[StrWidth] = maxHeight * ratio + "px";
|
|
|
_this[StrHeight] = "800px";
|
|
|
} else if (
|
|
|
- e.path[0].naturalWidth > maxWidth &&
|
|
|
- e.path[0].naturalHeight > maxHeight
|
|
|
+ path[0].naturalWidth > maxWidth &&
|
|
|
+ path[0].naturalHeight > maxHeight
|
|
|
) {
|
|
|
- let ratio = e.path[0].naturalWidth / e.path[0].naturalHeight;
|
|
|
+ let ratio = path[0].naturalWidth / path[0].naturalHeight;
|
|
|
let w = maxWidth;
|
|
|
let h = w / ratio;
|
|
|
if (h > maxHeight) {
|
|
@@ -260,7 +261,8 @@ export default {
|
|
|
var oldHeight = this.offsetHeight;
|
|
|
var oldLeft = this.offsetLeft;
|
|
|
var oldTop = this.offsetTop;
|
|
|
- var parent = oEvent.path[2];
|
|
|
+ const path = oEvent.path || (oEvent.composedPath && oEvent.composedPath());
|
|
|
+ var parent = path[2];
|
|
|
// 获取父元素距离页面可视区域的位置
|
|
|
var parentLeft = parent.getBoundingClientRect().left;
|
|
|
var parentTop = parent.getBoundingClientRect().top;
|
|
@@ -361,8 +363,9 @@ export default {
|
|
|
isdrag = true;
|
|
|
oDragObj = oDragHandle;
|
|
|
// 父元素宽高
|
|
|
- let width = e.path[2].offsetWidth;
|
|
|
- let height = e.path[2].offsetHeight;
|
|
|
+ const path = e.path || (e.composedPath && e.composedPath());
|
|
|
+ let width = path[2].offsetWidth;
|
|
|
+ let height = path[2].offsetHeight;
|
|
|
// 这里判断第一次获取不到style 样式 默认为 居中50%
|
|
|
if (oDragObj.style.top == "") {
|
|
|
nTY = 0;
|
|
@@ -418,9 +421,9 @@ export default {
|
|
|
if (isdrag) {
|
|
|
this.equipmentKey = key;
|
|
|
// console.log("thisequipmentKey", this.equipmentKey);
|
|
|
-
|
|
|
- let widthItem = e.path[1].style.width.split("p");
|
|
|
- let heightItem = e.path[1].style.height.split("p");
|
|
|
+ const path = e.path || (e.composedPath && e.composedPath());
|
|
|
+ let widthItem = path[1].style.width.split("p");
|
|
|
+ let heightItem = path[1].style.height.split("p");
|
|
|
let width = widthItem[0];
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
let height = heightItem[0];
|
|
@@ -464,7 +467,8 @@ export default {
|
|
|
isdrag = true;
|
|
|
oDragObj = oDragHandle;
|
|
|
// 父元素宽高
|
|
|
- let width = e.path[1].offsetWidth;
|
|
|
+ const path = e.path || (e.composedPath && e.composedPath());
|
|
|
+ let width = path[1].offsetWidth;
|
|
|
// let height = e.path[1].offsetHeight;
|
|
|
// console.log(width, height);
|
|
|
// console.log("oDragObj.style", oDragObj.style);
|