Limit screen updates to once every 30ms and only if needed.
This commit is contained in:
@ -284,6 +284,11 @@ namespace pxsim.visuals {
|
||||
this.updateState();
|
||||
this.attachEvents();
|
||||
}
|
||||
|
||||
let board = this;
|
||||
window.setInterval(function(){
|
||||
board.updateScreen();
|
||||
}, 30);
|
||||
}
|
||||
|
||||
public getView(): SVGAndSize<SVGSVGElement> {
|
||||
@ -459,6 +464,9 @@ namespace pxsim.visuals {
|
||||
let state = this.board;
|
||||
if (!state || !state.screenState) return;
|
||||
|
||||
if (!state.screenState.shouldUpdate) return;
|
||||
state.screenState.shouldUpdate = false;
|
||||
|
||||
this.screenCanvasData = this.screenCanvasCtx.getImageData(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
Object.keys(state.screenState.points).forEach(xStr => {
|
||||
|
Reference in New Issue
Block a user