mirror of
https://github.com/MathiasLui/CSGO-Projects.git
synced 2025-05-06 13:51:18 +00:00
Zoom reset if window size changes while zoomed
* Was causing that the map might not be visible and move in weird amounts
This commit is contained in:
parent
d38a5bdf21
commit
9642b8cd74
28 changed files with 29 additions and 10 deletions
Binary file not shown.
|
@ -5,7 +5,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Damage_Calculator"
|
||||
mc:Ignorable="d"
|
||||
Title="CS:GO Damage Calculator" Height="566" Width="826" MinHeight="700" MinWidth="700"
|
||||
Title="CS:GO Damage Calculator" Height="566" Width="877" MinHeight="700" MinWidth="700"
|
||||
Style="{DynamicResource CustomWindowStyle}"
|
||||
WindowStartupLocation="CenterScreen" Icon="27.ico"
|
||||
WindowState="Maximized"
|
||||
|
@ -119,7 +119,7 @@
|
|||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<local:ZoomBorder x:Name="rightZoomBorder" Grid.Row="1" Grid.Column="1" Margin="10" ClipToBounds="True">
|
||||
<local:ZoomBorder x:Name="rightZoomBorder" Grid.Row="1" Grid.Column="1" Margin="10" ClipToBounds="True" SizeChanged="rightZoomBorder_SizeChanged">
|
||||
<Grid>
|
||||
<Image x:Name="mapImage" MouseLeftButtonUp="mapImage_MouseLeftButtonUp" HorizontalAlignment="Center" VerticalAlignment="Center" MouseRightButtonUp="mapImage_MouseRightButtonUp" LayoutUpdated="mapImage_LayoutUpdated" />
|
||||
<Canvas x:Name="pointsCanvas" Width="{Binding ActualWidth, ElementName=mapImage, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=mapImage, Mode=OneWay}" />
|
||||
|
|
|
@ -1022,6 +1022,18 @@ namespace Damage_Calculator
|
|||
this.rightZoomBorder.KeyUp(sender, e);
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void rightZoomBorder_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if(rightZoomBorder.Width < rightZoomBorder.Height)
|
||||
{
|
||||
rightZoomBorder.Height = rightZoomBorder.ActualWidth;
|
||||
}
|
||||
if (rightZoomBorder.IsZoomed)
|
||||
{
|
||||
rightZoomBorder.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum eDrawMode { Shooting, Bomb }
|
||||
|
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.1")]
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Damage_Calculator
|
|||
private Point start;
|
||||
private bool isSpacebarPressed = false;
|
||||
|
||||
public bool IsZoomed { get; set; }
|
||||
|
||||
private TranslateTransform GetTranslateTransform(UIElement element)
|
||||
{
|
||||
return (TranslateTransform)((TransformGroup)element.RenderTransform)
|
||||
|
@ -102,7 +104,10 @@ namespace Damage_Calculator
|
|||
|
||||
double zoom = e.Delta > 0 ? .2 : -.2;
|
||||
if (!(e.Delta > 0) && (st.ScaleX < 1 || st.ScaleY < 1))
|
||||
{
|
||||
this.IsZoomed = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Point relative = e.GetPosition(child);
|
||||
double absoluteX;
|
||||
|
@ -116,6 +121,8 @@ namespace Damage_Calculator
|
|||
|
||||
tt.X = absoluteX - relative.X * st.ScaleX;
|
||||
tt.Y = absoluteY - relative.Y * st.ScaleY;
|
||||
|
||||
this.IsZoomed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\Help.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "CF02F48AC6AFCD67163F820051C38428BBB1384D24C7CE423D2B4F3FD2844568"
|
||||
#pragma checksum "..\..\Help.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "315BB8A752151A28FB840C01C842E1FDC350EDA4B2F1BB5B03A031E9F79A4275"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\Help.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "CF02F48AC6AFCD67163F820051C38428BBB1384D24C7CE423D2B4F3FD2844568"
|
||||
#pragma checksum "..\..\Help.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "315BB8A752151A28FB840C01C842E1FDC350EDA4B2F1BB5B03A031E9F79A4275"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8B56867D804DB77B31091EAB1DAB861F112C61A38874ACF36D4E0788B86393FC"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DDEB88E6BF2411090CEFE97ECD05FAC168A9400B7A2D3FEBF6EE291BC90C4F86"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8B56867D804DB77B31091EAB1DAB861F112C61A38874ACF36D4E0788B86393FC"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DDEB88E6BF2411090CEFE97ECD05FAC168A9400B7A2D3FEBF6EE291BC90C4F86"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8B56867D804DB77B31091EAB1DAB861F112C61A38874ACF36D4E0788B86393FC"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DDEB88E6BF2411090CEFE97ECD05FAC168A9400B7A2D3FEBF6EE291BC90C4F86"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8B56867D804DB77B31091EAB1DAB861F112C61A38874ACF36D4E0788B86393FC"
|
||||
#pragma checksum "..\..\MainWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "DDEB88E6BF2411090CEFE97ECD05FAC168A9400B7A2D3FEBF6EE291BC90C4F86"
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue