public void OnMouseUp() { _mouseDown = MouseDownOnTriangle.Nothing; }
/// <summary> /// This will return true if it can hangle the click. Otherwise it returns false /// </summary> public bool OnMouseDown(MyVector mousePos) { const double CLICKDISTANCE = 35; bool retVal = true; MyVector localPos = mousePos - this.Position; if (Utility3D.GetDistance3D(localPos, this.Vertex1) <= CLICKDISTANCE) { _mouseDown = MouseDownOnTriangle.Point1; _offset = this.Triangle.Vertex1 - localPos; } else if (Utility3D.GetDistance3D(localPos, this.Vertex2) <= CLICKDISTANCE) { _mouseDown = MouseDownOnTriangle.Point2; _offset = this.Triangle.Vertex2 - localPos; } else if (Utility3D.GetDistance3D(localPos, this.Vertex3) <= CLICKDISTANCE) { _mouseDown = MouseDownOnTriangle.Point3; _offset = this.Triangle.Vertex3 - localPos; } else if (Utility3D.GetDistance3D(localPos, this.RotateHandle) <= CLICKDISTANCE) { _mouseDown = MouseDownOnTriangle.Rotate; _offset = this.RotateHandle - localPos; } else if (localPos.GetMagnitudeSquared() <= this.Radius * this.Radius) // I want to do this last { _mouseDown = MouseDownOnTriangle.Ball; _offset = this.Position - mousePos; } else { retVal = false; } return retVal; }