diff --git a/FuncionesBase/ZIndexEnum.cs b/FuncionesBase/ZIndexEnum.cs new file mode 100644 index 0000000..a9608f1 --- /dev/null +++ b/FuncionesBase/ZIndexEnum.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CtrEditor.FuncionesBase +{ + public enum ZIndexEnum + { + Decorativos = 1, + Estaticos = 2, + Generadores = 3, + Guias = 4, + Dinamicos = 10, + Descarte = 11, + Fotocelula = 12, + Trace = 13, + RectangulosPropiead = 14 + } +} diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index e6faa6e..8c9ccef 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -14,6 +14,7 @@ using DocumentFormat.OpenXml.Spreadsheet; using System.Windows.Shapes; using System.Numerics; using CommunityToolkit.Mvvm.Input; +using CtrEditor.FuncionesBase; namespace CtrEditor { @@ -102,7 +103,7 @@ namespace CtrEditor SuscribirEventos(userControl); // Añade el UserControl al Canvas - Canvas.SetZIndex(userControl, dataContainer.ZIndex()); + Canvas.SetZIndex(userControl, ((int)dataContainer.ZIndex())); ImagenEnTrabajoCanvas.Children.Add(userControl); } } @@ -338,6 +339,7 @@ namespace CtrEditor resizeRectangles.Add(rect); ImagenEnTrabajoCanvas.Children.Add(rect); + Canvas.SetZIndex(rect, ((int)ZIndexEnum.RectangulosPropiead)); ResetTimerRemoveResizeRectangles(); } @@ -541,17 +543,17 @@ namespace CtrEditor double deltaX = currentPosition.X - transformedBoundingBoxCenter.X; double deltaY = currentPosition.Y - transformedBoundingBoxCenter.Y; double angle = Math.Atan2(deltaY, deltaX) * (180 / Math.PI); - if (lastAngle == 0 && angle != 0) lastAngle = (float)angle; + if ((lastAngle == 0 && angle != 0) || Math.Abs(angle - lastAngle) > 45) lastAngle = (float)angle; + else + { + mvBase.Rotate(angle - lastAngle); + lastAngle = (float)angle; - mvBase.Rotate(angle - lastAngle); -// dataContainer.Rotate((float)angle - lastAngle); - lastAngle = (float)angle; - - - dataDebug.TransformedBoundingBoxCenter = transformedBoundingBoxCenter; - dataDebug.LastAngle = lastAngle; - dataDebug.CurrentPosition = currentPosition; - dataDebug.Angle = (float)angle; + dataDebug.TransformedBoundingBoxCenter = transformedBoundingBoxCenter; + dataDebug.LastAngle = lastAngle; + dataDebug.CurrentPosition = currentPosition; + dataDebug.Angle = (float)angle; + } } if (ActivateSizeWidth || ActivateSizeHeight) { @@ -789,7 +791,15 @@ namespace CtrEditor UserControlFactory.LimpiarPropiedadesosDatos(PanelEdicion); if (e.AddedItems.Count > 0 && e.AddedItems[0] is osBase selectedObject) + { + if (selectedObject.VisualRepresentation != null) + { + _currentDraggingControl = selectedObject.VisualRepresentation; + AddResizeRectangles(_currentDraggingControl); + } CargarPropiedadesosDatos(selectedObject); + + } } } diff --git a/ObjetosSim/Decorativos/ucTextPlate.xaml.cs b/ObjetosSim/Decorativos/ucTextPlate.xaml.cs index ecfb861..bd93c5f 100644 --- a/ObjetosSim/Decorativos/ucTextPlate.xaml.cs +++ b/ObjetosSim/Decorativos/ucTextPlate.xaml.cs @@ -2,6 +2,7 @@ using System.Windows.Controls; using System.Windows.Media; using CommunityToolkit.Mvvm.ComponentModel; +using CtrEditor.FuncionesBase; using Newtonsoft.Json; @@ -85,9 +86,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Decorativos; } } diff --git a/ObjetosSim/Dinamicos/ucBotella.xaml.cs b/ObjetosSim/Dinamicos/ucBotella.xaml.cs index e478e2c..362c34f 100644 --- a/ObjetosSim/Dinamicos/ucBotella.xaml.cs +++ b/ObjetosSim/Dinamicos/ucBotella.xaml.cs @@ -7,6 +7,7 @@ using CtrEditor.Simulacion; using CommunityToolkit.Mvvm.ComponentModel; using nkast.Aether.Physics2D.Common; using System.Windows.Media; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -32,11 +33,7 @@ namespace CtrEditor.ObjetosSim set => SetProperty(ref nombre, value); } - public override void TopChanged(float value) { - UpdateAfterMove(); - } - - public override void LeftChanged(float value) + public override void OnMove(float LeftPixels, float TopPixels) { UpdateAfterMove(); } @@ -182,9 +179,9 @@ namespace CtrEditor.ObjetosSim } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Dinamicos; } } } diff --git a/ObjetosSim/Dinamicos/ucBotellaCuello.xaml.cs b/ObjetosSim/Dinamicos/ucBotellaCuello.xaml.cs index aca68b2..f360826 100644 --- a/ObjetosSim/Dinamicos/ucBotellaCuello.xaml.cs +++ b/ObjetosSim/Dinamicos/ucBotellaCuello.xaml.cs @@ -7,6 +7,7 @@ using CtrEditor.Simulacion; using CommunityToolkit.Mvvm.ComponentModel; using nkast.Aether.Physics2D.Common; using System.Windows.Media; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -170,9 +171,9 @@ namespace CtrEditor.ObjetosSim } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Dinamicos; } } } diff --git a/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs b/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs index 2d1aa54..b2694e5 100644 --- a/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs +++ b/ObjetosSim/Emuladores/ucBottGenerator.xaml.cs @@ -3,6 +3,7 @@ using System.Windows; using System.Windows.Controls; using CommunityToolkit.Mvvm.ComponentModel; using System.Diagnostics; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -172,9 +173,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Generadores; } } diff --git a/ObjetosSim/Emuladores/ucFiller.xaml.cs b/ObjetosSim/Emuladores/ucFiller.xaml.cs index b7734be..2e77304 100644 --- a/ObjetosSim/Emuladores/ucFiller.xaml.cs +++ b/ObjetosSim/Emuladores/ucFiller.xaml.cs @@ -4,6 +4,7 @@ using System.Windows; using System.Windows.Controls; using CommunityToolkit.Mvvm.ComponentModel; using System.Diagnostics; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -180,9 +181,9 @@ namespace CtrEditor.ObjetosSim } } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Generadores; } } diff --git a/ObjetosSim/Emuladores/ucTanque.xaml.cs b/ObjetosSim/Emuladores/ucTanque.xaml.cs index acec13f..d1cd58c 100644 --- a/ObjetosSim/Emuladores/ucTanque.xaml.cs +++ b/ObjetosSim/Emuladores/ucTanque.xaml.cs @@ -1,8 +1,8 @@ using CommunityToolkit.Mvvm.ComponentModel; - using LibS7Adv; using System.Windows; using System.Windows.Controls; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -105,9 +105,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Generadores; } } } diff --git a/ObjetosSim/Estaticos/ucDescarte.xaml.cs b/ObjetosSim/Estaticos/ucDescarte.xaml.cs index b843e8a..7c9cf2d 100644 --- a/ObjetosSim/Estaticos/ucDescarte.xaml.cs +++ b/ObjetosSim/Estaticos/ucDescarte.xaml.cs @@ -6,6 +6,7 @@ using System.Windows.Controls; using nkast.Aether.Physics2D.Common; using System.Windows.Media.Animation; using CommunityToolkit.Mvvm.ComponentModel; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { /// @@ -130,9 +131,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Descarte; } } diff --git a/ObjetosSim/Estaticos/ucGuia.xaml.cs b/ObjetosSim/Estaticos/ucGuia.xaml.cs index 163f8d1..713f43f 100644 --- a/ObjetosSim/Estaticos/ucGuia.xaml.cs +++ b/ObjetosSim/Estaticos/ucGuia.xaml.cs @@ -4,6 +4,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using LibS7Adv; using CtrEditor.Simulacion; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -90,9 +91,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 3; + return ZIndexEnum.Guias; } } diff --git a/ObjetosSim/Estaticos/ucTransporteCurva.xaml.cs b/ObjetosSim/Estaticos/ucTransporteCurva.xaml.cs index 14f5554..c486aa4 100644 --- a/ObjetosSim/Estaticos/ucTransporteCurva.xaml.cs +++ b/ObjetosSim/Estaticos/ucTransporteCurva.xaml.cs @@ -5,6 +5,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using LibS7Adv; using CtrEditor.Simulacion; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -182,9 +183,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } } diff --git a/ObjetosSim/Estaticos/ucTransporteGuias.xaml.cs b/ObjetosSim/Estaticos/ucTransporteGuias.xaml.cs index d6b3120..d672ca9 100644 --- a/ObjetosSim/Estaticos/ucTransporteGuias.xaml.cs +++ b/ObjetosSim/Estaticos/ucTransporteGuias.xaml.cs @@ -6,6 +6,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using LibS7Adv; using CtrEditor.Simulacion; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -211,10 +212,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/Estaticos/ucTransporteGuiasUnion.xaml.cs b/ObjetosSim/Estaticos/ucTransporteGuiasUnion.xaml.cs index bd72f1f..4fce5aa 100644 --- a/ObjetosSim/Estaticos/ucTransporteGuiasUnion.xaml.cs +++ b/ObjetosSim/Estaticos/ucTransporteGuiasUnion.xaml.cs @@ -8,6 +8,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using LibS7Adv; using CtrEditor.Simulacion; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -379,10 +380,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs b/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs index f7fa45e..f66be55 100644 --- a/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs +++ b/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs @@ -5,6 +5,7 @@ using LibS7Adv; using CtrEditor.Simulacion; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using System.ComponentModel; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -180,11 +181,12 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } + } diff --git a/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs b/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs index 20ed318..a337a22 100644 --- a/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs +++ b/ObjetosSim/Estaticos/ucVMmotorSim.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Controls; using System.Windows.Media; using Newtonsoft.Json; using CommunityToolkit.Mvvm.ComponentModel; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -150,10 +151,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } public class VMSimMotor diff --git a/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs b/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs index 602fb38..801ab81 100644 --- a/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs +++ b/ObjetosSim/Extraccion Datos/ucBuscarCoincidencias.xaml.cs @@ -24,6 +24,7 @@ using ClosedXML.Excel; using DocumentFormat.OpenXml.Spreadsheet; using Colors = System.Windows.Media.Colors; using DocumentFormat.OpenXml.Drawing.Charts; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim.Extraccion_Datos { @@ -418,9 +419,9 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } } diff --git a/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs b/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs index 65072c6..8297d2f 100644 --- a/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs +++ b/ObjetosSim/Extraccion Datos/ucExtraccionTag.xaml.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using System.ComponentModel; using ClosedXML.Excel; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim.Extraccion_Datos { @@ -221,11 +222,12 @@ namespace CtrEditor.ObjetosSim.Extraccion_Datos datos.Angulo += Angle; } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 1; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/SensoresComandos/ucBoton.xaml.cs b/ObjetosSim/SensoresComandos/ucBoton.xaml.cs index 9ab42af..2c89e25 100644 --- a/ObjetosSim/SensoresComandos/ucBoton.xaml.cs +++ b/ObjetosSim/SensoresComandos/ucBoton.xaml.cs @@ -5,6 +5,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -182,9 +183,10 @@ namespace CtrEditor.ObjetosSim } } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/SensoresComandos/ucGearEncoder.xaml.cs b/ObjetosSim/SensoresComandos/ucGearEncoder.xaml.cs index 4332c52..3b2e1f3 100644 --- a/ObjetosSim/SensoresComandos/ucGearEncoder.xaml.cs +++ b/ObjetosSim/SensoresComandos/ucGearEncoder.xaml.cs @@ -7,6 +7,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using System.Diagnostics; using Xceed.Wpf.Toolkit.PropertyGrid.Attributes; using System.ComponentModel; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -237,10 +238,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs b/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs index b779ee9..d26f630 100644 --- a/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs +++ b/ObjetosSim/SensoresComandos/ucPhotocell.xaml.cs @@ -6,6 +6,7 @@ using System.Windows.Controls; using System.Windows.Media; using CommunityToolkit.Mvvm.ComponentModel; using System.Diagnostics; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim @@ -213,10 +214,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 16; + return ZIndexEnum.Fotocelula; } + } } diff --git a/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs b/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs index e066182..497f580 100644 --- a/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs +++ b/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs @@ -4,6 +4,7 @@ using LibS7Adv; using System.ComponentModel; using System.Windows; using System.Windows.Controls; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -87,9 +88,10 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/TagsSignals/ucAnalogTag.xaml.cs b/ObjetosSim/TagsSignals/ucAnalogTag.xaml.cs index 0adefe1..1ca40c4 100644 --- a/ObjetosSim/TagsSignals/ucAnalogTag.xaml.cs +++ b/ObjetosSim/TagsSignals/ucAnalogTag.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Controls; using System.Windows.Media; using CommunityToolkit.Mvvm.ComponentModel; using Newtonsoft.Json.Linq; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -124,9 +125,9 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } } } diff --git a/ObjetosSim/TagsSignals/ucBoolTag.xaml.cs b/ObjetosSim/TagsSignals/ucBoolTag.xaml.cs index 44d05f1..fec58b3 100644 --- a/ObjetosSim/TagsSignals/ucBoolTag.xaml.cs +++ b/ObjetosSim/TagsSignals/ucBoolTag.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Controls; using System.Windows.Media; using CommunityToolkit.Mvvm.ComponentModel; using Newtonsoft.Json.Linq; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -104,9 +105,10 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } } diff --git a/ObjetosSim/TagsSignals/ucConsensGeneric.xaml.cs b/ObjetosSim/TagsSignals/ucConsensGeneric.xaml.cs index 73eca02..751732c 100644 --- a/ObjetosSim/TagsSignals/ucConsensGeneric.xaml.cs +++ b/ObjetosSim/TagsSignals/ucConsensGeneric.xaml.cs @@ -1,8 +1,7 @@ using CommunityToolkit.Mvvm.ComponentModel; - -using LibS7Adv; using System.Windows; using System.Windows.Controls; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim @@ -70,10 +69,11 @@ namespace CtrEditor.ObjetosSim Datos?.ucUnLoaded(); } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Estaticos; } + } public class TagsConsensos diff --git a/ObjetosSim/Traces/ucTrace3.xaml.cs b/ObjetosSim/Traces/ucTrace3.xaml.cs index 6a1c9fe..b68042b 100644 --- a/ObjetosSim/Traces/ucTrace3.xaml.cs +++ b/ObjetosSim/Traces/ucTrace3.xaml.cs @@ -6,6 +6,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using System.Windows.Shapes; using LibS7Adv; using System.Runtime.Intrinsics; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -294,9 +295,10 @@ namespace CtrEditor.ObjetosSim } public float Angle() { return 0; } public void Rotate(float Angle) { } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Trace; } + } } diff --git a/ObjetosSim/Traces/ucTraceSimple.xaml.cs b/ObjetosSim/Traces/ucTraceSimple.xaml.cs index 6faf3a9..79c45b5 100644 --- a/ObjetosSim/Traces/ucTraceSimple.xaml.cs +++ b/ObjetosSim/Traces/ucTraceSimple.xaml.cs @@ -10,6 +10,7 @@ using LiveChartsCore; using LiveChartsCore.SkiaSharpView; using LiveChartsCore.Defaults; using System.Diagnostics; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -159,10 +160,11 @@ namespace CtrEditor.ObjetosSim } public float Angle() { return 0; } public void Rotate(float Angle) { } public void Highlight(bool State) { } - public int ZIndex() + public ZIndexEnum ZIndex() { - return 10; + return ZIndexEnum.Trace; } + } } diff --git a/ObjetosSim/osBase.cs b/ObjetosSim/osBase.cs index e4e344d..2aa5510 100644 --- a/ObjetosSim/osBase.cs +++ b/ObjetosSim/osBase.cs @@ -22,6 +22,8 @@ using Newtonsoft.Json; using JsonIgnoreAttribute = Newtonsoft.Json.JsonIgnoreAttribute; using System.Collections.ObjectModel; using ItemCollection = Xceed.Wpf.Toolkit.PropertyGrid.Attributes.ItemCollection; +using nkast.Aether.Physics2D.Dynamics.Joints; +using CtrEditor.FuncionesBase; namespace CtrEditor.ObjetosSim { @@ -36,7 +38,7 @@ namespace CtrEditor.ObjetosSim [JsonIgnore] osBase? Datos { get; set; } void Highlight(bool State); - int ZIndex(); + ZIndexEnum ZIndex(); } public class DataSaveToSerialize @@ -163,8 +165,16 @@ namespace CtrEditor.ObjetosSim OnResize(Delta_W, Delta_H); - Ancho += Delta_W; - Alto += Delta_H; + if ((Angulo >= 45 && Angulo <= 135) || (Angulo >= 225 && Angulo <= 315)) + { + Ancho += Delta_H; + Alto += Delta_W; + } + else + { + Ancho += Delta_W; + Alto += Delta_H; + } if (Ancho < 0.01f) Ancho = 0.01f; if (Alto < 0.01f) Alto = 0.01f; } @@ -188,8 +198,13 @@ namespace CtrEditor.ObjetosSim } public void Rotate(float Delta_Angle) { - OnRotate(Delta_Angle); Angulo += Delta_Angle; + if (Angulo <= -360) + Angulo += 360; + if (Angulo >= 360) + Angulo -= 360; + + OnRotate(Delta_Angle); } public virtual void OnRotate(float Delta_Angle) { }