Skip to content

Commit

Permalink
ruler and grid v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tresillocrack committed May 7, 2023
1 parent e26e612 commit 3122921
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 17 deletions.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/Vectorify/v17/.suo
Binary file not shown.
36 changes: 24 additions & 12 deletions Vectorify/Views/RectasPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,25 @@ private void DrawVector(Canvas canvas, double endX, double endY)
double centerX = canvas.ActualWidth / 2;
double centerY = canvas.ActualHeight / 2;

/*// Create a new TranslateTransform to center the canvas
var translate = new TranslateTransform();
translate.X = centerX;
translate.Y = centerY;
canvas.RenderTransform = translate;
*/
// Create a new Line element
var line = new Line();

// Set the start and end points of the line
line.X1 = centerX;
line.Y1 = centerY;
line.X2 = endX;
line.Y2 = endY;

// Set the stroke color and thickness of the line
line.Stroke = new SolidColorBrush(Colors.Red);
line.StrokeThickness = 2;

// Add the line to the canvas
canvas.Children.Add(line);

// Calculate the direction and length of the arrow
double dirX = endX;
double dirY = endY;
double dirX = endX - centerX;
double dirY = endY - centerY;
double length = Math.Sqrt(dirX * dirX + dirY * dirY);

// Calculate the normalized direction of the arrow
Expand Down Expand Up @@ -161,9 +171,9 @@ private void AddGuideLines(Canvas canvas)
{
// Crea una línea horizontal y una vertical que pasen por el centro del canvas
var guideLines = new[] {
new { X1 = -canvas.ActualWidth, Y1 = canvas.ActualHeight/2, X2 = canvas.ActualWidth, Y2 = canvas.ActualHeight/2 },
new { X1 = -canvas.ActualWidth/2, Y1 = -canvas.ActualWidth, X2 = canvas.ActualWidth, Y2 = canvas.ActualHeight }
};
new { X1 = 0.0, Y1 = canvas.ActualHeight / 2, X2 = canvas.ActualWidth, Y2 = canvas.ActualHeight / 2 },
new { X1 = canvas.ActualWidth / 2, Y1 = 0.0, X2 = canvas.ActualWidth / 2, Y2 = canvas.ActualHeight }
};

// Agrega cada línea al canvas
foreach (var line in guideLines)
Expand All @@ -178,9 +188,12 @@ private void AddGuideLines(Canvas canvas)
StrokeThickness = 1,
StrokeDashArray = new DoubleCollection() { 4.0, 2.0 } // línea punteada
};

Canvas.SetZIndex(shape, 100);
canvas.Children.Add(shape);
}


}

private void drawButton_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -214,7 +227,6 @@ private void drawButton_Click(object sender, RoutedEventArgs e)
double endX = double.Parse(ValorX_Vector.Text);
double endY = double.Parse(ValorY_Vector.Text);


// Call the DrawVector method with the canvas and end point
DrawVector(canvas, endX, endY);

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
<AppXManifest Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\AppxManifest.xml">
<PackagePath>AppxManifest.xml</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2023-05-07T21:10:24.533</Modified>
<Modified>2023-05-07T21:12:36.329</Modified>
</AppXManifest>
</ItemGroup>
<ItemGroup>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\resources.pri">
<PackagePath>resources.pri</PackagePath>
<Modified>2023-05-07T21:10:23.961</Modified>
<Modified>2023-05-07T21:12:35.782</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Vectorify.runtimeconfig.json">
<PackagePath>Vectorify.runtimeconfig.json</PackagePath>
Expand All @@ -48,7 +48,7 @@
</AppxPackagedFile>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\apphost.exe">
<PackagePath>Vectorify.exe</PackagePath>
<Modified>2023-05-07T21:10:23.841</Modified>
<Modified>2023-05-07T21:12:35.600</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\bin\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Vectorify.deps.json">
<PackagePath>Vectorify.deps.json</PackagePath>
Expand Down Expand Up @@ -976,7 +976,7 @@
</AppxPackagedFile>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\R2R\Vectorify.dll">
<PackagePath>Vectorify.dll</PackagePath>
<Modified>2023-05-07T21:10:24.392</Modified>
<Modified>2023-05-07T21:12:36.200</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\R2R\Microsoft.Windows.SDK.NET.dll">
<PackagePath>Microsoft.Windows.SDK.NET.dll</PackagePath>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8"?><XamlCompilerSaveState><XamlFeatureControlFlags>EnableDefaultValidationContextGeneration, EnableWin32Codegen, UsingCSWinRT</XamlFeatureControlFlags><ReferenceAssemblyList><LocalAssembly PathName="d:\onedrive - msft\documents\github\vectorify\vectorify\obj\x64\release\net7.0-windows10.0.22621.0\win10-x64\intermediatexaml\vectorify.dll" HashGuid="08abf6c4-1899-3ae7-bd0c-f44d7f902ec8" /><ReferenceAssembly PathName="d:\onedrive - msft\documents\github\vectorify\vectorify.core\bin\x64\release\net7.0\vectorify.core.dll" HashGuid="1b47d86b-cbfa-bb1e-a7a6-859af2360320" /></ReferenceAssemblyList><XamlSourceFileDataList><XamlSourceFileData XamlFileName="App.xaml" ClassFullName="Vectorify.App" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\App" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="MainWindow.xaml" ClassFullName="Vectorify.MainWindow" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\MainWindow" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\FontSizes.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\TextBlock.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\Thickness.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\Calculo_VectorialPage.xaml" ClassFullName="Vectorify.Views.Calculo_VectorialPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\Calculo_VectorialPage" XamlFileTimeAtLastCompileInTicks="638190932898172064" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\MainPage.xaml" ClassFullName="Vectorify.Views.MainPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\MainPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\RectasPage.xaml" ClassFullName="Vectorify.Views.RectasPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\RectasPage" XamlFileTimeAtLastCompileInTicks="638190940540359491" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\SettingsPage.xaml" ClassFullName="Vectorify.Views.SettingsPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\SettingsPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\ShellPage.xaml" ClassFullName="Vectorify.Views.ShellPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\ShellPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /></XamlSourceFileDataList></XamlCompilerSaveState>
<?xml version="1.0" encoding="utf-8"?><XamlCompilerSaveState><XamlFeatureControlFlags>EnableDefaultValidationContextGeneration, EnableWin32Codegen, UsingCSWinRT</XamlFeatureControlFlags><ReferenceAssemblyList><LocalAssembly PathName="d:\onedrive - msft\documents\github\vectorify\vectorify\obj\x64\release\net7.0-windows10.0.22621.0\win10-x64\intermediatexaml\vectorify.dll" HashGuid="6677de09-167c-bd23-6067-92635237bcfe" /><ReferenceAssembly PathName="d:\onedrive - msft\documents\github\vectorify\vectorify.core\bin\x64\release\net7.0\vectorify.core.dll" HashGuid="1b47d86b-cbfa-bb1e-a7a6-859af2360320" /></ReferenceAssemblyList><XamlSourceFileDataList><XamlSourceFileData XamlFileName="App.xaml" ClassFullName="Vectorify.App" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\App" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="MainWindow.xaml" ClassFullName="Vectorify.MainWindow" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\MainWindow" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\FontSizes.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\TextBlock.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Styles\Thickness.xaml" ClassFullName="" GeneratedCodePathPrefix="" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\Calculo_VectorialPage.xaml" ClassFullName="Vectorify.Views.Calculo_VectorialPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\Calculo_VectorialPage" XamlFileTimeAtLastCompileInTicks="638190932898172064" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\MainPage.xaml" ClassFullName="Vectorify.Views.MainPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\MainPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\RectasPage.xaml" ClassFullName="Vectorify.Views.RectasPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\RectasPage" XamlFileTimeAtLastCompileInTicks="638190940540359491" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\SettingsPage.xaml" ClassFullName="Vectorify.Views.SettingsPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\SettingsPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /><XamlSourceFileData XamlFileName="Views\ShellPage.xaml" ClassFullName="Vectorify.Views.ShellPage" GeneratedCodePathPrefix="D:\OneDrive - MSFT\Documents\GitHub\vectorify\Vectorify\obj\x64\Release\net7.0-windows10.0.22621.0\win10-x64\Views\ShellPage" XamlFileTimeAtLastCompileInTicks="638188930120000000" HasBoundEventAssignments="False" /></XamlSourceFileDataList></XamlCompilerSaveState>
Binary file not shown.
Binary file not shown.

0 comments on commit 3122921

Please sign in to comment.