diff --git a/src/App.vue b/src/App.vue
index b86443a..3685d03 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -18,7 +18,7 @@
import MainMenu from "./components/MainMenu.vue";
import CanvasBoard from "./components/CanvasBoard.vue";
import MenuReset from "./components/MenuReset.vue";
- import { mapWritableState, mapActions } from "pinia";
+ import { mapState, mapWritableState, mapActions } from "pinia";
import { globalStore } from "./stores/index.js";
export default {
@@ -30,15 +30,12 @@
},
data() {
return {
- mainMenu: false,
windowWidth: window.innerWidth,
};
},
computed: {
- ...mapWritableState(globalStore, {
- canvasWidth: "canvasWidth",
- canvasHeight: "canvasHeight",
- }),
+ ...mapState(globalStore, ["mainMenu", "activeSubMenu"]),
+ ...mapWritableState(globalStore, ["canvasWidth", "canvasHeight"]),
},
mounted() {
this.$nextTick(() => {
@@ -49,9 +46,13 @@
window.removeEventListener("resize", this.onResize);
},
methods: {
- ...mapActions(globalStore, ["setBoardWidth", "setBoardHeight"]),
+ ...mapActions(globalStore, [
+ "setBoardWidth",
+ "setBoardHeight",
+ "setMainMenu",
+ ]),
toggleMainMenu() {
- this.mainMenu = !this.mainMenu;
+ this.setMainMenu(!this.mainMenu);
},
onResize() {
this.$nextTick(() => {
diff --git a/src/components/MainMenu.vue b/src/components/MainMenu.vue
index b5c7f27..53a65bc 100644
--- a/src/components/MainMenu.vue
+++ b/src/components/MainMenu.vue
@@ -1,9 +1,9 @@
-
-
-
-
+
+
+
+
@@ -20,21 +20,6 @@
MenuElementaryCA,
Menu2dCA,
},
- data() {
- return {
- active: "",
- };
- },
- methods: {
- // set the opened submenu. If already active, reset it so it can close
- updateActive(menu) {
- if (menu === this.active) {
- this.active = "";
- } else {
- this.active = menu;
- }
- },
- },
};
@@ -43,7 +28,6 @@
display: flex;
flex-direction: row;
width: 100%;
-
flex: 1;
}
diff --git a/src/components/MenuCellProperties.vue b/src/components/MenuCellProperties.vue
index 49b07f9..33a4786 100644
--- a/src/components/MenuCellProperties.vue
+++ b/src/components/MenuCellProperties.vue
@@ -38,7 +38,7 @@
import { globalStore } from "../stores/index.js";
import MenuRow from "./MenuRow.vue";
export default {
- name: "MainMenu",
+ name: "MenuCellProperties",
components: {
MenuRow,
},
diff --git a/src/components/MenuRow.vue b/src/components/MenuRow.vue
index 7db762c..743bfe7 100644
--- a/src/components/MenuRow.vue
+++ b/src/components/MenuRow.vue
@@ -1,19 +1,17 @@