public PlotterControls(FrameworkElement c, CanvasGridRenderer graphics) { _gridRenderer = graphics; Recentre(c); var zoomLogic = new ZoomLogic(); _zoom = zoomLogic; _lastMousePosition = new MousePositionService(this.PicturePosFromCanvasPos); _gridRenderer.Start(_zoom, _origin, _lastMousePosition); var zoomer = new ZoomController(zoomLogic, this.FocusPosition, _lastMousePosition); //----- I'm just gonna set up all the input control here because why not c.SizeChanged += (object sender, System.Windows.SizeChangedEventArgs e) => { Recentre(c); }; c.MouseMove += (object sender, MouseEventArgs e) => { _lastMousePosition.P = PointConversions.CanvasFromMouse(e.MouseDevice, c); }; c.MouseWheel += (object sender, MouseWheelEventArgs e) => { var delta = e.Delta; if (delta > 0) { zoomer.ZoomIn(); } else { zoomer.ZoomOut(); } e.Handled = true; }; new MousePanningHandler(_origin, _zoom).AddDragHandler(c); }
public void Start(IZoom zoom, Origin o, IMousePositionService mouse) { _zoom = zoom; _origin = o; _mouse = mouse; }
public MousePanningHandler(Origin o, IZoom zoom) { _origin = o; _zoom = zoom; }