Skip to content

Commit

Permalink
Add rect area measurement as android only tool (#678)
Browse files Browse the repository at this point in the history
* android implementation + config add

* config.ts file

* rectarea is android only

* Updating package version

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
darrenchann and github-actions[bot] authored Jan 19, 2024
1 parent e190713 commit 703b7ef
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,8 @@ private int convStringToAnnotType(String item) {
annotType = AnnotStyle.CUSTOM_ANNOT_TYPE_PERIMETER_MEASURE;
} else if (TOOL_ANNOTATION_CREATE_AREA_MEASUREMENT.equals(item)) {
annotType = AnnotStyle.CUSTOM_ANNOT_TYPE_AREA_MEASURE;
} else if (TOOL_ANNOTATION_CREATE_RECT_AREA_MEASUREMENT.equals(item)) {
annotType = AnnotStyle.CUSTOM_ANNOT_TYPE_RECT_AREA_MEASURE;
} else if (TOOL_ANNOTATION_CREATE_FILE_ATTACHMENT.equals(item)) {
annotType = Annot.e_FileAttachment;
} else if (TOOL_ANNOTATION_CREATE_SOUND.equals(item)) {
Expand Down Expand Up @@ -1490,6 +1492,8 @@ private ToolManager.ToolMode convStringToToolMode(String item) {
mode = ToolManager.ToolMode.PERIMETER_MEASURE_CREATE;
} else if (TOOL_ANNOTATION_CREATE_AREA_MEASUREMENT.equals(item)) {
mode = ToolManager.ToolMode.AREA_MEASURE_CREATE;
} else if (TOOL_ANNOTATION_CREATE_RECT_AREA_MEASUREMENT.equals(item)) {
mode = ToolManager.ToolMode.RECT_AREA_MEASURE_CREATE;
} else if (TOOL_ANNOTATION_CREATE_FILE_ATTACHMENT.equals(item)) {
mode = ToolManager.ToolMode.FILE_ATTACHMENT_CREATE;
} else if (TOOL_ANNOTATION_CREATE_SOUND.equals(item)) {
Expand Down Expand Up @@ -1730,6 +1734,8 @@ private int convStringToButtonId(String item) {
buttonId = DefaultToolbars.ButtonId.PERIMETER.value();
} else if (TOOL_ANNOTATION_CREATE_AREA_MEASUREMENT.equals(item)) {
buttonId = DefaultToolbars.ButtonId.AREA.value();
} else if (TOOL_ANNOTATION_CREATE_RECT_AREA_MEASUREMENT.equals(item)) {
buttonId = DefaultToolbars.ButtonId.RECT_AREA.value();
} else if (TOOL_ANNOTATION_CREATE_FILE_ATTACHMENT.equals(item)) {
buttonId = DefaultToolbars.ButtonId.ATTACHMENT.value();
} else if (TOOL_ANNOTATION_CREATE_SOUND.equals(item)) {
Expand Down Expand Up @@ -1897,6 +1903,8 @@ private ToolbarButtonType convStringToToolbarType(String item) {
buttonType = ToolbarButtonType.PERIMETER;
} else if (TOOL_ANNOTATION_CREATE_AREA_MEASUREMENT.equals(item)) {
buttonType = ToolbarButtonType.AREA;
} else if (TOOL_ANNOTATION_CREATE_RECT_AREA_MEASUREMENT.equals(item)) {
buttonType = ToolbarButtonType.RECT_AREA;
} else if (TOOL_ANNOTATION_CREATE_FILE_ATTACHMENT.equals(item)) {
buttonType = ToolbarButtonType.ATTACHMENT;
} else if (TOOL_ANNOTATION_CREATE_SOUND.equals(item)) {
Expand Down
1 change: 1 addition & 0 deletions lib/src/Config/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const Config = {
pencilKitDrawing: 'PencilKitDrawing',
// Android only.
annotationCreateLinkText: 'AnnotationCreateLinkText',
annotationCreateRectAreaMeasurement: 'AnnotationCreateRectAreaMeasurement',
},
// FitMode define how a page should fit relative to the viewer, alternatively, the default zoom level
FitMode: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-pdftron",
"title": "React Native Pdftron",
"version": "3.0.3-33",
"version": "3.0.3-34",
"description": "React Native Pdftron",
"main": "./lib/index.js",
"typings": "index.ts",
Expand Down
1 change: 1 addition & 0 deletions src/Config/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const Config = {

// Android only.
annotationCreateLinkText: 'AnnotationCreateLinkText',
annotationCreateRectAreaMeasurement: 'AnnotationCreateRectAreaMeasurement',
},

// FitMode define how a page should fit relative to the viewer, alternatively, the default zoom level
Expand Down

0 comments on commit 703b7ef

Please sign in to comment.