From fc02ff143aff1c10c4784da9cb6436100c673f7b Mon Sep 17 00:00:00 2001 From: Darren Chan Date: Thu, 11 Jan 2024 08:32:37 -0800 Subject: [PATCH] Expose pan tool (#317) * android implementation * iOS implementation * changelog * Updating pubspec.yaml * Updating package version * Updating pubspec.yaml * Updating package version --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 3 +++ .../java/com/pdftron/pdftronflutter/helpers/PluginUtils.java | 5 +++++ ios/Classes/PTFlutterDocumentController.m | 1 + ios/Classes/PdftronFlutterPlugin.h | 1 + ios/Classes/PdftronFlutterPlugin.m | 5 +++++ lib/src/constants.dart | 1 + pubspec.yaml | 2 +- 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c7a1b7..8a486a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.0-24 - December 13, 2023 +- expose Pan tool + # 1.0.0-23 - December 6, 2023 - Update Android to v10.6.0 diff --git a/android/src/main/java/com/pdftron/pdftronflutter/helpers/PluginUtils.java b/android/src/main/java/com/pdftron/pdftronflutter/helpers/PluginUtils.java index ea252fd4..75c3afc6 100644 --- a/android/src/main/java/com/pdftron/pdftronflutter/helpers/PluginUtils.java +++ b/android/src/main/java/com/pdftron/pdftronflutter/helpers/PluginUtils.java @@ -413,6 +413,7 @@ public class PluginUtils { public static final String TOOL_BUTTON_CALLOUT = "calloutToolButton"; public static final String TOOL_BUTTON_STAMP = "stampToolButton"; + public static final String TOOL_PAN = "Pan"; public static final String TOOL_ANNOTATION_CREATE_FREE_HAND = "AnnotationCreateFreeHand"; public static final String TOOL_ANNOTATION_CREATE_TEXT_HIGHLIGHT = "AnnotationCreateTextHighlight"; public static final String TOOL_ANNOTATION_CREATE_TEXT_UNDERLINE = "AnnotationCreateTextUnderline"; @@ -1677,6 +1678,8 @@ private static ToolManager.ToolMode convStringToToolMode(String item) { mode = ToolManager.ToolMode.SMART_PEN_INK; } else if (TOOL_ANNOTATION_LASSO.equals(item)) { mode = ToolManager.ToolMode.ANNOT_EDIT_RECT_GROUP; + } else if (TOOL_PAN.equals(item)) { + mode = ToolManager.ToolMode.PAN; } return mode; } @@ -1794,6 +1797,8 @@ public static int convStringToAnnotType(String item) { annotType = Annot.e_Widget; } else if (TOOL_FORM_CREATE_TOOL_BOX_FIELD.equals(item)) { annotType = Annot.e_Widget; + } else if (TOOL_PAN.equals(item)) { + annotType = Annot.e_Unknown; } return annotType; } diff --git a/ios/Classes/PTFlutterDocumentController.m b/ios/Classes/PTFlutterDocumentController.m index b3031178..8363e63d 100644 --- a/ios/Classes/PTFlutterDocumentController.m +++ b/ios/Classes/PTFlutterDocumentController.m @@ -786,6 +786,7 @@ -(PTExtendedAnnotType)convertAnnotationNameToAnnotType:(NSString*)annotationName PTAnnotationCreateRubberStampToolKey: @(PTExtendedAnnotTypeStamp), PTAnnotationCreateRedactionToolKey : @(PTExtendedAnnotTypeRedact), PTAnnotationCreateLinkToolKey : @(PTExtendedAnnotTypeLink), +// @"PTPanToolKey" : @(), // @"FormCreateTextField" : @(), // @"FormCreateCheckboxField" : @(), // @"FormCreateRadioField" : @(), diff --git a/ios/Classes/PdftronFlutterPlugin.h b/ios/Classes/PdftronFlutterPlugin.h index f437e6ae..1e6aa42b 100644 --- a/ios/Classes/PdftronFlutterPlugin.h +++ b/ios/Classes/PdftronFlutterPlugin.h @@ -120,6 +120,7 @@ static NSString * const PTFormCreateComboBoxFieldToolKey = @"FormCreateComboBoxF static NSString * const PTFormCreateListBoxFieldToolKey = @"FormCreateListBoxField"; static NSString * const PTPencilKitDrawingToolKey = @"PencilKitDrawing"; static NSString * const PTAnnotationSmartPenToolKey = @"AnnotationSmartPen"; +static NSString * const PTPanToolKey = @"Pan"; // button static NSString * const PTStickyToolButtonKey = @"stickyToolButton"; diff --git a/ios/Classes/PdftronFlutterPlugin.m b/ios/Classes/PdftronFlutterPlugin.m index 808358ca..5a97eacb 100644 --- a/ios/Classes/PdftronFlutterPlugin.m +++ b/ios/Classes/PdftronFlutterPlugin.m @@ -3023,6 +3023,8 @@ - (void)setToolMode:(NSString *)toolMode resultToken:(FlutterResult)flutterResul toolClass = [PTPencilDrawingCreate class]; } else if ([toolMode isEqualToString:PTAnnotationSmartPenToolKey]) { toolClass = [PTSmartPen class]; + } else if ([toolMode isEqualToString:PTPanToolKey]) { + toolClass = [PTPanTool class]; } if (toolClass) { @@ -3814,6 +3816,9 @@ + (Class)toolClassForKey:(NSString *)key else if ([key isEqualToString:PTEraserToolKey]) { return [PTEraser class]; } + else if ([key isEqualToString:PTPanToolKey]) { + return [PTPanTool class]; + } return Nil; } diff --git a/lib/src/constants.dart b/lib/src/constants.dart index b91948b9..0c17d2bc 100644 --- a/lib/src/constants.dart +++ b/lib/src/constants.dart @@ -243,6 +243,7 @@ class Tools { static const formCreateComboBoxField = 'FormCreateComboBoxField'; static const formCreateListBoxField = 'FormCreateListBoxField'; static const annotationSmartPen = 'AnnotationSmartPen'; + static const pan = 'Pan'; /// iOS only. static const pencilKitDrawing = 'PencilKitDrawing'; diff --git a/pubspec.yaml b/pubspec.yaml index 72afd85e..29537922 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: pdftron_flutter description: A convenience wrapper to build Flutter apps that use the PDFTron mobile SDK for smooth, flexible, and stand-alone document viewing. -version: 1.0.1-24 +version: 1.0.1-25 homepage: https://www.pdftron.com repository: https://github.com/PDFTron/pdftron-flutter issue_tracker: https://github.com/PDFTron/pdftron-flutter/issues