示例#1
0
        internal static void UpdateMauiDrawable(this AView platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null;

            if (!hasBorder)
            {
                return;
            }

            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            if (mauiDrawable == null)
            {
                mauiDrawable = new MauiDrawable(platformView.Context);

                platformView.Background = mauiDrawable;
            }

            if (border is IView v)
            {
                mauiDrawable.SetBackground(v.Background);
            }
            else
            {
                mauiDrawable.SetBackground(new SolidPaint(Colors.Transparent));
            }

            mauiDrawable.SetBorderShape(border.Shape);

            if (platformView is ContentViewGroup contentViewGroup)
            {
                contentViewGroup.Clip = border;
            }
        }
示例#2
0
        public static void UpdateBackground(this ContentView platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (hasBorder)
            {
                platformView.UpdateMauiCALayer(border);
            }
        }
示例#3
0
        public static void UpdateStrokeLineCap(this EvasObject platformView, IBorderStroke border)
        {
            var  canvas    = platformView as BorderView;
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (canvas == null && !hasBorder)
            {
                return;
            }
            platformView.UpdateMauiDrawable(border);
        }
示例#4
0
        public static void UpdateStrokeShape(this ContentPanel platformView, IBorderStroke border)
        {
            var shape = border.Shape;

            if (shape == null)
            {
                return;
            }

            platformView.UpdateBorderShape(shape);
        }
示例#5
0
        public static void UpdateStrokeDashPattern(this ContentPanel platformView, IBorderStroke border)
        {
            var strokeDashPattern = border.StrokeDashPattern;

            if (strokeDashPattern == null)
            {
                return;
            }

            platformView.UpdateStrokeDashPattern(strokeDashPattern);
        }
示例#6
0
        public static void UpdateStroke(this ContentPanel platformView, IBorderStroke border)
        {
            var stroke = border.Stroke;

            if (stroke == null)
            {
                return;
            }

            platformView.BorderPath?.UpdateStroke(stroke);
        }
示例#7
0
        public static void UpdateStrokeShape(this EvasObject platformView, IBorderStroke border)
        {
            var borderShape = border.Shape;
            var canvas      = platformView as BorderView;

            if (canvas == null && borderShape == null)
            {
                return;
            }

            platformView.UpdateMauiDrawable(border);
        }
示例#8
0
        public static void UpdateStroke(this EvasObject platformView, IBorderStroke border)
        {
            var stroke = border.Stroke;
            var canvas = platformView as BorderView;

            if (canvas == null && stroke.IsNullOrEmpty())
            {
                return;
            }

            platformView.UpdateMauiDrawable(border);
        }
示例#9
0
        public static void UpdateStrokeShape(this UIView platformView, IBorderStroke border)
        {
            var     borderShape     = border.Shape;
            CALayer?backgroundLayer = platformView.Layer as MauiCALayer;

            if (backgroundLayer == null && borderShape == null)
            {
                return;
            }

            platformView.UpdateMauiCALayer(border);
        }
示例#10
0
        public static void UpdateStrokeShape(this AView platformView, IBorderStroke border)
        {
            var          borderShape  = border.Shape;
            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            if (mauiDrawable == null && borderShape == null)
            {
                return;
            }

            platformView.UpdateMauiDrawable(border);
        }
示例#11
0
        public static void UpdateStrokeLineCap(this UIView platformView, IBorderStroke border)
        {
            CALayer?backgroundLayer = platformView.Layer as MauiCALayer;
            bool    hasBorder       = border.Shape != null && border.Stroke != null;

            if (backgroundLayer == null && !hasBorder)
            {
                return;
            }

            platformView.UpdateMauiCALayer(border);
        }
示例#12
0
        public static void UpdateStrokeThickness(this AView platformView, IBorderStroke border)
        {
            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;
            bool         hasBorder    = border.Shape != null && border.Stroke != null;

            if (mauiDrawable == null && !hasBorder)
            {
                return;
            }

            mauiDrawable?.SetBorderWidth(border.StrokeThickness);
        }
示例#13
0
        public static void UpdateStroke(this UIView platformView, IBorderStroke border)
        {
            var     borderBrush     = border.Stroke;
            CALayer?backgroundLayer = platformView.Layer as MauiCALayer;

            if (backgroundLayer == null && borderBrush.IsNullOrEmpty())
            {
                return;
            }

            platformView.UpdateMauiCALayer(border);
        }
示例#14
0
        public static void UpdateStrokeDashOffset(this ContentPanel platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            var strokeDashOffset = border.StrokeDashOffset;

            platformView.BorderPath?.UpdateBorderDashOffset(strokeDashOffset);
        }
示例#15
0
        public static void UpdateStrokeLineJoin(this ContentPanel platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            var strokeLineJoin = border.StrokeLineJoin;

            platformView.UpdateStrokeLineJoin(strokeLineJoin);
        }
示例#16
0
        public static void UpdateStrokeMiterLimit(this ContentPanel platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            var strokeMiterLimit = border.StrokeMiterLimit;

            platformView.UpdateStrokeMiterLimit(strokeMiterLimit);
        }
示例#17
0
        public static void UpdateStrokeDashPattern(this EvasObject platformView, IBorderStroke border)
        {
            var  strokeDashPattern = border.StrokeDashPattern;
            var  canvas            = platformView as BorderView;
            bool hasBorder         = border.Shape != null && border.Stroke != null;

            if (canvas == null && !hasBorder && (strokeDashPattern == null || strokeDashPattern.Length == 0))
            {
                return;
            }

            platformView.UpdateMauiDrawable(border);
        }
示例#18
0
        public static void UpdateBackground(this ContentPanel platformView, IBorderStroke border)
        {
            var hasBorder = border.Shape != null && border.Stroke != null;

            if (hasBorder)
            {
                platformView?.UpdateBorderBackground(border);
            }
            else if (border is IView v)
            {
                platformView?.UpdatePlatformViewBackground(v);
            }
        }
示例#19
0
        public static void UpdateStrokeThickness(this ContentPanel platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            var strokeThickness = border.StrokeThickness;

            platformView.UpdateStrokeThickness(strokeThickness);
        }
示例#20
0
        public static void UpdateStroke(this AView platformView, IBorderStroke border)
        {
            var          stroke       = border.Stroke;
            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            if (mauiDrawable == null && stroke.IsNullOrEmpty())
            {
                return;
            }

            platformView.UpdateMauiDrawable(border);
            mauiDrawable?.SetBorderBrush(border.Stroke);
        }
示例#21
0
        public static void UpdateStrokeDashOffset(this AView platformView, IBorderStroke border)
        {
            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (mauiDrawable == null && !hasBorder)
            {
                return;
            }

            mauiDrawable?.SetBorderDash(border.StrokeDashPattern, border.StrokeDashOffset);
        }
示例#22
0
        public static void UpdateStrokeLineCap(this ContentPanel platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            var strokeLineCap = border.StrokeLineCap;

            platformView.BorderPath?.UpdateStrokeLineCap(strokeLineCap);
        }
示例#23
0
        public static void UpdateStrokeDashOffset(this UIView platformView, IBorderStroke border)
        {
            var     strokeDashPattern = border.StrokeDashPattern;
            CALayer?backgroundLayer   = platformView.Layer as MauiCALayer;

            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (backgroundLayer == null && !hasBorder && (strokeDashPattern == null || strokeDashPattern.Length == 0))
            {
                return;
            }

            platformView.UpdateMauiCALayer(border);
        }
示例#24
0
        internal static void UpdateMauiDrawable(this EvasObject platformView, IBorderStroke border)
        {
            bool hasBorder = border.Shape != null && border.Stroke != null;

            if (!hasBorder)
            {
                return;
            }

            if (platformView is BorderView borderView)
            {
                borderView.ContainerView?.UpdateBorder(border);
            }
        }
示例#25
0
        public static void UpdateBorderStroke(this AView platformView, IBorderStroke border)
        {
            // Always set the drawable first
            platformView.UpdateMauiDrawable(border);

            var          borderShape  = border.Shape;
            MauiDrawable?mauiDrawable = platformView.Background as MauiDrawable;

            if (mauiDrawable == null && borderShape == null)
            {
                return;
            }

            mauiDrawable?.SetBorderBrush(border.Stroke);
            mauiDrawable?.SetBorderWidth(border.StrokeThickness);
            platformView.UpdateStrokeDashPattern(border);
            platformView.UpdateStrokeDashOffset(border);
            mauiDrawable?.SetBorderMiterLimit(border.StrokeMiterLimit);
            mauiDrawable?.SetBorderLineCap(border.StrokeLineCap);
            mauiDrawable?.SetBorderLineJoin(border.StrokeLineJoin);
        }
示例#26
0
 public static void UpdateStroke(this object platformView, IBorderStroke border)
 {
 }
示例#27
0
        internal static void UpdateBorderBackground(this FrameworkElement platformView, IBorderStroke border)
        {
            if (border is IView v)
            {
                (platformView as ContentPanel)?.UpdateBackground(v.Background);
            }

            if (platformView is Control control)
            {
                control.UpdateBackground((Paint?)null);
            }
            else if (platformView is Border b)
            {
                b.UpdateBackground(null);
            }
            else if (platformView is Panel panel)
            {
                panel.UpdateBackground(null);
            }
        }
示例#28
0
 public void UpdateBorder(IBorderStroke border)
 {
     ((MauiDrawable)_drawableCanvas.Value.Drawable).Border = border;
     UpdateShape(border.Shape);
 }