Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgMoveTextStrategy Class Reference

#include <SvgMoveTextStrategy.h>

+ Inheritance diagram for SvgMoveTextStrategy:

Public Member Functions

void cancelInteraction () override
 
KUndo2CommandcreateCommand () override
 
void finishInteraction (Qt::KeyboardModifiers modifiers) override
 
void handleMouseMove (const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override
 
 SvgMoveTextStrategy (KoToolBase *tool, KoSvgTextShape *shape, const QPointF &clicked)
 
 ~SvgMoveTextStrategy () override=default
 
- Public Member Functions inherited from KoInteractionStrategy
 KoInteractionStrategy (KoToolBase *parent)
 constructor
 
virtual void paint (QPainter &painter, const KoViewConverter &converter)
 
KoToolBasetool () const
 
virtual ~KoInteractionStrategy ()
 Destructor.
 

Private Attributes

QPointF m_anchorOffset
 
QPointF m_dragStart
 
QPointF m_finalPosition
 
QPointF m_initialPosition
 
KoSvgTextShapem_shape
 

Additional Inherited Members

- Protected Member Functions inherited from KoInteractionStrategy
uint decorationThickness () const
 
uint grabSensitivity () const
 Convenience function to get the global grab sensitivity.
 
uint handleRadius () const
 Convenience function to get the global handle radius.
 
 KoInteractionStrategy (KoInteractionStrategyPrivate &)
 constructor
 
- Protected Attributes inherited from KoInteractionStrategy
KoInteractionStrategyPrivated_ptr
 

Detailed Description

Definition at line 16 of file SvgMoveTextStrategy.h.

Constructor & Destructor Documentation

◆ SvgMoveTextStrategy()

SvgMoveTextStrategy::SvgMoveTextStrategy ( KoToolBase * tool,
KoSvgTextShape * shape,
const QPointF & clicked )

Definition at line 18 of file SvgMoveTextStrategy.cpp.

20 , m_shape(shape)
21 , m_dragStart(clicked)
25{
27}
KoSnapGuide * snapGuide
KoInteractionStrategy(KoToolBase *parent)
constructor
QPointF absolutePosition(KoFlake::AnchorPosition anchor=KoFlake::Center) const
Definition KoShape.cpp:653
QTransform absoluteTransformation() const
Definition KoShape.cpp:382
static QList< KoShape * > linearizeSubtree(const QList< KoShape * > &shapes)
Definition KoShape.cpp:1381
void setIgnoredShapes(const QList< KoShape * > &ignoredShapes)
Sets list of ignored shapes.
KoCanvasBase * canvas() const
Returns the canvas the tool is working on.
KoSvgTextShape * m_shape

References KoToolBase::canvas(), KoShape::linearizeSubtree(), KoSnapGuide::setIgnoredShapes(), KoCanvasBase::snapGuide, and KoInteractionStrategy::tool().

◆ ~SvgMoveTextStrategy()

SvgMoveTextStrategy::~SvgMoveTextStrategy ( )
overridedefault

Member Function Documentation

◆ cancelInteraction()

void SvgMoveTextStrategy::cancelInteraction ( )
overridevirtual

This method will undo frames based interactions by calling createCommand() and unexecuting that.

Reimplemented from KoInteractionStrategy.

Definition at line 53 of file SvgMoveTextStrategy.cpp.

References m_finalPosition, m_initialPosition, m_shape, KoToolBase::repaintDecorations(), KoInteractionStrategy::tool(), and SvgMoveTextCommand::undo().

◆ createCommand()

KUndo2Command * SvgMoveTextStrategy::createCommand ( )
overridevirtual

For interactions that are undo-able this method should be implemented to return such a command. Implementations should return 0 otherwise.

Returns
a command, or 0.

Implements KoInteractionStrategy.

Definition at line 44 of file SvgMoveTextStrategy.cpp.

45{
46 tool()->canvas()->snapGuide()->reset();
48 return nullptr;
49 }
51}
void reset()
Resets the snap guide.
bool fuzzyPointCompare(const QPointF &p1, const QPointF &p2)

References KoToolBase::canvas(), KisAlgebra2D::fuzzyPointCompare(), m_finalPosition, m_initialPosition, m_shape, KoSnapGuide::reset(), KoCanvasBase::snapGuide, and KoInteractionStrategy::tool().

◆ finishInteraction()

void SvgMoveTextStrategy::finishInteraction ( Qt::KeyboardModifiers modifiers)
overridevirtual

Override to make final changes to the data on the end of an interaction.

Implements KoInteractionStrategy.

Definition at line 59 of file SvgMoveTextStrategy.cpp.

60{
61}

◆ handleMouseMove()

void SvgMoveTextStrategy::handleMouseMove ( const QPointF & mouseLocation,
Qt::KeyboardModifiers modifiers )
overridevirtual

Extending classes should implement this method to update the selectedShapes based on the new mouse position.

Parameters
mouseLocationthe new location in pt
modifiersOR-ed set of keys pressed.

Implements KoInteractionStrategy.

Definition at line 29 of file SvgMoveTextStrategy.cpp.

30{
31 const QPointF delta = mouseLocation - m_dragStart;
32
33 if (modifiers & Qt::ShiftModifier) {
35 } else {
38 }
39
42}
QPointF snap(const QPointF &mousePosition, Qt::KeyboardModifiers modifiers)
snaps the mouse position, returns if mouse was snapped
PointType snapToClosestAxis(PointType P)
Definition kis_global.h:199

References KoToolBase::canvas(), m_anchorOffset, m_dragStart, m_finalPosition, m_initialPosition, m_shape, SvgMoveTextCommand::redo(), KoToolBase::repaintDecorations(), KoSnapGuide::snap(), KoCanvasBase::snapGuide, snapToClosestAxis(), and KoInteractionStrategy::tool().

Member Data Documentation

◆ m_anchorOffset

QPointF SvgMoveTextStrategy::m_anchorOffset
private

Definition at line 32 of file SvgMoveTextStrategy.h.

◆ m_dragStart

QPointF SvgMoveTextStrategy::m_dragStart
private

Definition at line 29 of file SvgMoveTextStrategy.h.

◆ m_finalPosition

QPointF SvgMoveTextStrategy::m_finalPosition
private

Definition at line 31 of file SvgMoveTextStrategy.h.

◆ m_initialPosition

QPointF SvgMoveTextStrategy::m_initialPosition
private

Definition at line 30 of file SvgMoveTextStrategy.h.

◆ m_shape

KoSvgTextShape* SvgMoveTextStrategy::m_shape
private

Definition at line 28 of file SvgMoveTextStrategy.h.


The documentation for this class was generated from the following files: