using CommunityToolkit.Mvvm.ComponentModel;
using System.ComponentModel;
namespace CtrEditor.Models
{
///
/// Configuración del entorno de trabajo que se guarda por imagen.
/// Incluye posiciones de splitters, canvas, zoom y otras configuraciones del workspace.
///
public partial class WorkspaceConfiguration : ObservableObject
{
[ObservableProperty]
[property: Description("Height of the 3D view row in pixels")]
[property: Category("Splitters:")]
private double gridSplitterPosition = 100.0; // Valor por defecto en píxeles
[ObservableProperty]
[property: Description("X position of the canvas center in pixels")]
[property: Category("Canvas Position:")]
private double canvasCenterX = 0.0;
[ObservableProperty]
[property: Description("Y position of the canvas center in pixels")]
[property: Category("Canvas Position:")]
private double canvasCenterY = 0.0;
[ObservableProperty]
[property: Description("Current zoom level of the canvas")]
[property: Category("Canvas View:")]
private double zoomLevel = 1.0;
[ObservableProperty]
[property: Description("X offset of the canvas")]
[property: Category("Canvas View:")]
private double canvasOffsetX = 0.0;
[ObservableProperty]
[property: Description("Y offset of the canvas")]
[property: Category("Canvas View:")]
private double canvasOffsetY = 0.0;
[ObservableProperty]
[property: Description("Whether 3D updates are enabled")]
[property: Category("3D Settings:")]
private bool is3DUpdateEnabled = true;
[ObservableProperty]
[property: Description("Horizontal scroll position of the canvas")]
[property: Category("Canvas View:")]
private double horizontalScrollOffset = 0.0;
[ObservableProperty]
[property: Description("Vertical scroll position of the canvas")]
[property: Category("Canvas View:")]
private double verticalScrollOffset = 0.0;
///
/// Constructor por defecto con valores iniciales
///
public WorkspaceConfiguration()
{
// Valores por defecto ya establecidos en las propiedades
}
///
/// Crea una copia de la configuración actual
///
/// Nueva instancia con los mismos valores
public WorkspaceConfiguration Clone()
{
return new WorkspaceConfiguration
{
GridSplitterPosition = this.GridSplitterPosition,
CanvasCenterX = this.CanvasCenterX,
CanvasCenterY = this.CanvasCenterY,
ZoomLevel = this.ZoomLevel,
CanvasOffsetX = this.CanvasOffsetX,
CanvasOffsetY = this.CanvasOffsetY,
Is3DUpdateEnabled = this.Is3DUpdateEnabled,
HorizontalScrollOffset = this.HorizontalScrollOffset,
VerticalScrollOffset = this.VerticalScrollOffset
};
}
///
/// Copia los valores de otra configuración
///
/// Configuración fuente
public void CopyFrom(WorkspaceConfiguration source)
{
if (source == null) return;
GridSplitterPosition = source.GridSplitterPosition;
CanvasCenterX = source.CanvasCenterX;
CanvasCenterY = source.CanvasCenterY;
ZoomLevel = source.ZoomLevel;
CanvasOffsetX = source.CanvasOffsetX;
CanvasOffsetY = source.CanvasOffsetY;
Is3DUpdateEnabled = source.Is3DUpdateEnabled;
HorizontalScrollOffset = source.HorizontalScrollOffset;
VerticalScrollOffset = source.VerticalScrollOffset;
}
}
}