From fbd06fa8a2d0c0897aec4fd105847c3f9549afef Mon Sep 17 00:00:00 2001 From: shinoxzu Date: Thu, 11 Jun 2026 01:22:28 +0300 Subject: [PATCH] fix: make flightmode better Save center of the map in the FlightMode, map rotation, widget IsExpanded state and pass GestureSurface to the MapCompass view. Asana: https://app.asana.com/1/1200746044236722/project/1203851531040615/task/1215451644739364?focus=true --- .../FlightWidget/FlightWidgetViewModel.cs | 11 +++++++++++ .../Pages/FlightMode/FlightModePageView.axaml | 3 ++- .../Pages/FlightMode/FlightModePageViewModel.cs | 16 +++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Asv.Drones.Api/Core/Controls/FlightWidget/FlightWidgetViewModel.cs b/src/Asv.Drones.Api/Core/Controls/FlightWidget/FlightWidgetViewModel.cs index 83412660..da6c6c88 100644 --- a/src/Asv.Drones.Api/Core/Controls/FlightWidget/FlightWidgetViewModel.cs +++ b/src/Asv.Drones.Api/Core/Controls/FlightWidget/FlightWidgetViewModel.cs @@ -31,6 +31,17 @@ protected FlightWidgetViewModel(NavId id, IExtensionService ext) Disposable.AddAction(() => Sections.ClearWithItemsDispose()); SectionsView = Sections.ToNotifyCollectionChangedSlim().DisposeItWith(Disposable); + + Layout + .Register( + nameof(IsExpanded), + value => IsExpanded = value, + () => IsExpanded, + this.ObservePropertyChanged(x => x.IsExpanded).Skip(1) + ) + .DisposeItWith(Disposable); + + Layout.LoadWhenRootAttached(RootTracking).AddTo(ref DisposableBag); } public MaterialIconKind? Icon diff --git a/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageView.axaml b/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageView.axaml index d225f437..c3cc622e 100644 --- a/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageView.axaml +++ b/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageView.axaml @@ -17,7 +17,7 @@ - + @@ -43,6 +43,7 @@ HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="8" + GestureSurface="{Binding #PART_Map}" TouchpadRotationSensitivity="1" /> diff --git a/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageViewModel.cs b/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageViewModel.cs index c0d84b41..6c0cfcc8 100644 --- a/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageViewModel.cs +++ b/src/Asv.Drones/Shell/Pages/FlightMode/FlightModePageViewModel.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; using Asv.Avalonia; using Asv.Avalonia.GeoMap; using Asv.Common; @@ -73,9 +72,20 @@ protected override void AfterLoadExtensions() nameof(Map.CenterMap), x => Map.CenterMap.Value = x, () => Map.CenterMap.Value, - Map.CenterMap + Map.CenterMap.Skip(1) + ); + Layout.Register( + nameof(Map.Zoom), + x => Map.Zoom.Value = x, + () => Map.Zoom.Value, + Map.Zoom.Skip(1) + ); + Layout.Register( + nameof(Map.Rotation), + x => Map.Rotation.Value = x, + () => Map.Rotation.Value, + Map.Rotation.Skip(1) ); - Layout.Register(nameof(Map.Zoom), x => Map.Zoom.Value = x, () => Map.Zoom.Value, Map.Zoom); Layout.LoadWhenRootAttached(RootTracking).AddTo(ref DisposableBag); } }