@@ -24,9 +24,7 @@ const Saturation = React.forwardRef<HTMLDivElement, SaturationProps>((props, ref
24
24
position : 'relative' ,
25
25
} ;
26
26
27
- const [ interaction , setInteraction ] = useState < Interaction > ( { left : 0 , top : 0 , x : 0 , y : 0 , width : 0 , height : 0 } ) ;
28
27
const handleChange = ( interaction : Interaction , event : MouseEvent | TouchEvent ) => {
29
- setInteraction ( interaction ) ;
30
28
onChange &&
31
29
hsva &&
32
30
onChange ( {
@@ -40,22 +38,16 @@ const Saturation = React.forwardRef<HTMLDivElement, SaturationProps>((props, ref
40
38
41
39
const pointerElement = useMemo ( ( ) => {
42
40
if ( ! hsva ) return null ;
43
- var ponitX = `${ clamp ( interaction . x , 0 , interaction . width ) } px` ;
44
- var ponitY = `${ clamp ( interaction . y , 0 , interaction . height ) } px` ;
45
- if ( interaction . width === 0 || interaction . height === 0 ) {
46
- ponitX = `${ hsva . s } %` ;
47
- ponitY = `${ 100 - hsva . v } %` ;
48
- }
49
41
const comProps = {
50
- top : ponitY ,
51
- left : ponitX ,
42
+ top : ` ${ 100 - hsva . v } %` ,
43
+ left : ` ${ hsva . s } %` ,
52
44
color : hsvaToHslaString ( hsva ) ,
53
45
} ;
54
46
if ( pointer && typeof pointer === 'function' ) {
55
47
return pointer ( { prefixCls, ...comProps } ) ;
56
48
}
57
49
return < Pointer prefixCls = { prefixCls } { ...comProps } /> ;
58
- } , [ hsva , interaction , pointer , prefixCls ] ) ;
50
+ } , [ hsva , pointer , prefixCls ] ) ;
59
51
60
52
return (
61
53
< Interactive
0 commit comments