Beispiel #1
0
 public void SetStrategy(SelectStrategy s)
 {
     lock (Locker)
     {
         SelectStrategy = s;
         s.SetZoomController(this);
     }
 }
Beispiel #2
0
        private void DragDetector_MouseUp(Point obj)
        {
            if (!SelectStrategy.IsRectBigEnough(coverRect, Mapper))
            {
                UpdateView();
            }
            else
            {
                var left   = Mapper.GetCoordinateX(coverRect.Left);
                var right  = Mapper.GetCoordinateX(coverRect.Right);
                var top    = Mapper.GetCoordinateY(coverRect.Top);
                var bottom = Mapper.GetCoordinateY(coverRect.Bottom);
                SetMapperRange(left, right, top, bottom);
            }

            //此处必须清零coverRect,原因是:当鼠标只做点击不拖动时,coverRect会保留上次放缩时计算的CoverRect值,因此会通过IsRectBigEnough的校验
            coverRect = new Rectangle(0, 0, 0, 0);
            return;
        }
Beispiel #3
0
 private void DragDetector_MouseDrag(Point arg1, Point arg2)
 {
     coverRect = SelectStrategy.CalRect(arg1, arg2);
     UpdateView();
 }
Beispiel #4
0
 public ZoomController(SelectStrategy selectStrategy)
 {
     SelectStrategy = selectStrategy;
     SelectStrategy.SetZoomController(this);
 }
Beispiel #5
0
 protected override void DrawElement(RenderTarget rt)
 {
     SelectStrategy.DrawZoomView(coverRect.ToRectF(), rt, fillBrush, frameBrush, 2);
 }