public void OnMouseClick(int x, int y) { if (end) { return; } if (!lines.Any() && first) { xBegin = x; yBegin = y; first = false; } else { if (ToBeEnd(x, y)) { currentLine.OnMouseClicked(xBegin, yBegin); lines.Add(currentLine); currentLine = null; end = true; return; } currentLine.OnMouseClicked(x, y); lines.Add(currentLine); } currentLine = new PolygonLineTool(); currentLine.OnMouseClick(x, y); }
public void OnMouseClick(int x, int y) { if (end) return; if (!lines.Any() && first) { xBegin = x; yBegin = y; first = false; } else { if (ToBeEnd(x, y)) { currentLine.OnMouseClicked(xBegin, yBegin); lines.Add(currentLine); currentLine = null; end = true; return; } currentLine.OnMouseClicked(x, y); lines.Add(currentLine); } currentLine = new PolygonLineTool(); currentLine.OnMouseClick(x, y); }