Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_temporary_paint_constraint.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Ayanami Kaine <personal@ayanamikaine.com>
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
6#ifndef KIS_TEMPORARY_PAINT_CONSTRAINT_H
7#define KIS_TEMPORARY_PAINT_CONSTRAINT_H
8
9#include <QPointF>
10
11#include "kritaui_export.h"
12
13class KRITAUI_EXPORT KisTemporaryPaintConstraint
14{
15public:
16 enum class InteractionMode {
17 Normal,
18 SnapToAngle
19 };
20
21 void setInteractionMode(InteractionMode mode);
22 InteractionMode interactionMode() const;
23
24 void beginLine(const QPointF &anchor);
25 void updateLine(const QPointF &secondPoint, bool snapToAngle = false);
26 void setLocked(bool locked);
27
28 bool hasLine() const;
29 bool isLocked() const;
30 bool hasValidLine() const;
31
32 QPointF lineAnchor() const;
33 QPointF lineSecondPoint() const;
34
35 QPointF adjustPosition(const QPointF &point,
36 const QPointF &strokeBegin,
37 bool checkForInitialMovement,
38 qreal moveThresholdPt) const;
39
40private:
41 QPointF m_anchor;
43 InteractionMode m_interactionMode {InteractionMode::Normal};
44 bool m_hasLine {false};
45 bool m_locked {false};
46 bool m_angleSnapped {false};
47};
48
49#endif // KIS_TEMPORARY_PAINT_CONSTRAINT_H