hide main menu once start is clicked (mobile)
This commit is contained in:
parent
9b83b88c54
commit
b5b223ba5c
17
src/App.vue
17
src/App.vue
@ -18,7 +18,7 @@
|
|||||||
import MainMenu from "./components/MainMenu.vue";
|
import MainMenu from "./components/MainMenu.vue";
|
||||||
import CanvasBoard from "./components/CanvasBoard.vue";
|
import CanvasBoard from "./components/CanvasBoard.vue";
|
||||||
import MenuReset from "./components/MenuReset.vue";
|
import MenuReset from "./components/MenuReset.vue";
|
||||||
import { mapWritableState, mapActions } from "pinia";
|
import { mapState, mapWritableState, mapActions } from "pinia";
|
||||||
import { globalStore } from "./stores/index.js";
|
import { globalStore } from "./stores/index.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -30,15 +30,12 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mainMenu: false,
|
|
||||||
windowWidth: window.innerWidth,
|
windowWidth: window.innerWidth,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapWritableState(globalStore, {
|
...mapState(globalStore, ["mainMenu", "activeSubMenu"]),
|
||||||
canvasWidth: "canvasWidth",
|
...mapWritableState(globalStore, ["canvasWidth", "canvasHeight"]),
|
||||||
canvasHeight: "canvasHeight",
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
@ -49,9 +46,13 @@
|
|||||||
window.removeEventListener("resize", this.onResize);
|
window.removeEventListener("resize", this.onResize);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(globalStore, ["setBoardWidth", "setBoardHeight"]),
|
...mapActions(globalStore, [
|
||||||
|
"setBoardWidth",
|
||||||
|
"setBoardHeight",
|
||||||
|
"setMainMenu",
|
||||||
|
]),
|
||||||
toggleMainMenu() {
|
toggleMainMenu() {
|
||||||
this.mainMenu = !this.mainMenu;
|
this.setMainMenu(!this.mainMenu);
|
||||||
},
|
},
|
||||||
onResize() {
|
onResize() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -1,6 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<MenuRow row-title="Elementary Automaton">
|
<MenuRow row-title="Elementary Automaton">
|
||||||
<form>
|
<form>
|
||||||
|
<div class="form-field">
|
||||||
|
<input
|
||||||
|
type="button"
|
||||||
|
name="start"
|
||||||
|
value="start"
|
||||||
|
@click="toggleDraw1d()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label>
|
<label>
|
||||||
Initial state presets
|
Initial state presets
|
||||||
@ -62,9 +70,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div class="form-field">
|
|
||||||
<input type="button" name="start" value="start" @click="toggleDraw1d()" />
|
|
||||||
</div>
|
|
||||||
</MenuRow>
|
</MenuRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
window.removeEventListener("click", this.onWindowClick);
|
window.removeEventListener("click", this.onWindowClick);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(globalStore, ["setActiveSubMenu"]),
|
...mapActions(globalStore, ["setActiveSubMenu", "toggleMainMenu"]),
|
||||||
onKeyDown: function (event) {
|
onKeyDown: function (event) {
|
||||||
// escape
|
// escape
|
||||||
if (event.keyCode == 27) {
|
if (event.keyCode == 27) {
|
||||||
@ -47,6 +47,7 @@
|
|||||||
if (form != null) {
|
if (form != null) {
|
||||||
if (!form.contains(event.target)) {
|
if (!form.contains(event.target)) {
|
||||||
this.setActiveSubMenu("");
|
this.setActiveSubMenu("");
|
||||||
|
this.setMainMenu(false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ export const globalStore = defineStore("globalStore", {
|
|||||||
draw2dLast: false,
|
draw2dLast: false,
|
||||||
reset: false,
|
reset: false,
|
||||||
canDraw: true,
|
canDraw: true,
|
||||||
|
mainMenu: false,
|
||||||
activeSubMenu: "",
|
activeSubMenu: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@ -48,16 +49,19 @@ export const globalStore = defineStore("globalStore", {
|
|||||||
},
|
},
|
||||||
toggleDraw1d() {
|
toggleDraw1d() {
|
||||||
this.setActiveSubMenu("");
|
this.setActiveSubMenu("");
|
||||||
|
this.setMainMenu(false);
|
||||||
this.draw1d = true;
|
this.draw1d = true;
|
||||||
},
|
},
|
||||||
toggleDraw2d() {
|
toggleDraw2d() {
|
||||||
this.setActiveSubMenu("");
|
this.setActiveSubMenu("");
|
||||||
|
this.setMainMenu(false);
|
||||||
this.toggleStop();
|
this.toggleStop();
|
||||||
this.canDraw = true;
|
this.canDraw = true;
|
||||||
this.draw2d = true;
|
this.draw2d = true;
|
||||||
},
|
},
|
||||||
toggleDraw2dLast() {
|
toggleDraw2dLast() {
|
||||||
this.setActiveSubMenu("");
|
this.setActiveSubMenu("");
|
||||||
|
this.setMainMenu(false);
|
||||||
this.toggleStop();
|
this.toggleStop();
|
||||||
this.canDraw = true;
|
this.canDraw = true;
|
||||||
this.draw2dLast = true;
|
this.draw2dLast = true;
|
||||||
@ -76,5 +80,8 @@ export const globalStore = defineStore("globalStore", {
|
|||||||
if (this.activeSubMenu == data) this.activeSubMenu = "";
|
if (this.activeSubMenu == data) this.activeSubMenu = "";
|
||||||
else this.activeSubMenu = data;
|
else this.activeSubMenu = data;
|
||||||
},
|
},
|
||||||
|
setMainMenu(data) {
|
||||||
|
this.mainMenu = data;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user