|
@@ -19,11 +19,12 @@
|
|
|
*/
|
|
|
|
|
|
import { FloorScene } from "./FloorScene";
|
|
|
-import { SColor, SPoint, SRect } from "@sybotan-web/draw/lib";
|
|
|
+import { SPoint } from "@sybotan-web/draw/lib";
|
|
|
import { SceneMarkItem } from "./items/SceneMarkItem";
|
|
|
import { ZoneItem } from "./items/ZoneItem";
|
|
|
import { Zone } from "./types/Zone";
|
|
|
import { SMouseEvent } from "@sybotan-web/base/lib";
|
|
|
+import { SGraphyItem } from "@sybotan-web/graphy/lib";
|
|
|
|
|
|
/**
|
|
|
* 划分业务空间
|
|
@@ -43,8 +44,25 @@ export class DivideFloorScene extends FloorScene {
|
|
|
this._isMarking = v;
|
|
|
} // Set isMarking
|
|
|
|
|
|
+ /** 蒙版item */
|
|
|
+ sceneMark: SGraphyItem | null = null;
|
|
|
/** 业务空间list */
|
|
|
zoneList: ZoneItem[] = [];
|
|
|
+ /** 业务空间是否可选 */
|
|
|
+ _isZoneSelectable: boolean = true;
|
|
|
+ get isZoneSelectable(): boolean {
|
|
|
+ return this._isZoneSelectable;
|
|
|
+ } // Get isSpaceSelectable
|
|
|
+ set isZoneSelectable(v: boolean) {
|
|
|
+ if (this._isZoneSelectable === v) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._isZoneSelectable = v;
|
|
|
+ this.zoneList.map((t: ZoneItem) => {
|
|
|
+ t.selectable = this._isZoneSelectable;
|
|
|
+ return t;
|
|
|
+ });
|
|
|
+ } // Set isZoneSelectable
|
|
|
|
|
|
/**
|
|
|
* 构造函数
|
|
@@ -64,7 +82,7 @@ export class DivideFloorScene extends FloorScene {
|
|
|
if (data.length) {
|
|
|
let sceneMark = new SceneMarkItem(null, data);
|
|
|
this.addItem(sceneMark);
|
|
|
- this.grabItem = sceneMark;
|
|
|
+ this.sceneMark = sceneMark;
|
|
|
}
|
|
|
} // Function addSceneMark
|
|
|
|
|
@@ -73,27 +91,29 @@ export class DivideFloorScene extends FloorScene {
|
|
|
*
|
|
|
*/
|
|
|
clearSceneMark(): void {
|
|
|
- if (this.grabItem) {
|
|
|
- this.removeItem(this.grabItem);
|
|
|
+ if (this.sceneMark) {
|
|
|
this.grabItem = null;
|
|
|
+ this.removeItem(this.sceneMark);
|
|
|
+ this.sceneMark = null;
|
|
|
this.isMarking = false;
|
|
|
}
|
|
|
} // Function clearSceneMark()
|
|
|
|
|
|
/**
|
|
|
- * 点击事件
|
|
|
+ * 鼠标按下事件
|
|
|
*
|
|
|
* @param event 保存事件参数
|
|
|
* @return boolean
|
|
|
*/
|
|
|
onMouseDown(event: SMouseEvent): boolean {
|
|
|
if (this.isMarking && event.buttons == 1) {
|
|
|
- if (this.grabItem) {
|
|
|
- this.grabItem.onMouseDown(event);
|
|
|
+ if (this.sceneMark) {
|
|
|
+ this.sceneMark.onMouseDown(event);
|
|
|
} else {
|
|
|
let point = new SPoint(event.x, event.y);
|
|
|
let sceneMark = new SceneMarkItem(null, point);
|
|
|
this.addItem(sceneMark);
|
|
|
+ this.sceneMark = sceneMark;
|
|
|
this.grabItem = sceneMark;
|
|
|
}
|
|
|
} else {
|
|
@@ -102,6 +122,16 @@ export class DivideFloorScene extends FloorScene {
|
|
|
return false;
|
|
|
} // Function onMouseDown()
|
|
|
|
|
|
+ /**
|
|
|
+ * 鼠标抬起事件
|
|
|
+ *
|
|
|
+ * @param event 保存事件参数
|
|
|
+ * @return boolean
|
|
|
+ */
|
|
|
+ onMouseUp(event: SMouseEvent): boolean {
|
|
|
+ return false;
|
|
|
+ } // Function onMouseUp()
|
|
|
+
|
|
|
/***
|
|
|
* 键盘按下事件
|
|
|
*
|
|
@@ -150,8 +180,44 @@ export class DivideFloorScene extends FloorScene {
|
|
|
*/
|
|
|
addZone(zone: Zone): void {
|
|
|
let item = new ZoneItem(null, zone);
|
|
|
- item.zOrder = 3;
|
|
|
+ item.zOrder = 10;
|
|
|
+ item.selectable = this.isZoneSelectable;
|
|
|
this.zoneList.push(item);
|
|
|
this.addItem(item);
|
|
|
} // Function addZone
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置空间是否可选
|
|
|
+ *
|
|
|
+ */
|
|
|
+ setSpaceSelectable(selectable: boolean): void {
|
|
|
+ this.spaceList.map(sp => {
|
|
|
+ sp.selectable = selectable;
|
|
|
+ return sp;
|
|
|
+ });
|
|
|
+ } // Function setSpaceSelectable
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置业务空间是否可选
|
|
|
+ *
|
|
|
+ */
|
|
|
+ setZoneSelectable(selectable: boolean): void {
|
|
|
+ this.zoneList.map(zone => {
|
|
|
+ zone.selectable = selectable;
|
|
|
+ return zone;
|
|
|
+ });
|
|
|
+ } // Function setZoneSelectable
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 切换业务空间
|
|
|
+ *
|
|
|
+ */
|
|
|
+ changeSelectZone(zoneitem: ZoneItem): void {
|
|
|
+ this.zoneList.map(zone => {
|
|
|
+ zone.selected = false;
|
|
|
+ zone.unselectFlag = true;
|
|
|
+ return zone;
|
|
|
+ });
|
|
|
+ zoneitem.visible = false;
|
|
|
+ } // Function changeSelectZone
|
|
|
} // Class DivideFloorScene
|