linting and formating

This commit is contained in:
2022-12-02 17:11:34 +01:00
parent 2924994e7e
commit e4f433887b
9 changed files with 66 additions and 62 deletions

View File

@ -9,7 +9,7 @@
</main>
</template>
<script>
import { mapActions, mapState, mapWritableState } from 'pinia'
import { mapActions, mapState, mapWritableState } from "pinia";
import { globalStore } from "../stores/index.js";
import {
create1dState,
@ -71,8 +71,8 @@
mounted() {
this.canvas = Object.freeze(document.getElementById("canvas-board"));
this.ctx = this.canvas.getContext("2d");
this.canvasWidth = this.canvas.parentElement.clientWidth
this.canvasHeight = this.canvas.parentElement.clientHeight
this.canvasWidth = this.canvas.parentElement.clientWidth;
this.canvasHeight = this.canvas.parentElement.clientHeight;
},
methods: {
...mapActions(globalStore, ["toggleStop"]),
@ -104,9 +104,9 @@
this.rules.rules,
this.boardWidth
);
this.lastBoard = Object.freeze(board)
this.lastBoard = Object.freeze(board);
this.drawCanvas(board);
this.toggleStop()
this.toggleStop();
},
draw2d(board) {
if (!this.canDraw) return;
@ -127,17 +127,16 @@
[0, 2]
);
const board = evolve2d(initialState, conwayRules);
this.lastBoard = Object.freeze(board)
this.lastBoard = Object.freeze(board);
this.draw2d(board);
},
async draw2dLast() {
if (this.lastBoard != undefined)
this.draw2d(this.lastBoard);
if (this.lastBoard != undefined) this.draw2d(this.lastBoard);
},
reset() {
this.toggleStop()
this.toggleStop();
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.getReset = 0
this.getReset = 0;
},
},
};