File tree Expand file tree Collapse file tree 4 files changed +20
-11
lines changed Expand file tree Collapse file tree 4 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 8
8
* New: Add tab context menu for close all tabs and close other tabs. ([ #93 ] ( https://github.com/ksnip/kImageAnnotator/issues/93 ) )
9
9
* Changed: Make dropdown buttons show popup on click. ([ #89 ] ( https://github.com/ksnip/kImageAnnotator/issues/89 ) )
10
10
* Changed: Hide unavailable setting widgets. ([ #101 ] ( https://github.com/ksnip/kImageAnnotator/issues/101 ) )
11
+ * Changed: Make arrow size decrease with stroke size. ([ #84 ] ( https://github.com/ksnip/kImageAnnotator/issues/84 ) )
11
12
* Fixed: Using select tool marks image as changed. ([ #97 ] ( https://github.com/ksnip/kImageAnnotator/issues/97 ) )
12
13
13
14
## Release 0.2.1
Original file line number Diff line number Diff line change @@ -37,22 +37,25 @@ ToolTypes AnnotationArrow::toolType() const
37
37
38
38
void AnnotationArrow::updateShape ()
39
39
{
40
- QPainterPath path ( mLine -> p1 () );
41
- path. lineTo ( mLine -> p2 () );
40
+ QLineF shaft (* mLine );
41
+ shaft. setLength (shaft. length () - 5 );
42
42
43
- auto arrow = createArrow ();
43
+ QPainterPath path (shaft.p1 ());
44
+ path.lineTo (shaft.p2 ());
45
+
46
+ auto arrow = createArrowHead (properties ()->width () / 2 );
44
47
auto finishedArrow = positionArrowHeadAtEnd (arrow);
45
48
46
49
path.addPolygon (finishedArrow);
47
50
path.closeSubpath ();
48
51
setShape (path);
49
52
}
50
53
51
- QPolygonF AnnotationArrow::createArrow ( ) const
54
+ QPolygonF AnnotationArrow::createArrowHead ( int scaleFactor ) const
52
55
{
53
- int mArrowHeadLength = 20 ;
54
- int mArrowHeadWidth = 10 ;
55
- int mArrowHeadMid = 17 ;
56
+ int mArrowHeadLength = 15 + scaleFactor ;
57
+ int mArrowHeadWidth = 5 + scaleFactor ;
58
+ int mArrowHeadMid = 13 + scaleFactor ;
56
59
57
60
QPointF p0 (0 , 0 );
58
61
QPointF p1 (-mArrowHeadLength , mArrowHeadWidth );
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class AnnotationArrow : public AbstractAnnotationLine
34
34
35
35
protected:
36
36
void updateShape () override ;
37
- QPolygonF createArrow ( ) const ;
37
+ QPolygonF createArrowHead ( int scaleFactor ) const ;
38
38
QPolygonF positionArrowHeadAtEnd (const QPolygonF &arrow) const ;
39
39
};
40
40
Original file line number Diff line number Diff line change @@ -38,10 +38,15 @@ ToolTypes AnnotationDoubleArrow::toolType() const
38
38
39
39
void AnnotationDoubleArrow::updateShape ()
40
40
{
41
- QPainterPath path (mLine ->p1 ());
42
- path.lineTo (mLine ->p2 ());
41
+ QLineF shaft (mLine ->p2 (), mLine ->p1 ());
42
+ shaft.setLength (shaft.length () - 5 );
43
+ shaft.setPoints (shaft.p2 (), shaft.p1 ());
44
+ shaft.setLength (shaft.length () - 5 );
43
45
44
- auto arrow = createArrow ();
46
+ QPainterPath path (shaft.p1 ());
47
+ path.lineTo (shaft.p2 ());
48
+
49
+ auto arrow = createArrowHead (properties ()->width () / 2 );
45
50
auto startArrowHead = positionArrowHeadAtStart (arrow);
46
51
auto endArrowHead = positionArrowHeadAtEnd (arrow);
47
52
You can’t perform that action at this time.
0 commit comments