Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Event Video Magnification #252

Merged
merged 11 commits into from
Jul 25, 2024
Prev Previous commit
Next Next commit
fix: Correctly reflect matrix size change
  • Loading branch information
bdlukaa committed Jul 23, 2024
commit 3326ee3595e88df7befe1d87c7514570452344b3
8 changes: 6 additions & 2 deletions lib/providers/desktop_view_provider.dart
Original file line number Diff line number Diff line change
@@ -320,7 +320,9 @@ class DesktopViewProvider extends UnityProvider {
/// Updates a device in all the layouts.
///
/// If [reload] is `true`, the device player will be reloaded.
Future<void> updateDevice(
///
/// Return the new device.
Device updateDevice(
Device previousDevice,
Device device, {
bool reload = false,
@@ -343,6 +345,8 @@ class DesktopViewProvider extends UnityProvider {
}

notifyListeners();
return save(notifyListeners: false);
save(notifyListeners: false);

return device;
}
}
11 changes: 5 additions & 6 deletions lib/screens/layouts/desktop/multicast_view.dart
Original file line number Diff line number Diff line change
@@ -41,8 +41,7 @@ class MulticastViewport extends StatefulWidget {
}

class _MulticastViewportState extends State<MulticastViewport> {
var _placeholderDevice = Device.dump();
Device get device => widget.device ?? _placeholderDevice;
late Device device = widget.device ?? Device.dump();

Timer? _gap;

@@ -163,17 +162,17 @@ class _MulticastViewportState extends State<MulticastViewport> {
return HoverButton(
onDoubleTap: () {
if (widget.device != null) {
views.updateDevice(
device = views.updateDevice(
device,
device.copyWith(matrixType: matrixType.next),
);
setState(() {});
} else {
setState(() {
_placeholderDevice = _placeholderDevice.copyWith(
device = device.copyWith(
matrixType: matrixType.next,
);
view.player.zoom.matrixType =
_placeholderDevice.matrixType!;
view.player.zoom.matrixType = device.matrixType!;
});
}
},