Merge pull request 'hot sexy fixes for active menu' (#4) from dev into master

Reviewed-on: #4
This commit is contained in:
Ali Gator 2022-12-05 13:48:41 +01:00
commit 2dc2745995
3 changed files with 46 additions and 17 deletions

View File

@ -1,9 +1,9 @@
<template> <template>
<div id="main-menu"> <div id="main-menu">
<MenuGeneralOptions /> <MenuGeneralOptions :active="active" @update-active="updateActive" />
<MenuCellProperties /> <MenuCellProperties :active="active" @update-active="updateActive" />
<MenuElementaryCA /> <MenuElementaryCA :active="active" @update-active="updateActive" />
<Menu2dCA /> <Menu2dCA :active="active" @update-active="updateActive" />
</div> </div>
</template> </template>
@ -20,6 +20,21 @@
MenuElementaryCA, MenuElementaryCA,
Menu2dCA, 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;
}
},
},
}; };
</script> </script>

View File

@ -13,6 +13,11 @@
<label>Start from last result</label> <label>Start from last result</label>
<input type="button" value="start" @click="toggleDraw2dLast()" /> <input type="button" value="start" @click="toggleDraw2dLast()" />
</div> </div>
<div class="form-field">
<label>Start from picture</label><br />
<input type="file" @change="previewFile" />
<input type="button" value="start" @click="toggleDraw2dLast()" />
</div>
</MenuRow> </MenuRow>
</template> </template>
@ -28,6 +33,9 @@
}, },
methods: { methods: {
...mapActions(globalStore, ["toggleDraw2dLast", "toggleDraw2d"]), ...mapActions(globalStore, ["toggleDraw2dLast", "toggleDraw2d"]),
previewFile(event) {
console.log(event.target.files);
},
}, },
}; };
</script> </script>

View File

@ -1,9 +1,9 @@
<template> <template>
<div class="menu-row"> <div class="menu-row">
<h2 :id="rowTitle" @click="updateActiveMenu"> <h2 :id="rowTitle" @click="$emit('update-active', rowTitle)">
{{ rowTitle }} {{ rowTitle }}
</h2> </h2>
<div class="menu-row-content"> <div v-if="isActive" class="menu-row-content">
<slot /> <slot />
</div> </div>
</div> </div>
@ -17,6 +17,17 @@
type: String, type: String,
default: "", default: "",
}, },
active: {
type: String,
default: "",
},
},
emits: ["update-active"],
computed: {
isActive() {
console.log(this.rowTitle, "vs", this.active);
return this.rowTitle == this.active;
},
}, },
}; };
</script> </script>
@ -54,15 +65,10 @@
position: relative; position: relative;
} }
.menu-row:hover .menu-row-content {
display: block;
width: 100%;
}
.menu-row-content { .menu-row-content {
position: absolute; position: absolute;
background: var(--dark1); background: var(--dark1);
display: none; width: 100%;
} }
label, label,
@ -91,11 +97,11 @@
padding: 10px; padding: 10px;
} }
.menu-row:active .menu-row-content { /* .menu-row:active .menu-row-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
} } */
.menu-row-content { .menu-row-content {
position: relative; position: relative;