Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Hotfix for negative values in peaks (#1148)
Browse files Browse the repository at this point in the history
* Hotfix for negative values in peaks

* Validate peaks values only by checking if they are numbers
  • Loading branch information
obulat authored Mar 21, 2022
1 parent 234b18b commit a469a57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/VAudioTrack/VWaveform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default defineComponent({
peaks: {
type: Array,
required: false,
validator: (val) => val.every((item) => item >= 0 && item <= 1),
validator: (val) => val.every((item) => typeof item === 'number'),
},
/**
* the message to display instead of the waveform; This is useful when
Expand Down Expand Up @@ -348,7 +348,9 @@ export default defineComponent({
samples = downsampleArray(samples, required)
}
return samples.map((peak) => peak * waveformDimens.value.height)
return samples.map(
(peak) => Math.max(peak, 0) * waveformDimens.value.height
)
})
/* SVG drawing */
Expand Down
4 changes: 2 additions & 2 deletions src/locales/po-files/openverse.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Openverse \n"
"Report-Msgid-Bugs-To: https://github.com/wordpress/openverse/issues \n"
"POT-Creation-Date: 2022-03-18T03:49:09+00:00\n"
"POT-Creation-Date: 2022-03-21T10:40:55+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -272,7 +272,7 @@ msgid "Audio seek bar"
msgstr ""

#. Do not translate words between ### ###.
#: src/components/VAudioTrack/VWaveform.vue:578
#: src/components/VAudioTrack/VWaveform.vue:580
msgctxt "waveform.current-time"
msgid "###time### second"
msgid_plural "###time### seconds"
Expand Down

0 comments on commit a469a57

Please sign in to comment.