File indexing completed on 2024-12-22 04:16:41
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 #include "SvgSelectTextStrategy.h" 0007 #include "SvgTextCursor.h" 0008 #include <QDebug> 0009 0010 SvgSelectTextStrategy::SvgSelectTextStrategy(KoToolBase *tool, SvgTextCursor *cursor, const QPointF &clicked) 0011 : KoInteractionStrategy(tool) 0012 , m_cursor(cursor) 0013 , m_dragStart(clicked) 0014 { 0015 m_dragEnd = m_dragStart; 0016 m_cursor->setPosToPoint(m_dragStart, true); 0017 } 0018 0019 void SvgSelectTextStrategy::handleMouseMove(const QPointF &mouseLocation, Qt::KeyboardModifiers modifiers) 0020 { 0021 Q_UNUSED(modifiers) 0022 m_dragEnd = mouseLocation; 0023 m_cursor->setPosToPoint(m_dragStart, true); 0024 m_cursor->setPosToPoint(m_dragEnd, false); 0025 } 0026 0027 KUndo2Command *SvgSelectTextStrategy::createCommand() 0028 { 0029 return nullptr; 0030 } 0031 0032 void SvgSelectTextStrategy::cancelInteraction() 0033 { 0034 return; 0035 } 0036 0037 void SvgSelectTextStrategy::finishInteraction(Qt::KeyboardModifiers modifiers) 0038 { 0039 Q_UNUSED(modifiers) 0040 m_cursor->setPosToPoint(m_dragStart, true); 0041 m_cursor->setPosToPoint(m_dragEnd, false); 0042 }