示例#1
0
 public void Commit()
 {
     if (this.artboardOptionsModel == null)
     {
         return;
     }
     this.configurationObject.Clear();
     this.artboardOptionsModel.Save();
     this.artboardOptionsModel   = (ArtboardOptionsModel)null;
     this.artboardOptionsControl = (ArtboardOptionsControl)null;
     this.Apply();
 }
示例#2
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            if (this.artboard == null || this.designerContext == null)
            {
                return;
            }
            ArtboardOptionsModel artboardOptionsModel = this.designerContext.ArtboardOptionsModel;

            if (!artboardOptionsModel.ShowGrid)
            {
                return;
            }
            double num1 = artboardOptionsModel.GridSpacing * this.artboard.Zoom;

            while (num1 < 8.0)
            {
                num1 *= 5.0;
                if (num1 < 8.0)
                {
                    num1 *= 2.0;
                }
            }
            Point  point               = this.artboard.TransformFromContentToArtboard(new Point(0.0, 0.0) + this.originOffset);
            Size   renderSize          = this.artboard.RenderSize;
            Vector rootToArtboardScale = this.artboard.ViewRootToArtboardScale;
            double num2 = num1 * rootToArtboardScale.X;
            int    num3 = (int)Math.Floor((0.0 - point.X) / num2);
            int    num4 = (int)Math.Ceiling((renderSize.Width - point.X) / num2);

            for (int index = num3; index <= num4; ++index)
            {
                Brush  brush = index % 10 == 0 ? SnapToGridRenderer.brushTen : (index % 5 == 0 ? SnapToGridRenderer.brushFive : SnapToGridRenderer.brushOne);
                double x     = point.X + (double)index * num2;
                drawingContext.DrawRectangle(brush, (Pen)null, new Rect(x, 0.0, 1.0, renderSize.Height));
            }
            double num5 = num1 * rootToArtboardScale.Y;
            int    num6 = (int)Math.Floor((0.0 - point.Y) / num5);
            int    num7 = (int)Math.Ceiling((renderSize.Height - point.Y) / num5);

            for (int index = num6; index <= num7; ++index)
            {
                Brush  brush = index % 10 == 0 ? SnapToGridRenderer.brushTen : (index % 5 == 0 ? SnapToGridRenderer.brushFive : SnapToGridRenderer.brushOne);
                double y     = point.Y + (double)index * num5;
                drawingContext.DrawRectangle(brush, (Pen)null, new Rect(0.0, y, renderSize.Width, 1.0));
            }
        }
 public ArtboardOptionsControl(ArtboardOptionsModel snappingOptions)
 {
     this.DataContext = (object)snappingOptions;
     this.InitializeComponent();
 }
示例#4
0
 public void Cancel()
 {
     this.artboardOptionsModel   = (ArtboardOptionsModel)null;
     this.artboardOptionsControl = (ArtboardOptionsControl)null;
 }