Changeset 8869:407d74b05f39 in orange


Ignore:
Timestamp:
09/01/11 10:15:22 (3 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
49a47a4cf2a56fc3882c7040e86a6eff2c4a5f73
Message:

Drag points in SELECT mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owplot.py

    r8859 r8869  
    371371        self.state = NOTHING 
    372372        self._pressed_mouse_button = Qt.NoButton 
     373        self._pressed_point = None 
    373374        self.selection_items = [] 
    374375        self._current_rs_item = None 
     
    11751176        a = self.mouse_action(event) 
    11761177 
     1178        if a == SELECT: 
     1179            self._pressed_point = self.nearest_point(point) 
     1180            self._pressed_point_coor = None  
     1181            if self._pressed_point is not None: 
     1182                self._pressed_point_coor = self._pressed_point.coordinates() 
     1183             
    11771184        if a == PANNING: 
    11781185            self._last_pan_pos = point 
     
    12051212        a = self.mouse_action(event) 
    12061213         
    1207         if a in [SELECT, ZOOMING] and self.graph_area.contains(point): 
     1214        if a == SELECT and self._pressed_point is not None: 
     1215            animate_points = self.animate_points 
     1216            self.animate_points = False 
     1217            x1, y1 = self._pressed_point_coor 
     1218            x2, y2 = self.map_from_graph(point) 
     1219            self.move_selected_points((x2 - x1, y2 - y1)) 
     1220            self.replot() 
     1221            if self._pressed_point is not None: 
     1222                self._pressed_point_coor = self._pressed_point.coordinates() 
     1223                 
     1224            self.animate_points = animate_points 
     1225             
     1226        elif a in [SELECT, ZOOMING] and self.graph_area.contains(point): 
    12081227            if not self._current_rs_item: 
    12091228                self._selection_start_point = self.mapToScene(self._pressed_mouse_pos) 
     
    12431262         
    12441263        a = self.mouse_action(event) 
     1264        if a == SELECT and self._pressed_point is not None: 
     1265            self._pressed_point = None 
    12451266        if a in [ZOOMING, SELECT] and self._current_rs_item: 
    12461267            rect = self._current_rs_item.rect() 
Note: See TracChangeset for help on using the changeset viewer.