00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "KoPathPointMoveStrategy.h"
00022
00023 #include "KoPathCommand.h"
00024 #include "KoPathTool.h"
00025
00026 KoPathPointMoveStrategy::KoPathPointMoveStrategy( KoPathTool *tool, KoCanvasBase *canvas, const QPointF &pos )
00027 : KoInteractionStrategy( tool, canvas )
00028 , m_lastPosition( pos )
00029 , m_move( 0, 0 )
00030 , m_tool( tool )
00031 {
00032 }
00033
00034 KoPathPointMoveStrategy::~KoPathPointMoveStrategy()
00035 {
00036 }
00037
00038 void KoPathPointMoveStrategy::handleMouseMove( const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers )
00039 {
00040 QPointF docPoint = m_tool->snapToGrid( mouseLocation, modifiers );
00041 QPointF move = docPoint - m_lastPosition;
00042
00043
00044 m_lastPosition = docPoint;
00045
00046 m_move += move;
00047
00048 KoPointMoveCommand cmd( m_tool->m_pointSelection.selectedPointMap(), move );
00049 cmd.execute();
00050 }
00051
00052 void KoPathPointMoveStrategy::finishInteraction( Qt::KeyboardModifiers modifiers )
00053 {
00054 Q_UNUSED( modifiers );
00055 }
00056
00057 KCommand* KoPathPointMoveStrategy::createCommand()
00058 {
00059 KCommand *cmd = 0;
00060 if( !m_move.isNull() )
00061 {
00062 cmd = new KoPointMoveCommand( m_tool->m_pointSelection.selectedPointMap(), m_move );
00063 }
00064 return cmd;
00065 }