2023-04-18 22:20:02 +01:00
|
|
|
import {Component} from './component';
|
2019-10-17 13:46:18 -05:00
|
|
|
|
2022-11-15 12:44:57 +00:00
|
|
|
export class SettingColorPicker extends Component {
|
2019-10-17 13:46:18 -05:00
|
|
|
|
2022-11-15 12:44:57 +00: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 13:46:18 -05:00
|
|
|
}
|
|
|
|
|
2022-11-15 12:44:57 +00:00
|
|
|
setValue(value) {
|
|
|
|
this.colorInput.value = value;
|
2023-01-28 17:11:15 +00:00
|
|
|
this.colorInput.dispatchEvent(new Event('change', {bubbles: true}));
|
2022-11-15 12:44:57 +00:00
|
|
|
}
|
2023-04-18 22:20:02 +01:00
|
|
|
|
|
|
|
}
|