Skip to content

Commit 1d90f66

Browse files
committedSep 13, 2015
Fix snapping
1 parent e281625 commit 1d90f66

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
 

‎src/gui/qgsmaptooladvanceddigitizing.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,21 @@ QgsMapToolAdvancedDigitizing::~QgsMapToolAdvancedDigitizing()
3434

3535
void QgsMapToolAdvancedDigitizing::canvasPressEvent( QgsMapMouseEvent* e )
3636
{
37+
snap( e );
3738
if ( !mCadDockWidget->canvasPressEvent( e ) )
3839
cadCanvasPressEvent( e );
3940
}
4041

4142
void QgsMapToolAdvancedDigitizing::canvasReleaseEvent( QgsMapMouseEvent* e )
4243
{
44+
snap( e );
4345
if ( !mCadDockWidget->canvasReleaseEvent( e, mCaptureMode == CaptureLine || mCaptureMode == CapturePolygon ) )
4446
cadCanvasReleaseEvent( e );
4547
}
4648

4749
void QgsMapToolAdvancedDigitizing::canvasMoveEvent( QgsMapMouseEvent* e )
4850
{
51+
snap( e );
4952
if ( !mCadDockWidget->canvasMoveEvent( e ) )
5053
cadCanvasMoveEvent( e );
5154
}
@@ -70,3 +73,9 @@ void QgsMapToolAdvancedDigitizing::cadPointChanged( const QgsPoint& point )
7073
fakeEvent.setMapPoint( point );
7174
canvasMoveEvent( &fakeEvent );
7275
}
76+
77+
void QgsMapToolAdvancedDigitizing::snap( QgsMapMouseEvent* e )
78+
{
79+
if ( !mCadDockWidget->cadEnabled() )
80+
e->snapPoint( QgsMapMouseEvent::SnapProjectConfig );
81+
}

‎src/gui/qgsmaptooladvanceddigitizing.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
123123
private slots:
124124
/**
125125
* Is to be called by the cad system whenever a point changes outside of a
126-
* mouse event. E.g. when additional constraints are triggered.
126+
* mouse event. E.g. when additional constraints are toggled.
127127
* The specified point will be used to generate a fake mouse event which will
128128
* be sent as move event to cadCanvasMoveEvent.
129129
*
@@ -133,6 +133,8 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
133133

134134
private:
135135
QgsAdvancedDigitizingDockWidget* mCadDockWidget;
136+
137+
void snap( QgsMapMouseEvent* e );
136138
};
137139

138140
#endif // QGSMAPTOOLADVANCEDDIGITIZE_H

0 commit comments

Comments
 (0)
Please sign in to comment.