@@ -24,13 +24,13 @@ export const Slider: React.FC<GraphProps> = ({ height, width }) => {
2424 [ height , width ]
2525 ) ;
2626
27- const progress = useValue (
27+ const touchPos = useValue (
2828 getPointAtPositionInPath ( width / 2 , width , 60 , path )
2929 ) ;
3030
3131 const touchHandler = useTouchHandler ( {
3232 onActive : ( { x } ) =>
33- ( progress . value = getPointAtPositionInPath ( x , width , 60 , path ) ) ,
33+ ( touchPos . value = getPointAtPositionInPath ( x , width , 60 , path ) ) ,
3434 } ) ;
3535
3636 return (
@@ -52,18 +52,18 @@ export const Slider: React.FC<GraphProps> = ({ height, width }) => {
5252 strokeCap = "round"
5353 />
5454 < Paint color = "#fff" />
55- < Circle c = { ( ) => progress . value } r = { 10 } />
56- < Circle color = "#DA4167" c = { ( ) => progress . value } r = { 7.5 } />
55+ < Circle c = { ( ) => touchPos . value } r = { 10 } />
56+ < Circle color = "#DA4167" c = { ( ) => touchPos . value } r = { 7.5 } />
5757 < SkiaText
5858 familyName = "Arial"
5959 size = { 12 }
60- x = { ( ) => progress . value . x - 24 }
61- y = { ( ) => progress . value . y - 18 }
62- value = { ( ) => "$ " + progress . value . x . toFixed ( 2 ) }
60+ x = { ( ) => touchPos . value . x - 24 }
61+ y = { ( ) => touchPos . value . y - 18 }
62+ value = { ( ) => "$ " + ( touchPos . value . y * - 1 ) . toFixed ( 2 ) }
6363 />
6464 < Line
65- p1 = { ( ) => vec ( progress . value . x , progress . value . y + 14 ) }
66- p2 = { ( ) => vec ( progress . value . x , height ) }
65+ p1 = { ( ) => vec ( touchPos . value . x , touchPos . value . y + 14 ) }
66+ p2 = { ( ) => vec ( touchPos . value . x , height ) }
6767 />
6868 </ Canvas >
6969 < Text > Touch and drag to move center point</ Text >
0 commit comments