修改代码
This commit is contained in:
parent
3a0e467221
commit
a72feee896
@ -59,25 +59,25 @@ class Jmap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadData(data) {
|
loadData(data) {
|
||||||
// 保存皮肤类型
|
// 保存皮肤code
|
||||||
this.skinStyle = data.skinVO.code;
|
this.skinStyle = data.skinVO.code;
|
||||||
|
|
||||||
// 保存原始数据
|
// 保存原始数据
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
||||||
// 加载皮肤
|
// 加载对应皮肤
|
||||||
this.styleDict = this.loadStyle(this.skinStyle);
|
this.styleDict = this.loadStyle(this.skinStyle);
|
||||||
|
|
||||||
// 解析地图数据
|
// 解析地图数据
|
||||||
this.mapDevice = parser(data, this);
|
this.mapDevice = parser(data, this);
|
||||||
|
|
||||||
// 数据加载完成
|
// 数据加载完成 回调
|
||||||
if (this.methods.dataLoaded instanceof Function) { this.methods.dataLoaded(); }
|
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(); }
|
if (this.methods.viewLoaded instanceof Function) { this.methods.viewLoaded(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,10 +162,10 @@ class Jmap {
|
|||||||
update(list) {
|
update(list) {
|
||||||
(list || []).forEach(elem => {
|
(list || []).forEach(elem => {
|
||||||
const code = elem.code;
|
const code = elem.code;
|
||||||
|
const oDevice = this.mapDevice[code] || {};
|
||||||
if (elem._dispose) {
|
if (elem._dispose) {
|
||||||
delete this.mapDevice[code];
|
this.$painter.delete(oDevice);
|
||||||
} else {
|
} else {
|
||||||
const oDevice = this.mapDevice[code] || {};
|
|
||||||
const state = Object.assign(oDevice.state || {}, elem);
|
const state = Object.assign(oDevice.state || {}, elem);
|
||||||
const nDevice = Object.assign(oDevice, { state });
|
const nDevice = Object.assign(oDevice, { state });
|
||||||
this.mapDevice[code] = nDevice;
|
this.mapDevice[code] = nDevice;
|
||||||
|
Loading…
Reference in New Issue
Block a user