|
@@ -22,6 +22,10 @@ export default class Warehouse extends ThingInner {
|
|
|
this.isWarehouse = true;
|
|
this.isWarehouse = true;
|
|
|
this.isFocused = false;
|
|
this.isFocused = false;
|
|
|
this.shelves = [];
|
|
this.shelves = [];
|
|
|
|
|
+ // 项目传参相关修改开始
|
|
|
|
|
+ // 记录是否已经向外层页面发送过进入事件,避免离开事件重复发送。
|
|
|
|
|
+ this.hasNotifiedParentEntered = false;
|
|
|
|
|
+ // 项目传参修改相关结束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
afterInstantiation() {
|
|
afterInstantiation() {
|
|
@@ -43,9 +47,21 @@ export default class Warehouse extends ThingInner {
|
|
|
storeCore().focusedWarehouse = null;
|
|
storeCore().focusedWarehouse = null;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- this.addEventListener(ThingEvents.Dblclick, () => {
|
|
|
|
|
- !this.isFocused ? this.focus() : this.blur();
|
|
|
|
|
|
|
+ // 项目传参修改之前旧代码开始
|
|
|
|
|
+ // this.addEventListener(ThingEvents.Dblclick, () => {
|
|
|
|
|
+ // !this.isFocused ? this.focus() : this.blur();
|
|
|
|
|
+ // });
|
|
|
|
|
+ // 项目传参修改之前旧代码结束
|
|
|
|
|
+
|
|
|
|
|
+ // 项目传参相关修改开始
|
|
|
|
|
+ this.addEventListener(ThingEvents.Dblclick, async () => {
|
|
|
|
|
+ if(!this.isFocused) {
|
|
|
|
|
+ await this.focus(false, "user");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ await this.blur(true, "user");
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ // 项目传参修改相关结束
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
createLabel() {
|
|
createLabel() {
|
|
@@ -73,10 +89,31 @@ export default class Warehouse extends ThingInner {
|
|
|
this.shelves.forEach(shelf => shelf.warehouse = this);
|
|
this.shelves.forEach(shelf => shelf.warehouse = this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async focus(immediate = false) {
|
|
|
|
|
|
|
+ // 项目传参修改之前旧代码开始
|
|
|
|
|
+ // async focus(immediate = false) {
|
|
|
|
|
+ // const { qt } = this;
|
|
|
|
|
+ // this.isFocused = true;
|
|
|
|
|
+ // qt.areaGlobal.warehouses.forEach(warehouse => warehouse !== this && warehouse.isFocused && warehouse.blur(false));
|
|
|
|
|
+ // qt.effectOutline.delete(this.o3);
|
|
|
|
|
+ // qt.areaGlobal.hideRoof();
|
|
|
|
|
+ // this.sleep();
|
|
|
|
|
+ // this.shelves.forEach(shelf => shelf.wakeUp());
|
|
|
|
|
+ // storeCore().focusedWarehouse = {
|
|
|
|
|
+ // wgAreaId: this.extData.wgAreaId,
|
|
|
|
|
+ // wgWarehouseName: this.extData.wgWarehouseName
|
|
|
|
|
+ // };
|
|
|
|
|
+ // await this.flyToMe(immediate);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // 项目传参修改之前旧代码结束
|
|
|
|
|
+
|
|
|
|
|
+ // 项目传参相关修改开始
|
|
|
|
|
+ async focus(immediate = false, trigger = "user") {
|
|
|
|
|
+ if(this.isFocused) return;
|
|
|
const { qt } = this;
|
|
const { qt } = this;
|
|
|
this.isFocused = true;
|
|
this.isFocused = true;
|
|
|
- qt.areaGlobal.warehouses.forEach(warehouse => warehouse !== this && warehouse.isFocused && warehouse.blur(false));
|
|
|
|
|
|
|
+ qt.areaGlobal.warehouses.forEach(warehouse => {
|
|
|
|
|
+ warehouse !== this && warehouse.isFocused && warehouse.blur(false, "switch");
|
|
|
|
|
+ });
|
|
|
qt.effectOutline.delete(this.o3);
|
|
qt.effectOutline.delete(this.o3);
|
|
|
qt.areaGlobal.hideRoof();
|
|
qt.areaGlobal.hideRoof();
|
|
|
this.sleep();
|
|
this.sleep();
|
|
@@ -85,16 +122,36 @@ export default class Warehouse extends ThingInner {
|
|
|
wgAreaId: this.extData.wgAreaId,
|
|
wgAreaId: this.extData.wgAreaId,
|
|
|
wgWarehouseName: this.extData.wgWarehouseName
|
|
wgWarehouseName: this.extData.wgWarehouseName
|
|
|
};
|
|
};
|
|
|
|
|
+ this.notifyParentState("GIS_WAREHOUSE_ENTER", trigger);
|
|
|
await this.flyToMe(immediate);
|
|
await this.flyToMe(immediate);
|
|
|
}
|
|
}
|
|
|
|
|
+ // 项目传参修改相关结束
|
|
|
|
|
|
|
|
async flyToMe(immediate = false) {
|
|
async flyToMe(immediate = false) {
|
|
|
return super.flyToMe(new Vector3(0, 20, 2), new Vector3(), immediate);
|
|
return super.flyToMe(new Vector3(0, 20, 2), new Vector3(), immediate);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async blur(enableFlyToDefaultPerspective = true) {
|
|
|
|
|
|
|
+ // 项目传参修改之前旧代码开始
|
|
|
|
|
+ // async blur(enableFlyToDefaultPerspective = true) {
|
|
|
|
|
+ // const { qt } = this;
|
|
|
|
|
+ // this.isFocused = false;
|
|
|
|
|
+ // this.shelves.forEach(shelf => shelf.sleep());
|
|
|
|
|
+ // this.wakeUp();
|
|
|
|
|
+ // const targetFocusedShelf = this.shelves.find(shelf => shelf.isFocused);
|
|
|
|
|
+ // targetFocusedShelf && targetFocusedShelf.blur(false);
|
|
|
|
|
+ // if(enableFlyToDefaultPerspective) {
|
|
|
|
|
+ // qt.areaGlobal.showRoof();
|
|
|
|
|
+ // await qt.flyToDefaultPerspective();
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // 项目传参修改之前旧代码结束
|
|
|
|
|
+
|
|
|
|
|
+ // 项目传参相关修改开始
|
|
|
|
|
+ async blur(enableFlyToDefaultPerspective = true, trigger = "back") {
|
|
|
|
|
+ if(!this.isFocused) return;
|
|
|
const { qt } = this;
|
|
const { qt } = this;
|
|
|
this.isFocused = false;
|
|
this.isFocused = false;
|
|
|
|
|
+ this.notifyParentState("GIS_WAREHOUSE_LEAVE", trigger);
|
|
|
this.shelves.forEach(shelf => shelf.sleep());
|
|
this.shelves.forEach(shelf => shelf.sleep());
|
|
|
this.wakeUp();
|
|
this.wakeUp();
|
|
|
const targetFocusedShelf = this.shelves.find(shelf => shelf.isFocused);
|
|
const targetFocusedShelf = this.shelves.find(shelf => shelf.isFocused);
|
|
@@ -105,6 +162,30 @@ export default class Warehouse extends ThingInner {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ notifyParentState(type, trigger) {
|
|
|
|
|
+ const isEnter = type === "GIS_WAREHOUSE_ENTER";
|
|
|
|
|
+ if(isEnter && this.hasNotifiedParentEntered) return;
|
|
|
|
|
+ if(!isEnter && !this.hasNotifiedParentEntered) return;
|
|
|
|
|
+ this.hasNotifiedParentEntered = isEnter;
|
|
|
|
|
+ if(window.parent === window) return;
|
|
|
|
|
+ const warehouseIndex = this.qt.areaGlobal.warehouses.indexOf(this);
|
|
|
|
|
+ window.parent.postMessage(
|
|
|
|
|
+ {
|
|
|
|
|
+ source: "warehouse-gis",
|
|
|
|
|
+ type,
|
|
|
|
|
+ data: {
|
|
|
|
|
+ areaId: this.extData.wgAreaId,
|
|
|
|
|
+ areaName: this.extData.wgAreaName,
|
|
|
|
|
+ warehouseName: this.extData.wgWarehouseName,
|
|
|
|
|
+ warehouseIndex,
|
|
|
|
|
+ trigger
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ window.gisParentOrigin || "*"
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ // 项目传参修改相关结束
|
|
|
|
|
+
|
|
|
hasFocusedWarehouse() {
|
|
hasFocusedWarehouse() {
|
|
|
return this.qt.areaGlobal.warehouses.some(warehouse => warehouse.isFocused);
|
|
return this.qt.areaGlobal.warehouses.some(warehouse => warehouse.isFocused);
|
|
|
}
|
|
}
|
|
@@ -115,4 +196,4 @@ export default class Warehouse extends ThingInner {
|
|
|
!this.label.isDestroyed && this.label.destroy();
|
|
!this.label.isDestroyed && this.label.destroy();
|
|
|
return super.destroy(force);
|
|
return super.destroy(force);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|