Esempio n. 1
0
 void Subject_ChangedForm(IShape subject, ChangeFormState state)
 {
     if (isAttracted || dragged != subject || !state.HasFlag(ChangeFormState.Coords)) return;
     using (StartFinishAction.Create(() => isAttracted = true, () => isAttracted = false))
     {
         RectangleF rect = subject.Rectangle;
         PointF center = subject.GetCenter(), minDist = new PointF(10, 10), dist = new PointF();
         guidlines = subject.GetCenter();
         hit = 0;
         bool lHit = false;
         foreach (var guide in guides.Where(s => s != subject).Select(s => s.GetCenter()))
         {
             if ((dist.X = Math.Abs(center.X - guide.X)) < minDist.X)
             {
                 minDist.X = dist.X;
                 guidlines.X = guide.X;
                 hit |= 1;
             }
             if ((dist.Y = Math.Abs(center.Y - guide.Y)) < minDist.Y)
             {
                 minDist.Y = dist.Y;
                 guidlines.Y = guide.Y;
                 hit |= 2;
             }
             if (hit == 3) break;
             //if (hit = Math.Abs(rect.Left - guide.X) <= 10)
             //    subject.Left = guide.X;
             //if (hit |= Math.Abs(rect.Top - guide.Y) <= 10)
             //    subject.Top = guide.Y;
             //if (hit) break;
         }
         subject.ToCenterPoint(guidlines);
     }
 }
Esempio n. 2
0
 void Arrow11_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (!isInitMenu && state.HasFlag(ChangeFormState.Coords))
     {
         isInitMenu = true;
         var arrCnt = MenuItems["Resize"].GetCenter();
         var capCnt = capture.GetCenter();
         var r = arrCnt.Distance(capCnt);
         capture.SetRadius(Math.Max(r, 30));
         InitMenu(arrCnt);
         isInitMenu = false;
     }
 }
Esempio n. 3
0
 void shape_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (!isInitMenu && obj == capture && state.HasFlag(ChangeFormState.Coords))
         if (initPoint != obj.Location)
         {
             var c = MenuItems["Resize"].GetCenter();
             InitMenu(new PointF(c.X + obj.Left - initPoint.X, c.Y + obj.Top - initPoint.Y));
         }
 }
Esempio n. 4
0
 private void capturer_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (state.HasFlag(ChangeFormState.Visibility) && !obj.Render.IsSee)
         Capturer = null;
 }
Esempio n. 5
0
 private void reactive_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     IsChanged = true;
 }
Esempio n. 6
0
 void filler_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (state.HasFlag(ChangeFormState.Coords))
         foreach (var key in Filler.Shape.Keys)
             Markers[key].ToCenterPoint(Filler.Shape[key]);
 }
Esempio n. 7
0
 void marker_ChangedForm(IShape obj, ChangeFormState state = ChangeFormState.All)
 {
     if (!isMarkerChangedForm && state.HasFlag(ChangeFormState.Coords))
         using (StartFinishAction.Create(() => isMarkerChangedForm = true, () => isMarkerChangedForm = false))
         {
             var ind = Markers.IndexOf((ReactiveShape<Circle>)obj);
             Filler.Shape[ind] = obj.GetCenter();
             obj.ToCenterPoint(Filler.Shape[ind]);
             //Caption.Shape.String = Filler.Shape.Area.ToString("R");
             FitchInfoPics();
         }
     //Caption.ToCenterPoint(Filler.GetCenter());
 }
Esempio n. 8
0
        void addingPointMaker_ChangedForm(IShape arg1, ChangeFormState arg2)
        {
            if (arg2.HasFlag(ChangeFormState.Visibility))
            {
                if (!addingPointMaker.IsVisible)
                    isAddingPointMarkerDragBegin = false;
            }
            else
                if (addingPointMaker.IsVisible)
                    addingPointMaker.Brush = CanInsertPointToAddingMarker()
                        ? Brushes.Lime
                        : Brushes.Red;

        }