Skip to content

Commit

Permalink
fixed play/pause shortcut not being scoped to active file
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHeitmann committed Dec 18, 2022
1 parent df708a9 commit 666dc00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:flutter/services.dart';
import '../../../../stateManagement/ChangeNotifierWidget.dart';
import '../../../../stateManagement/nestedNotifier.dart';
import '../../../../stateManagement/openFileTypes.dart';
import '../../../../stateManagement/openFilesManager.dart';
import '../../../../utils/utils.dart';
import '../../../theme/customTheme.dart';
import 'BnkPlaylistEditorInheritedData.dart';
Expand Down Expand Up @@ -186,6 +187,8 @@ class _BnkPlaylistChildEditorState extends State<BnkPlaylistChildEditor> with Au
bool isCollapsed = false;
BnkPlaylistChild get plSegment => widget.plSegment;
BnkSegmentData? get segment => widget.plSegment.segment;
@override
OpenFileId get fileId => widget.plSegment.file;

@override
void initState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import '../../../../stateManagement/Property.dart';
import '../../../../stateManagement/nestedNotifier.dart';
import '../../../../stateManagement/openFileTypes.dart';
import '../../../../stateManagement/openFilesManager.dart';
import '../../../misc/mousePosition.dart';
import 'audioSequenceController.dart';

Expand Down Expand Up @@ -150,6 +151,7 @@ mixin AudioPlayingWidget<T extends StatefulWidget> on State<T> {
}

PlaybackController makePlaybackController();
OpenFileId get fileId;

void togglePlayback() {
var audioPlaybackScope = AudioPlaybackScope.of(context);
Expand Down Expand Up @@ -195,6 +197,8 @@ mixin AudioPlayingWidget<T extends StatefulWidget> on State<T> {
return false;
if (event.logicalKey != LogicalKeyboardKey.space)
return false;
if (fileId != areasManager.activeArea?.currentFile?.uuid)
return false;

togglePlayback();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class BnkTrackEditor extends ChangeNotifierWidget {
class _BnkTrackEditorState extends ChangeNotifierState<BnkTrackEditor> with AudioPlayingWidget {
double? dragStartPos;
Map<String, double>? initialXOff;
@override
OpenFileId get fileId => widget.track.file;

@override
void initState() {
Expand Down

0 comments on commit 666dc00

Please sign in to comment.