Skip to content

Commit 72c81e9

Browse files
committed
minor fixes and improvements
1 parent d74cccd commit 72c81e9

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/utils/Geometry.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#include "../widgets/DrawingWidget.h"
22
#include "../tools.h"
33

4-
static QPointF last_end = QPointF(0,0);
5-
static QPointF last_begin = QPointF(0,0);
4+
#define last_end geo.last_end[id]
5+
#define last_begin geo.last_begin[id]
66

77
static int rad = 0;
8-
static int frad = 0;
98

109
#define startPoint geo.first(id)
1110
#define endPoint geo.last(id)
@@ -129,14 +128,12 @@ void DrawingWidget::drawLineToFunc(qint64 id, qreal pressure) {
129128
).toRect().normalized().adjusted(-rad, -rad, +rad, +rad));
130129
break;
131130
case CIRCLE:
132-
rad = QLineF(startPoint, endPoint).length() + penSize[penType];
133-
frad = QLineF(last_begin, last_end).length() + penSize[penType];
131+
rad = QLineF(startPoint, endPoint).length();
132+
#define frad QLineF(last_begin, last_end).length()
133+
rad = MAX(rad, frad) + penSize[penType];
134134
update(QRectF(
135135
startPoint,startPoint
136136
).toRect().normalized().adjusted(-rad, -rad, +rad, +rad));
137-
update(QRectF(
138-
startPoint,startPoint
139-
).toRect().normalized().adjusted(-frad, -frad, +frad, +frad));
140137
break;
141138
}
142139

src/widgets/DrawingWidget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ class GeometryStorage {
115115
values.clear();
116116
}
117117
QMap<qint64, ValueStorage> values;
118+
QMap<qint64, QPointF> last_begin;
119+
QMap<qint64, QPointF> last_end;
118120

119121
};
120122

0 commit comments

Comments
 (0)