X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/180ebf90bce509d815724b5045ebcc59b9ef724c..25b3661bd4cb44304418b93c0dee1d0dfb99765c:/wxPython/wx/lib/ogl/_lines.py diff --git a/wxPython/wx/lib/ogl/_lines.py b/wxPython/wx/lib/ogl/_lines.py index 6b6e4cf59b..1e1d3ab68a 100644 --- a/wxPython/wx/lib/ogl/_lines.py +++ b/wxPython/wx/lib/ogl/_lines.py @@ -298,16 +298,19 @@ class LineShape(Shape): # the middle points to something other than (-999, -999) self._initialised = False - def InsertLineControlPoint(self, dc = None): - """Insert a control point at an arbitrary position.""" + def InsertLineControlPoint(self, dc = None, point = None): + """Insert a control point at an optional given position.""" if dc: self.Erase(dc) - last_point = self._lineControlPoints[-1] - second_last_point = self._lineControlPoints[-2] + if point: + line_x, line_y = point + else: + last_point = self._lineControlPoints[-1] + second_last_point = self._lineControlPoints[-2] - line_x = (last_point[0] + second_last_point[0]) / 2.0 - line_y = (last_point[1] + second_last_point[1]) / 2.0 + line_x = (last_point[0] + second_last_point[0]) / 2.0 + line_y = (last_point[1] + second_last_point[1]) / 2.0 point = wx.RealPoint(line_x, line_y) self._lineControlPoints.insert(len(self._lineControlPoints)-1, point)