kopia lustrzana https://github.com/shoelace-style/shoelace
fix grid handle drag behavior
rodzic
1ae5b9cfcd
commit
3541540d84
|
|
@ -14,6 +14,7 @@ This release improves how component dependencies are imported. If you've been ch
|
||||||
- Dependencies are now automatically imported for all components
|
- Dependencies are now automatically imported for all components
|
||||||
- Fixed a bug where tabbing into `sl-radio-group` would not always focus the checked radio
|
- Fixed a bug where tabbing into `sl-radio-group` would not always focus the checked radio
|
||||||
- Fixed a bug in component styles that prevented the box sizing reset from being applied
|
- Fixed a bug in component styles that prevented the box sizing reset from being applied
|
||||||
|
- Fixed a regression in `sl-color-picker` where dragging the grid handle wasn't smooth
|
||||||
- Improved base path utility logic
|
- Improved base path utility logic
|
||||||
|
|
||||||
## 2.0.0-beta.46
|
## 2.0.0-beta.46
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ export default class SlColorPicker extends LitElement {
|
||||||
@query('[part="preview"]') previewButton: HTMLButtonElement;
|
@query('[part="preview"]') previewButton: HTMLButtonElement;
|
||||||
@query('.color-dropdown') dropdown: SlDropdown;
|
@query('.color-dropdown') dropdown: SlDropdown;
|
||||||
|
|
||||||
|
private isSafeValue = false;
|
||||||
private lastValueEmitted: string;
|
private lastValueEmitted: string;
|
||||||
|
|
||||||
@state() private inputValue = '';
|
@state() private inputValue = '';
|
||||||
|
|
@ -538,7 +539,7 @@ export default class SlColorPicker extends LitElement {
|
||||||
return this.uppercase ? string.toUpperCase() : string.toLowerCase();
|
return this.uppercase ? string.toUpperCase() : string.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
syncValues() {
|
async syncValues() {
|
||||||
const currentColor = this.parseColor(
|
const currentColor = this.parseColor(
|
||||||
`hsla(${this.hue}, ${this.saturation}%, ${this.lightness}%, ${this.alpha / 100})`
|
`hsla(${this.hue}, ${this.saturation}%, ${this.lightness}%, ${this.alpha / 100})`
|
||||||
);
|
);
|
||||||
|
|
@ -556,7 +557,13 @@ export default class SlColorPicker extends LitElement {
|
||||||
this.inputValue = this.opacity ? currentColor.hexa : currentColor.hex;
|
this.inputValue = this.opacity ? currentColor.hexa : currentColor.hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setting this.value will trigger the watcher which parses the new value. We want to bypass that behavior because
|
||||||
|
// we've already parsed the color here and conversion/rounding can lead to values changing slightly. WHen this
|
||||||
|
// happens, dragging the grid handle becomes jumpy. After the next update, the usual behavior is restored.
|
||||||
|
this.isSafeValue = true;
|
||||||
this.value = this.inputValue;
|
this.value = this.inputValue;
|
||||||
|
await this.updateComplete;
|
||||||
|
this.isSafeValue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@watch('format')
|
@watch('format')
|
||||||
|
|
@ -571,6 +578,7 @@ export default class SlColorPicker extends LitElement {
|
||||||
|
|
||||||
@watch('value')
|
@watch('value')
|
||||||
handleValueChange(oldValue: string, newValue: string) {
|
handleValueChange(oldValue: string, newValue: string) {
|
||||||
|
if (!this.isSafeValue) {
|
||||||
const newColor = this.parseColor(newValue);
|
const newColor = this.parseColor(newValue);
|
||||||
|
|
||||||
if (newColor) {
|
if (newColor) {
|
||||||
|
|
@ -582,6 +590,7 @@ export default class SlColorPicker extends LitElement {
|
||||||
} else {
|
} else {
|
||||||
this.inputValue = oldValue;
|
this.inputValue = oldValue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.value !== this.lastValueEmitted) {
|
if (this.value !== this.lastValueEmitted) {
|
||||||
emit(this, 'sl-change');
|
emit(this, 'sl-change');
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue