/// <summary> /// Handle the situation where we are moving a point (or have clicked on a point) and the /// behaviour becomes disabled. /// </summary> protected override void OnIsEnabledPropertyChanged() { if (_leftMouseDown && !IsEnabled) { // Reset the cursor and remove the selected point from the series collection. Chart.Cursor = _currentCursor; _leftMouseDown = false; ((ChartSingleSeriesBase)Chart.Series[0]).SelectedItems.Remove(_selectedPoint); _selectedPoint = null; } }
/// <summary> /// Override of <see cref="BehaviourBase"/> that handles the left mouse button being /// released. If the button was initially pressed on point, then this signifies the /// end of a move. /// </summary> /// <param name="position">The position the button was released at.</param> public override void MouseLeftButtonUp(Point position) { if (!_leftMouseDown) { return; } SetZoomEnabled(true); Chart.Cursor = _currentCursor; _leftMouseDown = false; _selectedPoint = null; BehaviourContainer.ReleaseMouseCapture(); }
private void GetSelectedPoint(Point position) { // Get the point that is within range of the mouse click. foreach (BindableDataPoint dp in Chart.Series[0].DataSeries) { if (IsClickPositionCloseToPoint(position.X, Chart.XAxis.GetDataValueAsRenderPositionWithZoom(dp.X)) && IsClickPositionCloseToPoint(position.Y, Chart.YAxis.GetDataValueAsRenderPositionWithZoom(dp.Y))) { _selectedPoint = dp; var point = new Core.Model.Point((double)_selectedPoint.XValue, (double)_selectedPoint.XValue); OnPointSelected(this, new PointSelectedEventArgs { Point = point }); break; } } }
private void GetSelectedPoint(Point position) { // Get the point that is within range of the mouse click. foreach (BindableDataPoint dp in Chart.Series[0].DataSeries) { if (IsClickPositionCloseToPoint(position.X, Chart.XAxis.GetDataValueAsRenderPositionWithZoom(dp.X)) && IsClickPositionCloseToPoint(position.Y, Chart.YAxis.GetDataValueAsRenderPositionWithZoom(dp.Y))) { _selectedPoint = dp; var point = new Core.Model.Point((double)_selectedPoint.XValue, (double)_selectedPoint.XValue); OnPointSelected(this, new PointSelectedEventArgs { Point = point}); break; } } }