Commit 98da7780 authored by Sven Langkamp's avatar Sven Langkamp

Don't interpret selection by tablet as move

BUG:313589
REVIEW:108587
parent 70134c1e
......@@ -290,6 +290,11 @@ Qt::Orientation KoPointerEvent::orientation() const
return Qt::Horizontal;
}
bool KoPointerEvent::isTabletEvent()
{
return dynamic_cast<QTabletEvent*>(m_event) != 0;
}
void KoPointerEvent::setTabletButton(Qt::MouseButton button)
{
d->tabletButton = button;
......
......@@ -223,6 +223,11 @@ public:
/// The point in document coordinates.
const QPointF point;
/**
* Returns if the event comes from a tablet
*/
bool isTabletEvent();
protected:
friend class KoToolProxy;
friend class KisScratchPadEventFilter;
......
......@@ -65,6 +65,20 @@
#define HANDLE_DISTANCE 10
class NopInteractionStrategy : public KoInteractionStrategy
{
public:
explicit NopInteractionStrategy(KoToolBase* parent) : KoInteractionStrategy(parent) {}
virtual KUndo2Command* createCommand()
{
return 0;
}
virtual void handleMouseMove(const QPointF& /*mouseLocation*/, Qt::KeyboardModifiers /*modifiers*/) {}
virtual void finishInteraction(Qt::KeyboardModifiers /*modifiers*/) {}
};
class SelectionHandler : public KoToolSelection
{
public:
......@@ -1222,6 +1236,10 @@ KoInteractionStrategy *DefaultTool::createStrategy(KoPointerEvent *event)
shapeManager->selection()->deselectAll();
select->select(shape, selectNextInStack ? false : true);
repaintDecorations();
// tablet selection isn't precise and may lead to a move, preventing that
if (event->isTabletEvent()) {
return new NopInteractionStrategy(this);
}
return new ShapeMoveStrategy(this, event->point);
}
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment