Переглянути джерело

增加解析底图为图片的方法;更新底层版本

haojianlong 4 роки тому
батько
коміт
0769e749dc
5 змінених файлів з 21 додано та 1297 видалено
  1. 0 1291
      package-lock.json
  2. 4 4
      package.json
  3. 5 2
      src/FloorScene.ts
  4. 3 0
      src/LocationPointScene.ts
  5. 9 0
      src/items/SImageItem.ts

Різницю між файлами не показано, бо вона завелика
+ 0 - 1291
package-lock.json


+ 4 - 4
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.566",
+    "version": "2.0.568",
     "description": "上格云 CAD图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -31,9 +31,9 @@
         "typescript": "^3.5.3"
     },
     "dependencies": {
-        "@saga-web/base": "2.1.9",
-        "@saga-web/draw": "2.1.80",
-        "@saga-web/graphy": "2.1.52",
+        "@saga-web/base": "2.1.27",
+        "@saga-web/draw": "2.1.108",
+        "@saga-web/graph": "2.1.127",
         "axios": "^0.18.0",
         "pako": "^1.0.10",
         "poly-decomp": "^0.3.0",

+ 5 - 2
src/FloorScene.ts

@@ -35,8 +35,8 @@ import { ColumnItem } from "./items/ColumnItem";
 import { VirtualWallItem } from "./items/VirtualWallItem";
 import { DoorItem } from "./items/DoorItem";
 import { WindowItem } from "./items/WindowItem";
-import {SImageItem} from "./items/SImageItem";
-import {SImageShowType} from "./enums/SImageShowType";
+import { SImageItem } from "./items/SImageItem";
+import { SImageShowType } from "./enums/SImageShowType";
 
 /**
  * 楼层场景
@@ -186,6 +186,8 @@ export class FloorScene extends SGraphyScene {
     virtualWallList: VirtualWallItem[] = [];
     /** 空间list   */
     spaceList: SpaceItem[] = [];
+    /** 底图为图片   */
+    imgList: SImageItem[] = [];
 
     /**
      *  构造函数
@@ -239,6 +241,7 @@ export class FloorScene extends SGraphyScene {
             _fn(imgItem);
         });
         this.addItem(imgItem);
+        this.imgList.push(imgItem);
     } // Function loadImg()
 
     /**

+ 3 - 0
src/LocationPointScene.ts

@@ -100,5 +100,8 @@ export class LocationPointScene extends FloorScene {
         this.spaceList.map(m => {
             m.connect("click", _this, fn);
         });
+        this.imgList.map(m => {
+            m.connect("click", _this, fn);
+        });
     } // Function spaceClick()
 } // Class LocationPointScene

+ 9 - 0
src/items/SImageItem.ts

@@ -2,6 +2,7 @@ import { SPainter, SRect, SSize, SColor, SPoint } from "@saga-web/draw/lib";
 import { SImageShowType, STextOrigin } from "..";
 import { SObjectItem } from "./SObjectItem";
 import { SGraphyItem } from "@saga-web/graphy/lib";
+import { SMouseEvent } from "@saga-web/base/lib";
 
 /**
  * 图片item
@@ -155,6 +156,14 @@ export class SImageItem extends SObjectItem {
     } // Function computeImgSize()
 
     /**
+     * 鼠标事件
+     * */
+    onMouseDown(event: SMouseEvent): boolean {
+        this.$emit("click", event);
+        return true;
+    } // onMouseDown()
+
+    /**
      * 判断当前地址和回调地址是否相同
      * @param   imgUrl      图片回调地址
      *