using StructureHelperCommon.Services.ColorServices; using System; using System.Windows.Media; namespace StructureHelperCommon.Models.VisualProperties { /// public class PrimitiveVisualProperty : IPrimitiveVisualProperty { private double opacity = 0; /// public Guid Id { get; } /// public bool IsVisible { get; set; } = true; /// public Color Color { get; set; } = ColorProcessor.GetRandomColor(); /// public int ZIndex { get; set; } = 0; /// public double Opacity { get => opacity; set { if (value < 0) { opacity = 1; return; } if (value > 1) { opacity = 1; return; } opacity = value; } } public PrimitiveVisualProperty(Guid id) { Id = id; } public object Clone() { var logic = new PrimitiveVisualPropertyUpdateStrategy(); PrimitiveVisualProperty newItem = new(Guid.NewGuid()); logic.Update(newItem, this); return newItem; } } }