Skip to content

Commit

Permalink
Expose pan tool (#317)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
darrenchann and github-actions[bot] authored Jan 11, 2024
1 parent 699ed0d commit fc02ff1
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/PTFlutterDocumentController.m
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ -(PTExtendedAnnotType)convertAnnotationNameToAnnotType:(NSString*)annotationName
PTAnnotationCreateRubberStampToolKey: @(PTExtendedAnnotTypeStamp),
PTAnnotationCreateRedactionToolKey : @(PTExtendedAnnotTypeRedact),
PTAnnotationCreateLinkToolKey : @(PTExtendedAnnotTypeLink),
// @"PTPanToolKey" : @(),
// @"FormCreateTextField" : @(),
// @"FormCreateCheckboxField" : @(),
// @"FormCreateRadioField" : @(),
Expand Down
1 change: 1 addition & 0 deletions ios/Classes/PdftronFlutterPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
5 changes: 5 additions & 0 deletions ios/Classes/PdftronFlutterPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit fc02ff1

Please sign in to comment.