File indexing completed on 2025-02-23 04:09:03

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISSNAPPOINTSTRATEGY_H
0008 #define KISSNAPPOINTSTRATEGY_H
0009 
0010 #include <QScopedPointer>
0011 
0012 #include "KoSnapStrategy.h"
0013 #include "kritaui_export.h"
0014 
0015 /**
0016  * The KisSnapPointStrategy class is a custom strategy that allows snapping to
0017  * arbitrary points on canvas, not linked to any real objects. It can be used,
0018  * for example, for snapping to the *previous position* of the handle, while it
0019  * is dragging by the user.
0020  */
0021 
0022 class KRITAUI_EXPORT KisSnapPointStrategy : public KoSnapStrategy
0023 {
0024 public:
0025     KisSnapPointStrategy(KoSnapGuide::Strategy type = KoSnapGuide::CustomSnapping);
0026     ~KisSnapPointStrategy() override;
0027 
0028     bool snap(const QPointF &mousePosition, KoSnapProxy * proxy, qreal maxSnapDistance) override;
0029     QPainterPath decoration(const KoViewConverter &converter) const override;
0030 
0031      void addPoint(const QPointF &pt);
0032 
0033 private:
0034     struct Private;
0035     const QScopedPointer<Private> m_d;
0036 };
0037 
0038 #endif // KISSNAPPOINTSTRATEGY_H