Selaa lähdekoodia

ios图片问题

haojianlong 4 vuotta sitten
vanhempi
commit
577f99c45a

+ 1 - 3
saga-web-big/src/items/SIconTextItem.ts

@@ -274,9 +274,7 @@ export class SIconTextItem extends SObjectItem {
      * @param   oldSize 改之前的大小
      * @param   newSize 改之后大小
      * */
-    onResize(oldSize: SSize, newSize: SSize) {
-        console.log(arguments);
-    } // Function onResize()
+    onResize(oldSize: SSize, newSize: SSize) {} // Function onResize()
 
     /**
      * 鼠标双击事件

+ 13 - 3
saga-web-graph/src/items/SImageItem.ts

@@ -71,13 +71,23 @@ export class SImageItem extends SObjectItem {
         this._url = v;
         this.img = new Image();
         this.img.onload = (e): void => {
-            // @ts-ignore
-            const imgSrc = e.path[0].src;
-            if (this.isUrlIdentical(imgSrc)) {
+            const isiOS = !!navigator.userAgent.match(
+                /\(i[^;]+;( U;)? CPU.+Mac OS X/
+            ); //ios终端
+            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();
+                }
             }
         };
         this.img.onerror = (e): void => {