test load picture on canvas
This commit is contained in:
@ -38,8 +38,10 @@
|
||||
getDraw1d: "draw1d",
|
||||
getDraw2d: "draw2d",
|
||||
getDraw2dLast: "draw2dLast",
|
||||
getDraw2dPicture: "draw2dpicture",
|
||||
boardWidth: "boardWidth",
|
||||
boardHeight: "boardHeight",
|
||||
picture: "picture",
|
||||
}),
|
||||
...mapWritableState(globalStore, {
|
||||
lastBoard: "lastBoard",
|
||||
@ -62,6 +64,9 @@
|
||||
getDraw2dLast(value) {
|
||||
if (value == true) this.draw2dLast();
|
||||
},
|
||||
getDraw2dPicture(value) {
|
||||
if (value == true) this.draw2dPicture();
|
||||
},
|
||||
getReset(value) {
|
||||
if (value == true) this.reset();
|
||||
},
|
||||
@ -137,9 +142,22 @@
|
||||
this.draw2d(board);
|
||||
},
|
||||
// draw 2d automaton from the last known generated board
|
||||
async draw2dLast() {
|
||||
draw2dLast() {
|
||||
if (this.lastBoard != undefined) this.draw2d(this.lastBoard);
|
||||
},
|
||||
// draw 2d automaton from an uploaded picture
|
||||
draw2dPicture(e) {
|
||||
this.picture.width = this.canvas.width;
|
||||
this.picture.height = this.canvas.height;
|
||||
this.ctx.drawImage(
|
||||
this.picture,
|
||||
0,
|
||||
0,
|
||||
this.canvas.width,
|
||||
this.canvas.height
|
||||
);
|
||||
this.toggleStop();
|
||||
},
|
||||
// stop drawing routines and clear the canvas
|
||||
reset() {
|
||||
this.toggleStop();
|
||||
|
||||
Reference in New Issue
Block a user