Skip to content

Commit

Permalink
modify the way dragged region is colored
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-pages committed Dec 3, 2024
1 parent 8a8a9bc commit 2128336
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions gryannote/audio/frontend/player/AudioPlayer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
let caption: Caption;
let regionsControl: RegionsControl;
let disableDragSelection: () => void;
const audioContext = new AudioContext();
const gainNodeIn = audioContext.createGain();
Expand Down Expand Up @@ -148,7 +147,7 @@
$: waveform?.on("init", () => {
if(!wsRegions){
wsRegions = waveform.registerPlugin(RegionsPlugin.create());
disableDragSelection = wsRegions.enableDragSelection({color: caption.getDefaultLabel().color});
wsRegions.enableDragSelection({});
}
if(!wsGamepad){
Expand Down Expand Up @@ -304,9 +303,6 @@
{wsGamepad}
on:select={(e) => {
regionsControl.setRegionLabel(e.detail);
// following line is needed to not add multiple region at the same time
disableDragSelection();
disableDragSelection = wsRegions.enableDragSelection({"color": e.detail.color});
}}
on:name_update={(e) => {
regionsControl.getRegions().forEach(region => {
Expand Down
3 changes: 3 additions & 0 deletions gryannote/audio/frontend/player/RegionsControl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@
regionsMap.set(region.id, annotation);
updateAnnotations();
region.color = label.color;
region.setOptions(region);
// if this is the first region added on the waveform
if(!initialAnnotations){
initialAnnotations = [annotation];
Expand Down

0 comments on commit 2128336

Please sign in to comment.