private void OnMouseIsDownOverview(int x, int y, int width, int height) { Size2 overview = GraphUtil.CalcOverviewSize(width, height, main.TotalWidth(), main.TotalHeight()); Rectangle2 win = GraphUtil.CalcWin(overview, main.TotalSize, main.VisibleWin, main.ZoomFactor, main.ZoomFactor); if (win.Contains(x, y)) { navigatorData.Start(x, y, main.VisibleX, main.VisibleY); } else { float x1 = x - win.Width / 2; float y1 = y - win.Height / 2; int newX = (int)Math.Round(x1 * main.TotalWidth() / overview.Width); int newY = (int)Math.Round(y1 * main.TotalHeight() / overview.Height); newX = (int)Math.Min(Math.Max(newX, 0), main.TotalWidth() - main.VisibleWidth / main.ZoomFactor); main.VisibleX = newX; newY = (int)Math.Min(Math.Max(newY, 0), main.TotalHeight() - main.VisibleHeight / main.ZoomFactor); main.VisibleY = newY; invalidate(); } }