Skip to content

Commit

Permalink
disable drag in non-interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-pages committed Dec 3, 2024
1 parent 7be97b5 commit 7d33829
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gryannote/audio/frontend/player/AudioPlayer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
$: waveform?.on("init", () => {
if(!wsRegions){
wsRegions = waveform.registerPlugin(RegionsPlugin.create());
wsRegions.enableDragSelection({});
if(interactive) wsRegions.enableDragSelection({});
}
if(!wsGamepad){
Expand Down
9 changes: 6 additions & 3 deletions gryannote/audio/frontend/player/RegionsControl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@
};
/**
* Add a region onto waveform at timePos-time
* @returns the added region
* Add a region on the waveform.
* @param start start bound of the region to add, in seconds
* @param end end bound of the region to add, in seconds
* @param label label associated to the region to add
*/
function addRegion(start: number, end: number, label?: Label): Region {
label = label || caption.getActiveLabel() || caption.getDefaultLabel();
Expand Down Expand Up @@ -478,9 +480,10 @@
});
}
if(wsRegions && interactive){
if(wsRegions){
// add region-clicked event listener
wsRegions.on("region-clicked", (region, e) => {
if(!interactive) return;
switch(mode){
case "remove": removeRegion(region); break;
case "split": splitRegion(region, region.start + (region.end - region.start) / 2); break;
Expand Down

0 comments on commit 7d33829

Please sign in to comment.