explorata/src/components/MenuCellProperties.vue

63 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<MenuRow row-title="Cell Properties">
<form>
<div class="form-field">
<label for="live">Living cell color</label>
<input
2022-01-10 11:13:44 +01:00
name="liveColor"
type="color"
2022-01-10 11:13:44 +01:00
@value="cellProperties.liveColor"
@input="updateCellProperties"
/>
</div>
<div class="form-field">
<label for="dead">Dead cell color</label>
<input
2022-01-10 11:13:44 +01:00
name="deadColor"
type="color"
2022-01-10 11:13:44 +01:00
:value="cellProperties.deadColor"
@input="updateCellProperties"
/>
</div>
<div class="form-field">
<label>Cell size</label>
<input
2022-01-10 11:13:44 +01:00
name="size"
type="number"
2022-01-10 21:01:39 +01:00
min="1"
2022-01-10 11:13:44 +01:00
:value="cellProperties.size"
@input="updateCellProperties"
/>
</div>
</form>
</MenuRow>
</template>
<script>
import MenuRow from "./MenuRow.vue";
export default {
name: "MainMenu",
components: {
MenuRow,
},
data() {
return {
cellProperties: this.$store.state.cellProperties,
};
},
methods: {
2022-01-10 11:13:44 +01:00
getCellProperties(event) {
const elem = event.target;
const prop = this.$store.state.cellProperties;
return prop[elem.name];
2022-01-10 11:13:44 +01:00
},
updateCellProperties(event) {
const elem = event.target;
const prop = { name: elem.name, value: elem.value };
2022-01-10 11:13:44 +01:00
//console.log(prop)
this.$store.commit("setCellProperties", prop);
},
},
};
</script>