Fix calculation for automatic positioning and rendering scales
parent
9d06a0293a
commit
a01cdd6dfa
|
@ -36,9 +36,9 @@ class TouchPanelPositionManager
|
||||||
{
|
{
|
||||||
// Calculate the desired size and position based on the other application's window
|
// Calculate the desired size and position based on the other application's window
|
||||||
var renderRect = GetLargest916Rect(rect);
|
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 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);
|
return new Rect(left, top, renderRect.Width, height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,18 @@
|
||||||
AllowsTransparency="True" WindowStyle="None" Background="Transparent"
|
AllowsTransparency="True" WindowStyle="None" Background="Transparent"
|
||||||
>
|
>
|
||||||
<Border Background="#01000000">
|
<Border Background="#01000000">
|
||||||
|
<Grid>
|
||||||
<StackPanel HorizontalAlignment="Left">
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
<Border x:Name="DragWindowHandle" HorizontalAlignment="Left" VerticalAlignment="Top"
|
<Border x:Name="DragWindowHandle" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
Height="50" Background="White" MouseLeftButtonDown="DragBar_MouseLeftButtonDown"
|
Height="50" Background="White" MouseLeftButtonDown="DragBar_MouseLeftButtonDown"
|
||||||
Cursor="SizeAll" Width="70">
|
Cursor="SizeAll" Width="70">
|
||||||
<Label FontSize="24" Content="{Binding LbTouchPanelDrag}" d:Content="Drag" />
|
<Label FontSize="24" Content="{Binding LbTouchPanelDrag}" d:Content="Drag" />
|
||||||
</Border>
|
</Border>
|
||||||
<Viewbox Stretch="Uniform" Opacity="1" Height="1230" VerticalAlignment="Bottom">
|
<DockPanel VerticalAlignment="Bottom">
|
||||||
|
<Viewbox Stretch="Uniform" Opacity="1">
|
||||||
<Canvas x:Name="TouchCanvas" Width="1440" Height="1440">
|
<Canvas x:Name="TouchCanvas" Width="1440" Height="1440">
|
||||||
|
|
||||||
<Polygon Canvas.Left="699" Canvas.Top="6" Points="0,0 39,0 111,5 113,6 111,24 80,243 77,243 63,229 56,221 23,188 16,194 -34,244 -36,244 -70,4 -70,3 0,0" PreviewTouchDown="Element_TouchDown" PreviewTouchMove="Element_TouchMove" PreviewTouchUp="Element_TouchUp" Tag="{x:Static local:TouchValue.D1}" Fill="White" />
|
<Polygon Canvas.Left="699" Canvas.Top="6" Points="0,0 39,0 111,5 113,6 111,24 80,243 77,243 63,229 56,221 23,188 16,194 -34,244 -36,244 -70,4 -70,3 0,0" PreviewTouchDown="Element_TouchDown" PreviewTouchMove="Element_TouchMove" PreviewTouchUp="Element_TouchUp" Tag="{x:Static local:TouchValue.D1}" Fill="White" />
|
||||||
|
@ -60,15 +64,15 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Border x:Name="ResizeGrip"
|
<Border x:Name="ResizeGrip" Width="150" Height="90" Background="White" MouseDown="ResizeGrip_MouseDown" Canvas.Left="1290" Canvas.Top="1350" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
Width="150" Height="90" Background="White"
|
|
||||||
MouseDown="ResizeGrip_MouseDown" Canvas.Left="1290" Canvas.Top="1350" HorizontalAlignment="Center" VerticalAlignment="Top">
|
|
||||||
<Label FontSize="50" Content="{Binding LbTouchPanelResize}" d:Content="Resize" />
|
<Label FontSize="50" Content="{Binding LbTouchPanelResize}" d:Content="Resize" />
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
</Canvas>
|
</Canvas>
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
</StackPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue