mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-24 14:50:10 +00:00
Update circle overlay logic
This commit is contained in:
parent
0e68f686b4
commit
419262da61
3 changed files with 30 additions and 16 deletions
|
@ -48,7 +48,6 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
||||||
if (panel?.PanelId == panelConfig.Id)
|
if (panel?.PanelId == panelConfig.Id)
|
||||||
{
|
{
|
||||||
panel.Close();
|
panel.Close();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,6 +113,9 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
||||||
|
|
||||||
Application.Current.Dispatcher.Invoke(() =>
|
Application.Current.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
// Remove existing overlay if exist
|
||||||
|
HandleRemoveOverlay(this, panelConfig);
|
||||||
|
|
||||||
PanelCoorOverlay overlay = new PanelCoorOverlay(panelConfig.Id, !nonEdit);
|
PanelCoorOverlay overlay = new PanelCoorOverlay(panelConfig.Id, !nonEdit);
|
||||||
overlay.IsEditingPanelLocation = true;
|
overlay.IsEditingPanelLocation = true;
|
||||||
overlay.WindowStartupLocation = WindowStartupLocation.Manual;
|
overlay.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||||
|
|
|
@ -18,6 +18,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
private AppSettingData _appSettingData;
|
private AppSettingData _appSettingData;
|
||||||
private FlightSimData _flightSimData;
|
private FlightSimData _flightSimData;
|
||||||
private int _prePanelConfigurationCockpitZoomLevel = 50;
|
private int _prePanelConfigurationCockpitZoomLevel = 50;
|
||||||
|
private bool _isEditingPanelSourceLock = false;
|
||||||
|
|
||||||
public PanelSourceOrchestrator(ProfileData profileData, AppSettingData appSettingData, FlightSimData flightSimData)
|
public PanelSourceOrchestrator(ProfileData profileData, AppSettingData appSettingData, FlightSimData flightSimData)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +50,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
public void StartPanelSelection(PanelConfig panelConfig)
|
public void StartPanelSelection(PanelConfig panelConfig)
|
||||||
{
|
{
|
||||||
_profileData.ActiveProfile.IsEditingPanelSource = true;
|
ActiveProfile.IsEditingPanelSource = true;
|
||||||
|
|
||||||
InputHookManager.OnLeftClick += (sender, e) => HandleOnPanelSelectionAdded(panelConfig, e);
|
InputHookManager.OnLeftClick += (sender, e) => HandleOnPanelSelectionAdded(panelConfig, e);
|
||||||
InputHookManager.StartMouseHook();
|
InputHookManager.StartMouseHook();
|
||||||
|
@ -57,6 +58,11 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
public async Task StartEditPanelSources()
|
public async Task StartEditPanelSources()
|
||||||
{
|
{
|
||||||
|
if (_isEditingPanelSourceLock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isEditingPanelSourceLock = true;
|
||||||
|
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
// Set Windowed Display Mode window's configuration if needed
|
// Set Windowed Display Mode window's configuration if needed
|
||||||
|
@ -79,24 +85,22 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
|
|
||||||
WindowActionManager.BringWindowToForeground(ApplicationHandle);
|
WindowActionManager.BringWindowToForeground(ApplicationHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var panel in _profileData.ActiveProfile.PanelConfigs)
|
||||||
|
{
|
||||||
|
if (panel.HasPanelSource)
|
||||||
|
OnOverlayShowed?.Invoke(this, panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn off TrackIR if TrackIR is started
|
||||||
|
FlightSimOrchestrator.TurnOffTrackIR();
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var panel in _profileData.ActiveProfile.PanelConfigs)
|
|
||||||
{
|
|
||||||
if (panel.HasPanelSource)
|
|
||||||
OnOverlayShowed?.Invoke(this, panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turn off TrackIR if TrackIR is started
|
|
||||||
FlightSimOrchestrator.TurnOffTrackIR();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task EndEditPanelSources()
|
public async Task EndEditPanelSources()
|
||||||
{
|
{
|
||||||
foreach (var panel in _profileData.ActiveProfile.PanelConfigs)
|
if (!_isEditingPanelSourceLock)
|
||||||
{
|
return;
|
||||||
OnOverlayRemoved?.Invoke(this, panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save last auto panning camera angle
|
// Save last auto panning camera angle
|
||||||
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
if (AppSetting.PopOutSetting.AutoPanning.IsEnabled)
|
||||||
|
@ -113,11 +117,17 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
{
|
{
|
||||||
// !!! Fix MSFS bug that without setting zoom, everything will be off by few pixels at a time
|
// !!! Fix MSFS bug that without setting zoom, everything will be off by few pixels at a time
|
||||||
SetCockpitZoomLevel(_flightSimData.CockpitCameraZoom);
|
SetCockpitZoomLevel(_flightSimData.CockpitCameraZoom);
|
||||||
|
|
||||||
InputEmulationManager.SaveCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
InputEmulationManager.SaveCustomView(AppSetting.PopOutSetting.AutoPanning.KeyBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isEditingPanelSourceLock = false;
|
||||||
|
|
||||||
|
foreach (var panel in _profileData.ActiveProfile.PanelConfigs)
|
||||||
|
{
|
||||||
|
OnOverlayRemoved?.Invoke(this, panel);
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
Thread.Sleep(500); // wait for custom view save to be completed
|
Thread.Sleep(500); // wait for custom view save to be completed
|
||||||
|
@ -146,6 +156,7 @@ namespace MSFSPopoutPanelManager.Orchestration
|
||||||
if (ActiveProfile != null)
|
if (ActiveProfile != null)
|
||||||
{
|
{
|
||||||
ActiveProfile.IsEditingPanelSource = false;
|
ActiveProfile.IsEditingPanelSource = false;
|
||||||
|
_isEditingPanelSourceLock = false;
|
||||||
|
|
||||||
foreach (var panelConfig in ActiveProfile.PanelConfigs)
|
foreach (var panelConfig in ActiveProfile.PanelConfigs)
|
||||||
OnOverlayRemoved?.Invoke(this, panelConfig);
|
OnOverlayRemoved?.Invoke(this, panelConfig);
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace MSFSPopoutPanelManager.WindowsAgent
|
||||||
Debug.WriteLine($"Pop out panel at: {x}/{y} ...");
|
Debug.WriteLine($"Pop out panel at: {x}/{y} ...");
|
||||||
|
|
||||||
PInvoke.SetForegroundWindow(WindowProcessManager.SimulatorProcess.Handle);
|
PInvoke.SetForegroundWindow(WindowProcessManager.SimulatorProcess.Handle);
|
||||||
|
Thread.Sleep(200);
|
||||||
|
|
||||||
MoveAppWindowFromLeftClickPoint(x, y);
|
MoveAppWindowFromLeftClickPoint(x, y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue