public void SetStrategy(SelectStrategy s) { lock (Locker) { SelectStrategy = s; s.SetZoomController(this); } }
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; }
private void DragDetector_MouseDrag(Point arg1, Point arg2) { coverRect = SelectStrategy.CalRect(arg1, arg2); UpdateView(); }
public ZoomController(SelectStrategy selectStrategy) { SelectStrategy = selectStrategy; SelectStrategy.SetZoomController(this); }
protected override void DrawElement(RenderTarget rt) { SelectStrategy.DrawZoomView(coverRect.ToRectF(), rt, fillBrush, frameBrush, 2); }