mirror of
https://github.com/kevin-DL/vue-audio-recorder.git
synced 2026-01-23 07:41:26 +00:00
Add existing code
This commit is contained in:
22
src/lib/utils.js
Normal file
22
src/lib/utils.js
Normal file
@@ -0,0 +1,22 @@
|
||||
export function calculateLineHeadPosition (ev, element) {
|
||||
let progressWidth = element.getBoundingClientRect().width
|
||||
let leftPosition = ev.target.getBoundingClientRect().left
|
||||
let pos = (ev.clientX - leftPosition) / progressWidth
|
||||
|
||||
try {
|
||||
if (!ev.target.className.match(/^ar\-line\-control/)) {
|
||||
return
|
||||
}
|
||||
} catch (err) {
|
||||
return
|
||||
}
|
||||
|
||||
pos = pos < 0 ? 0 : pos
|
||||
pos = pos > 1 ? 1 : pos
|
||||
|
||||
return pos
|
||||
}
|
||||
|
||||
export function convertTimeMMSS (seconds) {
|
||||
return new Date(seconds * 1000).toISOString().substr(14, 5)
|
||||
}
|
||||
Reference in New Issue
Block a user