public static void Ungroup(this GroupShapeViewModel group, IList <BaseShapeViewModel>?source) { Ungroup(group.Shapes, source); Ungroup(group.Connectors, source); source?.Remove(@group); }
public override object Copy(IDictionary <object, object>?shared) { var copy = new GroupShapeViewModel(ServiceProvider) { Name = Name, State = State, Style = _style?.CopyShared(shared), IsStroked = IsStroked, IsFilled = IsFilled, Properties = _properties.CopyShared(shared).ToImmutable(), Record = _record, Connectors = _connectors.CopyShared(shared).ToImmutable(), Shapes = _shapes.CopyShared(shared).ToImmutable() }; return(copy); }
public static void Group(this GroupShapeViewModel group, IEnumerable <BaseShapeViewModel>?shapes, IList <BaseShapeViewModel>?source = null) { if (shapes is not null) { foreach (var shape in shapes) { if (shape is PointShapeViewModel pointShapeViewModel) { group.AddConnectorAsNone(pointShapeViewModel); } else { group.AddShape(shape); } source?.Remove(shape); } } source?.Add(@group); }
public static void AddShape(this GroupShapeViewModel group, BaseShapeViewModel shape) { shape.Owner = group; shape.State &= ~ShapeStateFlags.Standalone; group.Shapes = group.Shapes.Add(shape); }