haojianlong 4 лет назад
Родитель
Сommit
d7d8bb15ab

+ 2 - 2
persagy-web-big-edit/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/big-edit",
-    "version": "2.2.22",
+    "version": "2.2.23",
     "description": "博锐尚格二维图形编辑器。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -40,7 +40,7 @@
         "typescript": "^3.5.3"
     },
     "dependencies": {
-        "@persagy-web/edit": "2.2.20",
+        "@persagy-web/edit": "2.2.21",
         "@types/uuid": "^8.0.0",
         "crypto-js": "^4.0.0",
         "axios": "^0.20.0"

+ 2 - 2
persagy-web-big/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/big",
-    "version": "2.2.43",
+    "version": "2.2.44",
     "description": "博锐尚格建筑信息化库",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -41,7 +41,7 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@persagy-web/graph": "2.2.40",
+        "@persagy-web/graph": "2.2.41",
         "axios": "^0.18.0",
         "pako": "^1.0.10",
         "crypto-js": "^4.0.0",

+ 2 - 2
persagy-web-edit/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/edit",
-    "version": "2.2.20",
+    "version": "2.2.21",
     "description": "博锐尚格二维图形编辑器。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -40,7 +40,7 @@
         "typescript": "^3.5.3"
     },
     "dependencies": {
-        "@persagy-web/big": "2.2.43",
+        "@persagy-web/big": "2.2.44",
         "@types/uuid": "^8.0.0"
     }
 }

+ 3 - 1
persagy-web-graph/README.md

@@ -4,7 +4,9 @@
 
 ### 版本日志
     无特殊说明单版本为跟随依赖版本升级
-
+    |
+    |
+    |-- 2.2.41 解决图片在Edge等浏览器时,e.path 不存在问题
     |
     |
     |-- 2.2.40 解决平面图.拓扑图 iconTextItem 进入编辑态以后,单击图片 item 后,可以进入其他 item 编辑态问题 

+ 1 - 1
persagy-web-graph/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/graph",
-    "version": "2.2.40",
+    "version": "2.2.41",
     "description": "博锐尚格二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 45 - 13
persagy-web-graph/src/items/SImageItem.ts

@@ -106,30 +106,62 @@ export class SImageItem extends SObjectItem {
     set url(v: string) {
         this._url = v;
         this.img = new Image();
+        // Edge 获取不到e.path
         this.img.onload = (e): void => {
-            // @ts-ignore
-            const imgSrc = e.path[0].src;
-          /**
-             * 需要解决两个问题,此方法仅用
-             * 1 需要把 imgSrc 做转意;
-             * 2 添加兼容 Ios 方法(e.path[0].src在 ios无此属性)
-             */
-            // if (this.isUrlIdentical(imgSrc)) {
+            const isiOS = !!navigator.userAgent.match(
+                /\(i[^;]+;( U;)? CPU.+Mac OS X/
+            ); //ios终端
+            try {
+                if (isiOS) {
+                    this.isLoadOver = true;
+                    this.computeImgSize();
+                    this.$emit("imgLoadOver");
+                    this.update();
+                } else {
+                    // @ts-ignore
+                    const imgSrc = e.path[0].src;
+                    if (this.isUrlIdentical(imgSrc)) {
+                        this.isLoadOver = true;
+                        this.computeImgSize();
+                        this.$emit("imgLoadOver");
+                        this.update();
+                    }
+                }
+            } catch (e) {
+                console.log(e);
+            } finally {
                 this.isLoadOver = true;
                 this.computeImgSize();
                 this.$emit("imgLoadOver");
                 this.update();
-            // }
+            }
         };
         this.img.onerror = (e): void => {
-            // @ts-ignore
-            const imgSrc = e.path[0].src;
-            if (this.isUrlIdentical(imgSrc)) {
+            try {
+                const isiOS = !!navigator.userAgent.match(
+                    /\(i[^;]+;( U;)? CPU.+Mac OS X/
+                ); //ios终端
+                if (isiOS) {
+                    this.isLoadOver = false;
+                    this.$emit("imgLoadOver");
+                    this.update();
+                } else {
+                    // @ts-ignore
+                    const imgSrc = e.path[0].src;
+                    if (this.isUrlIdentical(imgSrc)) {
+                        this.isLoadOver = false;
+                        this.$emit("imgLoadOver");
+                        this.update();
+                    }
+                }
+            } catch (e) {
+                console.log(e);
+            } finally {
                 this.isLoadOver = false;
                 this.$emit("imgLoadOver");
                 this.update();
-                console.log("加载图片错误!", e);
             }
+            console.log("加载图片错误!", e);
         };
         this.img.src = v;
     }