Ejemplo n.º 1
0
        public virtual void Draw(object dc, double zoom)
        {
            var scale      = ScaleSize ? 1.0 / zoom : 1.0;
            var translateX = 0.0 - (Center.X * scale) + Center.X;
            var translateY = 0.0 - (Center.Y * scale) + Center.Y;

            double thickness = Style.Thickness;

            if (ScaleThickness)
            {
                thickness /= zoom;
            }

            if (scale != 1.0)
            {
                thickness /= scale;
            }

            if (Stroke.Thickness != thickness)
            {
                Stroke = AvaloniaDrawUtil.ToPen(Style, thickness);
            }

            var context             = dc as AM.DrawingContext;
            var translateDisposable = scale != 1.0 ? context.PushPreTransform(AME.MatrixHelper.Translate(translateX, translateY)) : default(IDisposable);
            var scaleDisposable     = scale != 1.0 ? context.PushPreTransform(AME.MatrixHelper.Scale(scale, scale)) : default(IDisposable);

            OnDraw(dc, zoom);

            scaleDisposable?.Dispose();
            translateDisposable?.Dispose();
        }
Ejemplo n.º 2
0
 public override void UpdateStyle()
 {
     if (Grid.GridStrokeColor != null)
     {
         Stroke = AvaloniaDrawUtil.ToPen(Grid.GridStrokeColor, Grid.GridStrokeThickness);
     }
     else
     {
         Stroke = null;
     }
 }
Ejemplo n.º 3
0
        public override void Draw(object dc, double zoom)
        {
            var scale = ScaleSize ? 1.0 / zoom : 1.0;

            double thickness = Grid.GridStrokeThickness;

            if (ScaleThickness)
            {
                thickness /= zoom;
            }

            if (scale != 1.0)
            {
                thickness /= scale;
            }

            if (Stroke != null && Stroke.Thickness != thickness)
            {
                Stroke = AvaloniaDrawUtil.ToPen(Grid.GridStrokeColor, thickness);
            }

            OnDraw(dc, zoom);
        }
Ejemplo n.º 4
0
 public override void UpdateStyle()
 {
     Fill = AvaloniaDrawUtil.ToBrush(Color);
 }
Ejemplo n.º 5
0
 public virtual void UpdateStyle()
 {
     Fill   = AvaloniaDrawUtil.ToBrush(Style.Fill);
     Stroke = AvaloniaDrawUtil.ToPen(Style, Style.Thickness);
 }