Avoid random colors on every click

This commit is contained in:
Matthias 2023-05-06 17:48:11 +02:00
parent 1dd5a3bfda
commit c240d6bc16
2 changed files with 11 additions and 3 deletions

View File

@ -51,7 +51,10 @@
size="sm"
class="ms-1 col"
:disabled="addNewIndicator"
@click="addNewIndicator = !addNewIndicator"
@click="
addNewIndicator = !addNewIndicator;
selIndicatorName = '';
"
>
Add new indicator
</b-button>
@ -158,6 +161,7 @@ import { deepClone } from '@/shared/deepClone';
import { useBotStore } from '@/stores/ftbotwrapper';
import { usePlotConfigStore } from '@/stores/plotConfig';
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import randomColor from '@/shared/randomColor';
defineProps({
columns: { required: true, type: Array as () => string[] },
@ -322,7 +326,11 @@ function addNewIndicatorSelected(indicator?: string) {
addNewIndicator.value = false;
if (indicator) {
addIndicator({ [indicator]: {} });
addIndicator({
[indicator]: {
color: randomColor(),
},
});
selIndicatorName.value = indicator;
}
}

View File

@ -13,7 +13,7 @@
<b-button
size="sm"
title="Abort"
class="ms-1"
class="ms-1 mt-auto"
variant="secondary"
@click="$emit('indicatorSelected', null)"
>