asciibird/src/components/parts/ColourPicker.vue

66 lines
1.3 KiB
Vue
Raw Normal View History

2021-03-29 05:10:31 +00:00
<template>
<vue-draggable-resizable
style="z-index: 5"
:x="100"
:y="100"
:w="400"
:h="278"
>
2021-03-29 08:44:42 +00:00
<t-card>
2021-08-04 03:21:06 +00:00
<t-button
type="button"
class="border-gray-200 p-1"
@click="close()"
>
X
</t-button><br>
2021-08-03 06:33:06 +00:00
2021-08-04 03:21:06 +00:00
<span
v-for="(value, keyColours) in mircColours"
:key="keyColours"
>
<hr v-if="keyColours === 16">
<t-button
type="button"
:style="`background-color: ${mircColours[keyColours]} !important;`"
class="border-gray-200 p-3"
@click="onColourChange(keyColours)"
2021-08-04 03:21:06 +00:00
/>
2021-08-03 06:33:06 +00:00
</span>
2021-03-29 08:44:42 +00:00
</t-card>
</vue-draggable-resizable>
2021-03-29 05:10:31 +00:00
</template>
<script>
2021-08-04 03:21:06 +00:00
import { mircColours99 } from '../../ascii';
2021-03-29 05:10:31 +00:00
export default {
2021-08-04 03:21:06 +00:00
name: 'ColourPicker',
created() {},
computed: {
mircColours() {
return mircColours99;
},
toolbarState() {
return this.$store.getters.toolbarState;
},
},
2021-03-29 05:10:31 +00:00
methods: {
2021-08-03 06:33:06 +00:00
close() {
2021-08-04 03:21:06 +00:00
this.$store.commit('changeIsUpdatingFg', false);
this.$store.commit('changeIsUpdatingBg', false);
2021-08-03 06:33:06 +00:00
},
2021-03-29 05:10:31 +00:00
onColourChange(colour) {
if (this.toolbarState.isChoosingFg) {
2021-08-04 03:21:06 +00:00
this.$store.commit('changeColourFg', colour);
2021-03-29 05:10:31 +00:00
}
if (this.toolbarState.isChoosingBg) {
2021-08-04 03:21:06 +00:00
this.$store.commit('changeColourBg', colour);
2021-03-29 05:10:31 +00:00
}
},
},
};
</script>