Пример #1
0
 public sealed override void UpdateGeometry()
 {
     ScaleThickness = Path.State.HasFlag(ShapeStateFlags.Thickness);
     ScaleSize      = Path.State.HasFlag(ShapeStateFlags.Size);
     Geometry       = PathGeometryConverter.ToSKPath(Path);
     Center         = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY);
 }
Пример #2
0
 public sealed override void UpdateGeometry()
 {
     ScaleThickness = Path.State.HasFlag(ShapeStateFlags.Thickness);
     ScaleSize      = Path.State.HasFlag(ShapeStateFlags.Size);
     Geometry       = PathGeometryConverter.ToGeometryImpl(Path, Path.IsFilled);
     Center         = Geometry.Bounds.Center;
 }
Пример #3
0
 public override void UpdateGeometry()
 {
     ScaleThickness = QuadraticBezier.State.HasFlag(ShapeStateFlags.Thickness);
     ScaleSize      = QuadraticBezier.State.HasFlag(ShapeStateFlags.Size);
     Geometry       = PathGeometryConverter.ToGeometry(QuadraticBezier);
     Center         = Geometry.Bounds.Center;
 }
Пример #4
0
 public override void UpdateGeometry()
 {
     ScaleThickness = QuadraticBezier.State.HasFlag(ShapeStateFlags.Thickness);
     ScaleSize      = QuadraticBezier.State.HasFlag(ShapeStateFlags.Size);
     Geometry       = PathGeometryConverter.ToSKPath(QuadraticBezier);
     Center         = new SKPoint(Geometry.Bounds.MidX, Geometry.Bounds.MidY);
 }
Пример #5
0
 public override void UpdateGeometry()
 {
     ScaleThickness = Ellipse.State.HasFlag(ShapeStateFlags.Thickness);
     ScaleSize      = Ellipse.State.HasFlag(ShapeStateFlags.Size);
     Geometry       = PathGeometryConverter.ToGeometry(Ellipse);
     Rect           = Geometry.Bounds;
     Center         = Geometry.Bounds.Center;
 }
Пример #6
0
        void Initialize()
        {
            var container = new Grid
            {
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Start,
                RowSpacing        = 0,
                Margin            = new Thickness(6)
            };

            _background = new Rectangle
            {
                Fill            = Brush.Transparent,
                HeightRequest   = 18,
                WidthRequest    = 18,
                RadiusX         = 2,
                RadiusY         = 2,
                Stroke          = Color,
                StrokeThickness = 2
            };

            _glyph = new Path
            {
                Aspect            = Stretch.Uniform,
                Stroke            = Brush.White,
                StrokeThickness   = 1,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                HeightRequest     = 14,
                WidthRequest      = 14,
                Opacity           = 0,
                Margin            = new Thickness(2)
            };

            var pathGeometryConverter = new PathGeometryConverter();

            if (_glyph is Path path && pathGeometryConverter.ConvertFromInvariantString("M30.561941,0L31.997,1.393004 10.467954,23.597999 0,15.350999 1.2379759,13.780992 10.287961,20.909952z") is Geometry data)
            {
                path.Data = data;
            }

            container.Children.Add(_background);
            container.Children.Add(_glyph);

            Content = container;

            _tapGestureRecognizer = new TapGestureRecognizer();

            UpdateIsEnabled();
        }
Пример #7
0
    public PathShapeViewModel?ToPathShape(IEnumerable <BaseShapeViewModel>?shapes)
    {
        if (shapes is null)
        {
            return(null);
        }
        var path = PathGeometryConverter.ToSKPath(shapes);

        if (path is null)
        {
            return(null);
        }
        var factory = _serviceProvider.GetService <IViewModelFactory>();
        var first   = shapes.FirstOrDefault();

        if (first is null)
        {
            return(null);
        }
        var style = first?.Style is { } ?