mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
fix: 取色器 Hue 值异常(#32)
This commit is contained in:
parent
7d823d84c6
commit
250c01b0ad
@ -37,7 +37,7 @@ export default defineComponent({
|
||||
|
||||
const color = computed(() => {
|
||||
const hsla = tinycolor(props.value).toHsl()
|
||||
if (hsla.s === 0) hsla.h = props.hue
|
||||
hsla.h = props.hue
|
||||
return hsla
|
||||
})
|
||||
|
||||
@ -68,7 +68,7 @@ export default defineComponent({
|
||||
else if (left > containerWidth) h = 360
|
||||
else {
|
||||
percent = left * 100 / containerWidth
|
||||
h = (360 * percent / 100)
|
||||
h = 360 * percent / 100
|
||||
}
|
||||
if (color.value.h !== h) {
|
||||
emit('colorChange', {
|
||||
|
@ -39,7 +39,7 @@ export default defineComponent({
|
||||
setup(props, { emit }) {
|
||||
const color = computed(() => {
|
||||
const hsva = tinycolor(props.value).toHsv()
|
||||
if (hsva.s === 0) hsva.h = props.hue
|
||||
hsva.h = props.hue
|
||||
return hsva
|
||||
})
|
||||
|
||||
|
@ -189,10 +189,8 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const changeColor = (value: ColorFormats.RGBA | ColorFormats.HSLA | ColorFormats.HSVA) => {
|
||||
if ('h' in value) {
|
||||
hue.value = value.h
|
||||
color.value = tinycolor(value).toRgb()
|
||||
}
|
||||
if ('h' in value && 'l' in value) hue.value = value.h
|
||||
if ('h' in value) color.value = tinycolor(value).toRgb()
|
||||
else color.value = value
|
||||
|
||||
updateRecentColorsCache()
|
||||
|
Loading…
x
Reference in New Issue
Block a user