OverlayScopeView NewScopeView(OverlayScope os) { OverlayScopeView v = new OverlayScopeView(os); canvas1.Children.Add(v); return(v); }
public static void Draw(this OverlayScope os, Graphics dc, int Height) { RectangleF lBB = os.BB.UpsideDown(Height).ToRectangleF(); Pen p = os.IsSelected ? PensAndBrushes.OverlayScopeSelPen : PensAndBrushes.OverlayScopePen; dc.DrawRectangle(p, lBB.X, lBB.Y, lBB.Width, lBB.Height); // todo: draw adorner }
public static double HitTest(this OverlayScope os, double x, double y, double Height) { var lBB = os.BB.UpsideDown(Height); var lBBs = os.BB.UpsideDown(Height); lBBs.Inflate(10, 10); if (lBB.Contains(x, y) && !lBBs.Contains(x, y)) { return(10); } else { return(1000000); } }
public OverlayScopeView(OverlayScope os) : base(os) { SetStdColor(); //os.Stroke = new SolidColorBrush(Color.FromArgb(100, 0, 255, 0)); StrokeThickness = 10; //os.Fill = new SolidColorBrush(Color.FromArgb(100, 0, 255, 0)); MyBindings.Add(BindingFactory.CreateBinding(os, "IsCurEditing", vm => { if (vm.IsCurEditing) { ShowAdorner(); } else { RemoveAdorner(); } }, null, false)); MyBindings.Add(BindingFactory.CreateBinding(os, "BB", vm => { Width = vm.BB.Width; Height = vm.BB.Height; }, null, false)); }