File indexing completed on 2024-12-22 04:16:41
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Alvin Wong <alvin@alvinhc.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #ifndef SVG_INLINE_SIZE_CHANGE_STRATEGY_H 0008 #define SVG_INLINE_SIZE_CHANGE_STRATEGY_H 0009 0010 #include <KoInteractionStrategy.h> 0011 0012 #include <QPointF> 0013 0014 class KoSvgTextShape; 0015 0016 namespace SvgInlineSizeHelper 0017 { 0018 enum class VisualAnchor; 0019 enum class Side; 0020 } // namespace SvgInlineSizeHelper 0021 0022 0023 class SvgInlineSizeChangeStrategy : public KoInteractionStrategy 0024 { 0025 public: 0026 SvgInlineSizeChangeStrategy(KoToolBase *tool, KoSvgTextShape *shape, const QPointF &clicked, bool start); 0027 ~SvgInlineSizeChangeStrategy() override = default; 0028 0029 void handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) override; 0030 KUndo2Command *createCommand() override; 0031 void cancelInteraction() override; 0032 void finishInteraction(Qt::KeyboardModifiers modifiers) override; 0033 0034 private: 0035 KoSvgTextShape *m_shape; 0036 double m_initialInlineSize; 0037 double m_finalInlineSize; 0038 QPointF m_dragStart; 0039 int m_originalAnchor; 0040 int m_finalAnchor; 0041 QPointF m_initialPosition; 0042 QPointF m_finalPos; 0043 QPointF m_anchorOffset; 0044 QPointF m_snapDelta; 0045 SvgInlineSizeHelper::VisualAnchor m_anchor; 0046 SvgInlineSizeHelper::Side m_handleSide; 0047 bool m_startHandle; 0048 }; 0049 0050 #endif /* SVG_INLINE_SIZE_CHANGE_STRATEGY_H */