File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,14 +201,11 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
201201 const rangeBox = getRangeBox ( event , currentlyDragged . current ) ;
202202 const rect = rangeBox . getBoundingClientRect ( ) ;
203203 const direction = rangeBox . dataset . direction ;
204- let max , min ;
205204 if ( direction === 'horizontal' ) {
206- min = rangeBox . offsetLeft ;
207- max = min + rangeBox . offsetWidth ;
208- if ( event . clientX < min || event . clientX > max ) return false ;
205+ if ( event . clientX - rect . left < 0 || event . clientX - rect . right > 0 ) return false ;
209206 } else {
210- min = rect . top ;
211- max = min + rangeBox . offsetHeight ;
207+ const min = rect . top ;
208+ const max = min + rangeBox . offsetHeight ;
212209 if ( event . clientY < min || event . clientY > max ) return false ;
213210 }
214211 return true ;
@@ -219,7 +216,7 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
219216 const rect = slider . getBoundingClientRect ( ) ;
220217 let K = 0 ;
221218 if ( slider . dataset . direction === 'horizontal' ) {
222- const offsetX = event . clientX - slider . offsetLeft ;
219+ const offsetX = event . clientX - rect . left ;
223220 const width = slider . clientWidth ;
224221 K = offsetX / width ;
225222 } else if ( slider . dataset . direction === 'vertical' ) {
You can’t perform that action at this time.
0 commit comments