explorata/src/components/MenuCellProperties.vue

56 lines
1.4 KiB
Vue

<script setup>
import { globalStore } from "../stores/index.js";
import MenuRow from "./MenuRow.vue";
const store = globalStore();
const updateCellProperties = (event) => {
const { name, value } = event.target;
store.setCellProperties(name, value);
store.setBoardWidth();
store.setBoardHeight();
};
const switchColor = () => {
store.switchColor();
};
</script>
<template>
<MenuRow row-title="Cell Properties">
<form>
<div class="form-field">
<label for="live">Living cell color</label>
<input
name="liveColor"
type="color"
:value="store.board.cellProperties.liveColor"
@input="updateCellProperties"
/>
</div>
<div class="form-field">
<label for="dead">Dead cell color</label>
<input
name="deadColor"
type="color"
:value="store.board.cellProperties.deadColor"
@input="updateCellProperties"
/>
</div>
<div class="form-field">
<a name="switchColor" @click="switchColor">Switch Colors</a>
</div>
<div class="form-field">
<label>Cell size</label>
<input
name="size"
type="number"
min="1"
:value="store.board.cellProperties.size"
@click="updateCellProperties"
/>
</div>
</form>
</MenuRow>
</template>