Fixed up the text creation placement

This commit is contained in:
Matěj Kubíček
2026-04-10 12:46:06 +02:00
parent 2bd215c91a
commit 9a97079945
4 changed files with 14 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

+2 -2
View File
@@ -42,8 +42,8 @@
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<ComboBox x:Name="LangCombo" Width="70" Height="30" SelectionChanged="LangCombo_SelectionChanged"> <ComboBox x:Name="LangCombo" Width="70" Height="30" SelectionChanged="LangCombo_SelectionChanged">
<ComboBoxItem Tag="en">EN</ComboBoxItem> <ComboBoxItem Tag="en" IsSelected="True">EN</ComboBoxItem>
<ComboBoxItem Tag="cs" IsSelected="True">CZ</ComboBoxItem> <ComboBoxItem Tag="cs">CZ</ComboBoxItem>
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
</DockPanel> </DockPanel>
+8 -1
View File
@@ -607,7 +607,14 @@ namespace NetworkDiagram
private void WireTool_Click(object sender, RoutedEventArgs e) => _activeTool = ConnectionType.Wire; private void WireTool_Click(object sender, RoutedEventArgs e) => _activeTool = ConnectionType.Wire;
private void WifiTool_Click(object sender, RoutedEventArgs e) => _activeTool = ConnectionType.Wifi; private void WifiTool_Click(object sender, RoutedEventArgs e) => _activeTool = ConnectionType.Wifi;
private void AddText_Click(object sender, RoutedEventArgs e) => AddDeviceToCanvas(new DeviceTemplate { Name = "Note", IconPath = "" }, 100, 100); private void AddText_Click(object sender, RoutedEventArgs e)
{
// Center of the current viewport in canvas coordinates
double centerX = (CanvasViewport.ActualWidth / 2 - CanvasTranslate.X) / CanvasScale.ScaleX;
double centerY = (CanvasViewport.ActualHeight / 2 - CanvasTranslate.Y) / CanvasScale.ScaleY;
AddDeviceToCanvas(new DeviceTemplate { Name = "Note", IconPath = "" }, centerX, centerY);
}
private void ExportPng_Click(object sender, RoutedEventArgs e) private void ExportPng_Click(object sender, RoutedEventArgs e)
{ {
+4
View File
@@ -54,5 +54,9 @@
{ {
"Name": "Wireless Router", "Name": "Wireless Router",
"IconPath": "Assets/wireless router.jpg" "IconPath": "Assets/wireless router.jpg"
},
{
"Name": "Video camera",
"IconPath": "Assets/video camera.jpg"
} }
] ]