protected override void onMouseMove(double xPos, double yPos) { base.onMouseMove(xPos, yPos); if (locked) { if (curPoint < 0) { return; } points[curPoint] = new vkvg.Point((int)xPos, (int)yPos); } else { curPoint = -1; for (int i = 0; i < points.Length; i++) { if (!isOver(points[i], (int)lastMouseX, (int)lastMouseY)) { continue; } curPoint = i; break; } } }
bool isOver(vkvg.Point p, int x, int y) => p.X - cpRadius <x && p.X + cpRadius> x && p.Y - cpRadius <y && p.Y + cpRadius> y;