private Distance GetPrimitiveDistance(IChartDrawable primitive, Point point) { var x = point.X; var y = WorldY(point.Y); return(primitive.Distance(x, y)); }
public virtual void MouseDown(MouseEventArgs e) { if (this.chart.MainSeries == null || this.chart.MainSeries.Count == 0 || (e.X <= this.x1 || e.X >= this.x2)) { return; } double num1 = 10.0; double num2 = (this.maxValue - this.minValue) / 20.0; int x = e.X; double y = this.WorldY(e.Y); foreach (IChartDrawable chartDrawable in this.notDatePrimitives) { if (chartDrawable is DSView) { Distance distance = chartDrawable.Distance(x, y); if (distance != null) { this.chart.UnSelectAll(); if (distance.DX < num1 && distance.DY < num2) { chartDrawable.Select(); this.chart.SetContentUpdated(true); this.chart.Invalidate(); this.chart.ShowProperties(chartDrawable as DSView, this, false); this.chartDrawable = chartDrawable; if (!this.chart.ContextMenuEnabled || e.Button != MouseButtons.Right) { break; } this.getContextMenuStrip(chartDrawable).Show((Control)this.chart, new Point(e.X, e.Y)); break; } } } } }
private Distance GetPrimitiveDistance(IChartDrawable primitive, Point point) { var x = point.X; var y = WorldY(point.Y); return primitive.Distance(x, y); }