2023-04-18 23:20:02 +02:00
|
|
|
import {Component} from './component';
|
2019-10-17 20:46:18 +02:00
|
|
|
|
2022-11-15 13:44:57 +01:00
|
|
|
export class SettingColorPicker extends Component {
|
2019-10-17 20:46:18 +02:00
|
|
|
|
2022-11-15 13:44:57 +01:00
|
|
|
setup() {
|
|
|
|
this.colorInput = this.$refs.input;
|
|
|
|
this.resetButton = this.$refs.resetButton;
|
|
|
|
this.defaultButton = this.$refs.defaultButton;
|
|
|
|
this.currentColor = this.$opts.current;
|
|
|
|
this.defaultColor = this.$opts.default;
|
|
|
|
|
|
|
|
this.resetButton.addEventListener('click', () => this.setValue(this.currentColor));
|
|
|
|
this.defaultButton.addEventListener('click', () => this.setValue(this.defaultColor));
|
2019-10-17 20:46:18 +02:00
|
|
|
}
|
|
|
|
|
2022-11-15 13:44:57 +01:00
|
|
|
setValue(value) {
|
|
|
|
this.colorInput.value = value;
|
2023-01-28 18:11:15 +01:00
|
|
|
this.colorInput.dispatchEvent(new Event('change', {bubbles: true}));
|
2022-11-15 13:44:57 +01:00
|
|
|
}
|
2023-04-18 23:20:02 +02:00
|
|
|
|
|
|
|
}
|