File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -60,21 +60,31 @@ const SensorInput = ({
6060 }
6161 }
6262 } ;
63+ const mouseDownTouchStartAction = ( ) => {
64+ setMouseDown ( true ) ;
65+ handleSensorChange ( sensor . max ) ;
66+ } ;
67+ const mouseUpTouchEndAction = ( ) => {
68+ if ( mouseDown ) {
69+ setMouseDown ( false ) ;
70+ handleSensorChange ( sensor . min ) ;
71+ }
72+ } ;
6373 const mouseDownListener = (
6474 event : React . MouseEvent < HTMLButtonElement , MouseEvent >
6575 ) => {
6676 event . preventDefault ( ) ;
67- setMouseDown ( true ) ;
68- handleSensorChange ( sensor . max ) ;
77+ mouseDownTouchStartAction ( ) ;
6978 } ;
7079 const mouseUpListener = (
7180 event : React . MouseEvent < HTMLButtonElement , MouseEvent >
7281 ) => {
7382 event . preventDefault ( ) ;
74- if ( mouseDown ) {
75- setMouseDown ( false ) ;
76- handleSensorChange ( sensor . min ) ;
77- }
83+ mouseUpTouchEndAction ( ) ;
84+ } ;
85+ const touchEndListener = ( event : React . TouchEvent ) => {
86+ event . preventDefault ( ) ;
87+ mouseUpTouchEndAction ( ) ;
7888 } ;
7989 const mouseLeaveListener = ( ) => {
8090 if ( mouseDown ) {
@@ -124,7 +134,9 @@ const SensorInput = ({
124134 onKeyDown = { keyListener }
125135 onKeyUp = { keyListener }
126136 onMouseDown = { mouseDownListener }
137+ onTouchStart = { mouseDownTouchStartAction }
127138 onMouseUp = { mouseUpListener }
139+ onTouchEnd = { touchEndListener }
128140 onMouseLeave = { mouseLeaveListener }
129141 >
130142 { logo ? (
You can’t perform that action at this time.
0 commit comments