Implement moving on engine
Thus make all state management the engine's responsibility, and remove the state maintaining code from frontend!
This commit is contained in:
@@ -160,7 +160,7 @@ export class ConfigVis {
|
||||
this.piecesVis = new Map();
|
||||
}
|
||||
draw(canvas) {
|
||||
for (let [position, piece] of this.configuration.board) {
|
||||
for (let [position, piece] of this.configuration) {
|
||||
if (this.piecesVis.has(position)) {
|
||||
if (this.piecesVis.get(position).piece == piece) {
|
||||
continue;
|
||||
@@ -175,7 +175,7 @@ export class ConfigVis {
|
||||
this.piecesVis.set(position, pv);
|
||||
}
|
||||
for (let [position, pv] of this.piecesVis) {
|
||||
if (!this.configuration.board.has(position)) {
|
||||
if (!this.configuration.has(position)) {
|
||||
pv.undraw();
|
||||
this.piecesVis.delete(position);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user