修改代码

This commit is contained in:
zyy 2019-07-18 18:25:57 +08:00
parent 3a0e467221
commit a72feee896

View File

@ -59,25 +59,25 @@ class Jmap {
}
loadData(data) {
// 保存皮肤类型
// 保存皮肤code
this.skinStyle = data.skinVO.code;
// 保存原始数据
this.data = data;
// 加载皮肤
// 加载对应皮肤
this.styleDict = this.loadStyle(this.skinStyle);
// 解析地图数据
this.mapDevice = parser(data, this);
// 数据加载完成
// 数据加载完成 回调
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(); }
// 初次渲染视图
this.$painter.repaint(this.mapDevice, this.styleDict);
this.$painter.repaint(this.mapDevice);
// 视图加载完成
// 视图加载完成 回调
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(); }
}
@ -162,10 +162,10 @@ class Jmap {
update(list) {
(list || []).forEach(elem => {
const code = elem.code;
const oDevice = this.mapDevice[code] || {};
if (elem._dispose) {
delete this.mapDevice[code];
this.$painter.delete(oDevice);
} else {
const oDevice = this.mapDevice[code] || {};
const state = Object.assign(oDevice.state || {}, elem);
const nDevice = Object.assign(oDevice, { state });
this.mapDevice[code] = nDevice;