コード例 #1
0
    def _update_text(self):
        """
        Update curve-specific text
        """

        self.text.set_translation(TupleMath.mean(self.coordinates))

        self.text_center = self.center
        self.set_text_translation((0.0, 0.0, 0.0))
コード例 #2
0
    def setup_drag_references(self, nam):
        """
        Set parameters to be referenced during on_drag operations
        """

        _drag_ctr = self.arc.start
        _bearing = self.arc.bearing_in
        _origin = None

        if 'center' in nam or 'arc' in nam:

            _drag_ctr = self.arc.center
            _bearing = TupleMath.bearing(
                TupleMath.subtract(tuple(self.arc.pi), tuple(self.arc.center)))

            if 'arc' in nam:

                _l = len(self.arc.points)
                _l_2 = int(_l / 2)
                _drag_ctr = self.arc.points[_l_2 - 1]

                if (_l % 2):
                    _drag_ctr = TupleMath.mean(_drag_ctr,
                                               self.arc.points[_l_2])
                _drag_ctr = self.arc.center
                self.drag_start_point = self.arc.center
                _origin = self.arc.center

        elif 'end' in nam:

            _drag_ctr = self.arc.end
            _bearing = self.arc.bearing_out

        self.drag_center = _drag_ctr

        if not _origin:
            _origin = _drag_ctr

        #generate constraint geometry along an axis defined by the bearing
        while _bearing > math.pi:
            _bearing -= math.pi

        self.drag_axis = (1.0, 1.0 / math.tan(_bearing), 0.0)
        Drag.drag_tracker.set_constraint_geometry(self.drag_axis, _origin)