Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/components/AudioPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,11 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
const rangeBox = getRangeBox(event, currentlyDragged.current);
const rect = rangeBox.getBoundingClientRect();
const direction = rangeBox.dataset.direction;
let max, min;
if (direction === 'horizontal') {
min = rangeBox.offsetLeft;
max = min + rangeBox.offsetWidth;
if (event.clientX < min || event.clientX > max) return false;
if (event.clientX - rect.left < 0 || event.clientX - rect.right > 0) return false;
} else {
min = rect.top;
max = min + rangeBox.offsetHeight;
const min = rect.top;
const max = min + rangeBox.offsetHeight;
if (event.clientY < min || event.clientY > max) return false;
}
return true;
Expand All @@ -219,7 +216,7 @@ export const AudioPlayer: React.FC<AudioInterface> = ({
const rect = slider.getBoundingClientRect();
let K = 0;
if (slider.dataset.direction === 'horizontal') {
const offsetX = event.clientX - slider.offsetLeft;
const offsetX = event.clientX - rect.left;
const width = slider.clientWidth;
K = offsetX / width;
} else if (slider.dataset.direction === 'vertical') {
Expand Down