调整接收到服务端图形对象状态消息后的更新逻辑:先更新数据,再统一重绘
This commit is contained in:
parent
3612e0fc16
commit
34c9255f43
@ -543,9 +543,14 @@ export class GraphicApp extends EventEmitter<GraphicAppEvents> {
|
||||
g.loadState(state);
|
||||
this.addGraphics(g);
|
||||
} else {
|
||||
list.forEach((g) => {
|
||||
g.updateStates(state);
|
||||
});
|
||||
// 调整逻辑:所有图形对象状态数据更新完后再统一重绘
|
||||
list
|
||||
.filter((g) => {
|
||||
return g.updateStates(state);
|
||||
})
|
||||
.forEach((g) => {
|
||||
g.repaint();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ export abstract class JlGraphic extends Container {
|
||||
this.onStateChange(state, old);
|
||||
stateChange = true;
|
||||
this.emit('stateupdate', this.getStates(), old);
|
||||
this.repaint();
|
||||
// this.repaint();
|
||||
}
|
||||
return stateChange;
|
||||
}
|
||||
@ -912,8 +912,12 @@ export abstract class JlGraphic extends Container {
|
||||
onStateChange(newVal: GraphicState, old?: GraphicState): void {}
|
||||
|
||||
repaint(): void {
|
||||
this.doRepaint();
|
||||
this.emit('repaint', this);
|
||||
try {
|
||||
this.doRepaint();
|
||||
this.emit('repaint', this);
|
||||
} catch (e) {
|
||||
console.error(`设备id=${this.id},type=${this.type}重绘逻辑异常`, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user