Skip to content

Commit 11da16d

Browse files
committed
Add number pointer tool #79
1 parent faba2b3 commit 11da16d

32 files changed

+757
-137
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* New: Saved image expand to include annotations out of border. ([#90](https://github.com/ksnip/kImageAnnotator/issues/90))
77
* New: Add support for stickers. ([#74](https://github.com/ksnip/kImageAnnotator/issues/74))
88
* New: Add tab context menu for close all tabs and close other tabs. ([#93](https://github.com/ksnip/kImageAnnotator/issues/93))
9+
* New: Add Number with Arrow/pointer tool. ([#79](https://github.com/ksnip/kImageAnnotator/issues/79))
910
* Changed: Make dropdown buttons show popup on click. ([#89](https://github.com/ksnip/kImageAnnotator/issues/89))
1011
* Changed: Hide unavailable setting widgets. ([#101](https://github.com/ksnip/kImageAnnotator/issues/101))
1112
* Changed: Make arrow size decrease with stroke size. ([#84](https://github.com/ksnip/kImageAnnotator/issues/84))

resources/.directory

Lines changed: 0 additions & 4 deletions
This file was deleted.

resources/icons/dark/.directory

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 100 additions & 0 deletions
Loading

resources/icons/light/.directory

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 101 additions & 0 deletions
Loading

resources/kImageAnnotator_resources.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<file alias="arrow.svg" >icons/dark/arrow.svg</file>
55
<file alias="doubleArrow.svg" >icons/dark/doubleArrow.svg</file>
66
<file alias="number.svg" >icons/dark/number.svg</file>
7+
<file alias="numberPointer.svg" >icons/dark/numberPointer.svg</file>
78
<file alias="markerPen.svg" >icons/dark/markerPen.svg</file>
89
<file alias="markerRect.svg" >icons/dark/markerRect.svg</file>
910
<file alias="markerEllipse.svg" >icons/dark/markerEllipse.svg</file>
@@ -29,6 +30,7 @@
2930
<file alias="arrow.svg" >icons/light/arrow.svg</file>
3031
<file alias="doubleArrow.svg" >icons/light/doubleArrow.svg</file>
3132
<file alias="number.svg" >icons/light/number.svg</file>
33+
<file alias="numberPointer.svg" >icons/light/numberPointer.svg</file>
3234
<file alias="markerPen.svg" >icons/light/markerPen.svg</file>
3335
<file alias="markerRect.svg" >icons/light/markerRect.svg</file>
3436
<file alias="markerEllipse.svg" >icons/light/markerEllipse.svg</file>

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@ set(KIMAGEANNOTATOR_SRCS
5050
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationRect.cpp
5151
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationEllipse.cpp
5252
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationNumber.cpp
53+
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationNumberPointer.cpp
5354
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationPen.cpp
5455
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationText.cpp
5556
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationBlur.cpp
5657
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationImage.cpp
5758
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/AnnotationSticker.cpp
59+
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/BaseAnnotationNumber.cpp
5860
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/helper/KeyInputHelper.cpp
5961
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/helper/TextCursor.cpp
6062
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/helper/CapsLockStatusChecker.cpp
63+
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/helper/NumberRectHelper.cpp
64+
${CMAKE_CURRENT_SOURCE_DIR}/annotations/items/helper/ShapeHelper.cpp
6165
${CMAKE_CURRENT_SOURCE_DIR}/annotations/undo/AddCommand.cpp
6266
${CMAKE_CURRENT_SOURCE_DIR}/annotations/undo/DeleteCommand.cpp
6367
${CMAKE_CURRENT_SOURCE_DIR}/annotations/undo/MoveCommand.cpp

src/annotations/core/AnnotationItemFactory.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ AbstractAnnotationItem *AnnotationItemFactory::createItem(const QPointF &initPos
108108
newItem = new AnnotationNumber(initPosition, properties.staticCast<AnnotationTextProperties>());
109109
mNumberManager->addItem(dynamic_cast<AnnotationNumber *>(newItem));
110110
break;
111+
case ToolTypes::NumberPointer:
112+
newItem = new AnnotationNumberPointer(initPosition, properties.staticCast<AnnotationTextProperties>());
113+
mNumberManager->addItem(dynamic_cast<AnnotationNumberPointer *>(newItem));
114+
break;
111115
case ToolTypes::Text:
112116
newItem = new AnnotationText(initPosition, properties.staticCast<AnnotationTextProperties>());
113117
break;
@@ -126,6 +130,7 @@ AbstractAnnotationItem *AnnotationItemFactory::createItem(const QPointF &initPos
126130
AbstractAnnotationItem *AnnotationItemFactory::cloneItem(const AbstractAnnotationItem *item)
127131
{
128132
Q_ASSERT(item != nullptr);
133+
129134
AbstractAnnotationItem *newItem = nullptr;
130135

131136
switch (item->toolType()) {
@@ -160,6 +165,10 @@ AbstractAnnotationItem *AnnotationItemFactory::cloneItem(const AbstractAnnotatio
160165
newItem = new AnnotationNumber(*(dynamic_cast<const AnnotationNumber *>(item)));
161166
mNumberManager->addItem(dynamic_cast<AnnotationNumber *>(newItem));
162167
break;
168+
case ToolTypes::NumberPointer:
169+
newItem = new AnnotationNumberPointer(*(dynamic_cast<const AnnotationNumberPointer *>(item)));
170+
mNumberManager->addItem(dynamic_cast<AnnotationNumberPointer *>(newItem));
171+
break;
163172
case ToolTypes::Text:
164173
newItem = new AnnotationText(*(dynamic_cast<const AnnotationText *>(item)));
165174
break;

src/annotations/core/AnnotationItemFactory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "src/annotations/items/AnnotationRect.h"
3131
#include "src/annotations/items/AnnotationEllipse.h"
3232
#include "src/annotations/items/AnnotationNumber.h"
33+
#include "src/annotations/items/AnnotationNumberPointer.h"
3334
#include "src/annotations/items/AnnotationText.h"
3435
#include "src/annotations/items/AnnotationBlur.h"
3536
#include "src/annotations/items/AnnotationImage.h"

0 commit comments

Comments
 (0)