From a01cdd6dfaf81eecf10d74eb01a56fdb006cbad4 Mon Sep 17 00:00:00 2001 From: LeapwardKoex Date: Sat, 9 Nov 2024 20:30:58 +1300 Subject: [PATCH] Fix calculation for automatic positioning and rendering scales --- Managers/TouchPanelPositionManager.cs | 4 +- TouchPanel.xaml | 98 ++++++++++++++------------- 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/Managers/TouchPanelPositionManager.cs b/Managers/TouchPanelPositionManager.cs index 5d2df10..2dc459f 100644 --- a/Managers/TouchPanelPositionManager.cs +++ b/Managers/TouchPanelPositionManager.cs @@ -36,9 +36,9 @@ public struct RECT { // Calculate the desired size and position based on the other application's window var renderRect = GetLargest916Rect(rect); - var height = renderRect.Width; + var height = renderRect.Height; var left = rect.Left + (rect.Right - rect.Left - renderRect.Width) / 2; // Center horizontally - var top = rect.Bottom - height; + var top = renderRect.Top; return new Rect(left, top, renderRect.Width, height); } } diff --git a/TouchPanel.xaml b/TouchPanel.xaml index efbccc2..4e2fff4 100644 --- a/TouchPanel.xaml +++ b/TouchPanel.xaml @@ -10,65 +10,69 @@ AllowsTransparency="True" WindowStyle="None" Background="Transparent" > - - + + + + + - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + - - - + + - - + + + - - - +