~vcs-imports/freecad/trunk

« back to all changes in this revision

Viewing changes to src/Mod/Draft/DraftSnap.py

  • Committer: jriegel
  • Date: 2012-02-26 16:30:44 UTC
  • Revision ID: svn-v4:e8eeb9e2-ec13-0410-a4a9-efa5cf37419d:trunk:5438
Merge branch 'master' into HEAD

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        self.constrainLine = None
70
70
        self.trackLine = None
71
71
        self.lastSnappedObject = None
 
72
        self.active = True
72
73
        
73
74
        # the snapmarker has "dot","circle" and "square" available styles
74
75
        self.mk = {'passive':'circle',
141
142
        if self.grid and Draft.getParam("grid"):
142
143
            self.grid.set()
143
144
        
144
 
        # checking if alwaySnap setting is on
 
145
        # activate snap
145
146
        oldActive = False
146
147
        if Draft.getParam("alwaysSnap"):
147
148
            oldActive = active
148
149
            active = True
 
150
        if not self.active:
 
151
            active = False
149
152
 
150
153
        self.setCursor('passive')
151
154
        if self.tracker:
159
162
        info = FreeCADGui.ActiveDocument.ActiveView.getObjectInfo((screenpos[0],screenpos[1]))
160
163
 
161
164
        # checking if parallel to one of the edges of the last objects or to a polar direction
162
 
        eline = None
163
 
        point,eline = self.snapToPolar(point,lastpoint)
164
 
        point,eline = self.snapToExtensions(point,lastpoint,constrain,eline)
 
165
 
 
166
        if active:
 
167
            eline = None
 
168
            point,eline = self.snapToPolar(point,lastpoint)
 
169
            point,eline = self.snapToExtensions(point,lastpoint,constrain,eline)
165
170
        
166
171
        if not info:
167
172
            
168
173
            # nothing has been snapped, check fro grid snap
169
 
            point = self.snapToGrid(point)
 
174
            if active:
 
175
                point = self.snapToGrid(point)
170
176
            return cstr(point)
171
177
 
172
178
        else: