@syncfusion/ej2-image-editor 22.2.11 → 23.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/ej2-image-editor.umd.min.js +3 -3
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +4446 -678
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +4409 -632
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +3 -3
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +2 -2
  11. package/package.json +12 -12
  12. package/src/image-editor/action/crop.js +47 -30
  13. package/src/image-editor/action/draw.d.ts +16 -0
  14. package/src/image-editor/action/draw.js +827 -81
  15. package/src/image-editor/action/export.d.ts +3 -0
  16. package/src/image-editor/action/export.js +84 -20
  17. package/src/image-editor/action/filter.d.ts +0 -1
  18. package/src/image-editor/action/filter.js +28 -41
  19. package/src/image-editor/action/freehand-draw.d.ts +1 -0
  20. package/src/image-editor/action/freehand-draw.js +92 -56
  21. package/src/image-editor/action/selection.d.ts +6 -0
  22. package/src/image-editor/action/selection.js +417 -68
  23. package/src/image-editor/action/shape.d.ts +8 -0
  24. package/src/image-editor/action/shape.js +303 -91
  25. package/src/image-editor/action/transform.d.ts +9 -0
  26. package/src/image-editor/action/transform.js +402 -52
  27. package/src/image-editor/action/undo-redo.d.ts +1 -0
  28. package/src/image-editor/action/undo-redo.js +138 -10
  29. package/src/image-editor/base/enum.d.ts +38 -1
  30. package/src/image-editor/base/enum.js +39 -0
  31. package/src/image-editor/base/image-editor-model.d.ts +16 -2
  32. package/src/image-editor/base/image-editor.d.ts +142 -7
  33. package/src/image-editor/base/image-editor.js +719 -70
  34. package/src/image-editor/base/interface.d.ts +233 -2
  35. package/src/image-editor/renderer/toolbar.d.ts +25 -0
  36. package/src/image-editor/renderer/toolbar.js +1274 -72
  37. package/styles/bootstrap-dark.css +73 -1
  38. package/styles/bootstrap.css +73 -1
  39. package/styles/bootstrap4.css +73 -1
  40. package/styles/bootstrap5-dark.css +73 -1
  41. package/styles/bootstrap5.css +73 -1
  42. package/styles/fabric-dark.css +73 -1
  43. package/styles/fabric.css +73 -1
  44. package/styles/fluent-dark.css +73 -1
  45. package/styles/fluent.css +73 -1
  46. package/styles/highcontrast-light.css +75 -3
  47. package/styles/highcontrast.css +74 -7
  48. package/styles/image-editor/_bootstrap-dark-definition.scss +1 -0
  49. package/styles/image-editor/_bootstrap-definition.scss +1 -0
  50. package/styles/image-editor/_bootstrap4-definition.scss +1 -0
  51. package/styles/image-editor/_bootstrap5-definition.scss +1 -0
  52. package/styles/image-editor/_fabric-dark-definition.scss +1 -0
  53. package/styles/image-editor/_fabric-definition.scss +1 -0
  54. package/styles/image-editor/_fluent-definition.scss +1 -0
  55. package/styles/image-editor/_fusionnew-definition.scss +1 -0
  56. package/styles/image-editor/_highcontrast-definition.scss +2 -1
  57. package/styles/image-editor/_highcontrast-light-definition.scss +2 -1
  58. package/styles/image-editor/_layout.scss +98 -0
  59. package/styles/image-editor/_material-dark-definition.scss +1 -0
  60. package/styles/image-editor/_material-definition.scss +1 -0
  61. package/styles/image-editor/_material3-definition.scss +2 -1
  62. package/styles/image-editor/_tailwind-definition.scss +1 -0
  63. package/styles/image-editor/_theme.scss +4 -2
  64. package/styles/image-editor/bootstrap-dark.css +73 -1
  65. package/styles/image-editor/bootstrap-dark.scss +1 -1
  66. package/styles/image-editor/bootstrap.css +73 -1
  67. package/styles/image-editor/bootstrap.scss +1 -1
  68. package/styles/image-editor/bootstrap4.css +73 -1
  69. package/styles/image-editor/bootstrap4.scss +1 -1
  70. package/styles/image-editor/bootstrap5-dark.css +73 -1
  71. package/styles/image-editor/bootstrap5-dark.scss +1 -1
  72. package/styles/image-editor/bootstrap5.css +73 -1
  73. package/styles/image-editor/bootstrap5.scss +1 -1
  74. package/styles/image-editor/fabric-dark.css +73 -1
  75. package/styles/image-editor/fabric-dark.scss +1 -1
  76. package/styles/image-editor/fabric.css +73 -1
  77. package/styles/image-editor/fabric.scss +1 -1
  78. package/styles/image-editor/fluent-dark.css +73 -1
  79. package/styles/image-editor/fluent-dark.scss +1 -1
  80. package/styles/image-editor/fluent.css +73 -1
  81. package/styles/image-editor/fluent.scss +1 -1
  82. package/styles/image-editor/highcontrast-light.css +75 -3
  83. package/styles/image-editor/highcontrast-light.scss +1 -1
  84. package/styles/image-editor/highcontrast.css +74 -7
  85. package/styles/image-editor/highcontrast.scss +1 -1
  86. package/styles/image-editor/icons/_bootstrap-dark.scss +1 -0
  87. package/styles/image-editor/icons/_bootstrap.scss +1 -0
  88. package/styles/image-editor/icons/_bootstrap4.scss +1 -0
  89. package/styles/image-editor/icons/_bootstrap5.scss +1 -0
  90. package/styles/image-editor/icons/_fabric-dark.scss +1 -0
  91. package/styles/image-editor/icons/_fabric.scss +1 -0
  92. package/styles/image-editor/icons/_fluent.scss +1 -0
  93. package/styles/image-editor/icons/_fusionnew.scss +1 -0
  94. package/styles/image-editor/icons/_highcontrast-light.scss +1 -0
  95. package/styles/image-editor/icons/_highcontrast.scss +1 -0
  96. package/styles/image-editor/icons/_material-dark.scss +1 -0
  97. package/styles/image-editor/icons/_material.scss +1 -0
  98. package/styles/image-editor/icons/_material3.scss +1 -0
  99. package/styles/image-editor/icons/_tailwind.scss +1 -0
  100. package/styles/image-editor/material-dark.css +73 -2
  101. package/styles/image-editor/material-dark.scss +1 -1
  102. package/styles/image-editor/material.css +73 -2
  103. package/styles/image-editor/material.scss +1 -1
  104. package/styles/image-editor/material3-dark.css +78 -4
  105. package/styles/image-editor/material3-dark.scss +1 -1
  106. package/styles/image-editor/material3.css +78 -4
  107. package/styles/image-editor/material3.scss +1 -1
  108. package/styles/image-editor/tailwind-dark.css +73 -2
  109. package/styles/image-editor/tailwind-dark.scss +1 -1
  110. package/styles/image-editor/tailwind.css +73 -2
  111. package/styles/image-editor/tailwind.scss +1 -1
  112. package/styles/material-dark.css +73 -2
  113. package/styles/material.css +73 -2
  114. package/styles/material3-dark.css +78 -4
  115. package/styles/material3-dark.scss +1 -1
  116. package/styles/material3.css +78 -4
  117. package/styles/material3.scss +1 -1
  118. package/styles/tailwind-dark.css +73 -2
  119. package/styles/tailwind.css +73 -2
@@ -3,11 +3,11 @@ import { EmitType } from '@syncfusion/ej2-base';
3
3
  import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';
4
4
  import { ChildProperty } from '@syncfusion/ej2-base';
5
5
  import { ImageEditorModel, FinetuneSettingsModel, ZoomSettingsModel, SelectionSettingsModel } from './image-editor-model';
6
- import { SelectionChangeEventArgs, Transition, ArrowheadType } from './../index';
6
+ import { SelectionChangeEventArgs, Transition, ArrowheadType, ResizeEventArgs, FrameType, FrameLineStyle, FrameChangeEventArgs } from './../index';
7
7
  import { ZoomEventArgs, PanEventArgs, CropEventArgs, RotateEventArgs, FlipEventArgs, ShapeChangeEventArgs } from './../index';
8
8
  import { ToolbarEventArgs, OpenEventArgs, SaveEventArgs, BeforeSaveEventArgs, Point, ShapeSettings, ImageFilterEventArgs } from './../index';
9
9
  import { FinetuneEventArgs, QuickAccessToolbarEventArgs, CurrentObject, ImageDimension, TransformValue, PanPoint } from './../index';
10
- import { Interaction, SelectionPoint, ImageFinetuneValue, Dimension, ActivePoint, ImageEditorClickEventArgs } from './../index';
10
+ import { Interaction, SelectionPoint, ImageFinetuneValue, Dimension, ActivePoint, ImageEditorClickEventArgs, FrameValue } from './../index';
11
11
  import { Direction, ZoomTrigger, Theme, ImageEditorCommand, ImageFilterOption, ImageFinetuneOption } from './../index';
12
12
  import { ItemModel as DropDownButtonItemModel } from '@syncfusion/ej2-splitbuttons';
13
13
  /**
@@ -198,6 +198,8 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
198
198
  /** @hidden */
199
199
  baseImg: HTMLImageElement;
200
200
  /** @hidden */
201
+ baseImgCanvas: HTMLCanvasElement;
202
+ /** @hidden */
201
203
  lowerCanvas: HTMLCanvasElement;
202
204
  /** @hidden */
203
205
  upperCanvas: HTMLCanvasElement;
@@ -271,6 +273,46 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
271
273
  eventType: string;
272
274
  /** @hidden */
273
275
  panEventArgs: PanEventArgs;
276
+ /** @hidden */
277
+ resizeSrc: ActivePoint;
278
+ /** @hidden */
279
+ isResize: boolean;
280
+ /** @hidden */
281
+ aspectHeight: number;
282
+ /** @hidden */
283
+ aspectWidth: number;
284
+ /** @hidden */
285
+ isAspectRatio: boolean;
286
+ /** @hidden */
287
+ prevCropObj: CurrentObject;
288
+ /** @hidden */
289
+ prevObj: CurrentObject;
290
+ /** @hidden */
291
+ frameObj: FrameValue;
292
+ /** @hidden */
293
+ tempFrameObj: FrameValue;
294
+ /** @hidden */
295
+ allowDownScale: boolean;
296
+ /** @hidden */
297
+ frameType: FrameType;
298
+ /** @hidden */
299
+ gradientColor: string;
300
+ /** @hidden */
301
+ size: number;
302
+ /** @hidden */
303
+ inset: number;
304
+ /** @hidden */
305
+ offset: number;
306
+ /** @hidden */
307
+ borderRadius: number;
308
+ /** @hidden */
309
+ lineCount: number;
310
+ /** @hidden */
311
+ tempFrameZoomLevel: number;
312
+ /** @hidden */
313
+ frameDestPoints: ImageDimension;
314
+ /** @hidden */
315
+ cxtTbarHeight: number;
274
316
  private lowerContext;
275
317
  private upperContext;
276
318
  private inMemoryContext;
@@ -337,7 +379,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
337
379
  * If the property is defined as empty collection, the toolbar will not be rendered.
338
380
  * The preconfigured toolbar commands are
339
381
  * - Crop: helps to crop an image as ellipse, square, various ratio aspects, custom selection with resize, drag and drop.
340
- * - Annotate: help to insert a shape on image that supports rectangle, ellipse, line, arrow, path, text and freehand drawing with resize, drag and drop, and customize its appearance.
382
+ * - Annotate: help to insert a shape on image that supports rectangle, ellipse, line, arrow, path, text, image and freehand drawing with resize, drag and drop, and customize its appearance.
341
383
  * - Transform: helps to rotate and flip an image.
342
384
  * - Finetunes: helps to perform adjustments on an image.
343
385
  * - Filters: helps to perform predefined color filters.
@@ -660,6 +702,12 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
660
702
  * </script>
661
703
  */
662
704
  quickAccessToolbarOpen: EmitType<QuickAccessToolbarEventArgs>;
705
+ /**
706
+ * Event callback that is raised while resizing an image.
707
+ *
708
+ * @event resizing
709
+ */
710
+ resizing: EmitType<ResizeEventArgs>;
663
711
  /**
664
712
  * Event callback that is raised once the quick access toolbar item is clicked.
665
713
  *
@@ -667,6 +715,12 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
667
715
  *
668
716
  */
669
717
  quickAccessToolbarItemClick: EmitType<ClickEventArgs>;
718
+ /**
719
+ * Event callback that is raised while applying frames on an image.
720
+ *
721
+ * @event frameChange
722
+ */
723
+ frameChange: EmitType<FrameChangeEventArgs>;
670
724
  /**
671
725
  *
672
726
  * Constructor for creating the widget
@@ -718,6 +772,9 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
718
772
  onPropertyChanged(newProperties: ImageEditorModel, oldProperties?: ImageEditorModel): void;
719
773
  destroy(): void;
720
774
  initialize(): void;
775
+ private createDropUploader;
776
+ private dlgCloseBtnClick;
777
+ private showDialogPopup;
721
778
  /**
722
779
  *
723
780
  * This Method will add events to component (element, event, method, current reference)
@@ -775,7 +832,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
775
832
  * A horizontal direction for horizontal flipping and vertical direction for vertical flipping.
776
833
  *
777
834
  * @remarks
778
- * It flips the shapes including rectangle, circle, line, text, and freehand drawings.
835
+ * It flips the shapes including rectangle, circle, line, text, image, and freehand drawings.
779
836
  *
780
837
  * @returns {void}.
781
838
  *
@@ -820,7 +877,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
820
877
  * A positive integer value for clockwise and negative integer value for anti-clockwise rotation.
821
878
  *
822
879
  * @remarks
823
- * It rotated the shapes including rectangle, circle, line, text, and freehand drawings.
880
+ * It rotated the shapes including rectangle, circle, line, text, image, and freehand drawings.
824
881
  *
825
882
  * @returns {boolean}.
826
883
  *
@@ -912,10 +969,11 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
912
969
  * @param {number} strokeWidth - Specifies the stroke width of ellipse.
913
970
  * @param {string} strokeColor - Specifies the stroke color of ellipse.
914
971
  * @param {string} fillColor - Specifies the fill color of the ellipse.
972
+ * @param {number} degree - Specifies the degree to rotate the ellipse.
915
973
  * @returns {boolean}.
916
974
  *
917
975
  */
918
- drawEllipse(x?: number, y?: number, radiusX?: number, radiusY?: number, strokeWidth?: number, strokeColor?: string, fillColor?: string): boolean;
976
+ drawEllipse(x?: number, y?: number, radiusX?: number, radiusY?: number, strokeWidth?: number, strokeColor?: string, fillColor?: string, degree?: number): boolean;
919
977
  /**
920
978
  * Draw line on an image.
921
979
  *
@@ -961,9 +1019,10 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
961
1019
  * @param {number} strokeWidth - Specifies the stroke width of rectangle.
962
1020
  * @param {string} strokeColor - Specifies the stroke color of rectangle.
963
1021
  * @param {string} fillColor - Specifies the fill color of the rectangle.
1022
+ * @param {number} degree - Specifies the degree to rotate the rectangle.
964
1023
  * @returns {boolean}.
965
1024
  */
966
- drawRectangle(x?: number, y?: number, width?: number, height?: number, strokeWidth?: number, strokeColor?: string, fillColor?: string): boolean;
1025
+ drawRectangle(x?: number, y?: number, width?: number, height?: number, strokeWidth?: number, strokeColor?: string, fillColor?: string, degree?: number): boolean;
967
1026
  /**
968
1027
  * Draw a text on an image.
969
1028
  *
@@ -981,6 +1040,21 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
981
1040
  *
982
1041
  */
983
1042
  drawText(x?: number, y?: number, text?: string, fontFamily?: string, fontSize?: number, bold?: boolean, italic?: boolean, color?: string): boolean;
1043
+ /**
1044
+ * Draw an image as annotation on an image.
1045
+ *
1046
+ *
1047
+ * @param {string | ImageData} data - Specifies url of the image or image data.
1048
+ * @param {number} x - Specifies x-coordinate of a starting point for an image.
1049
+ * @param {number} y - Specifies y-coordinate of a starting point for an image.
1050
+ * @param {number} width - Specifies the width of the image.
1051
+ * @param {number} height - Specifies the height of the image.
1052
+ * @param {boolean} isAspectRatio - Specifies whether to maintain aspect ratio or not.
1053
+ * @param {number} degree - Specifies the degree to rotate the image.
1054
+ * @returns {boolean}.
1055
+ *
1056
+ */
1057
+ drawImage(data: string | ImageData, x?: number, y?: number, width?: number, height?: number, isAspectRatio?: boolean, degree?: number): boolean;
984
1058
  /**
985
1059
  * Select a shape based on the given shape id.
986
1060
  * Use 'getShapeSettings' method to get the shape id which is then passed to perform selection.
@@ -1073,6 +1147,32 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
1073
1147
  * A Dimension object containing the x, y, width, and height of an image.
1074
1148
  */
1075
1149
  getImageDimension(): Dimension;
1150
+ /**
1151
+ * Resize an image by changing its width and height.
1152
+ *
1153
+ * @param {number} width - Specifies the width of an image.
1154
+ * @param {number} height - Specifies the height of an image.
1155
+ * @param {boolean} isAspectRatio - Specifies whether the scaling option is enabled or not.
1156
+ *
1157
+ * @returns {boolean} - A boolean value indicating the success of the resizing operation.
1158
+ */
1159
+ resize(width: number, height: number, isAspectRatio?: boolean): boolean;
1160
+ /**
1161
+ * Draw a frame on an image.
1162
+ *
1163
+ * @param { FrameType} frameType - Specifies the frame option to be drawn on an image.
1164
+ * @param {string} color - Specifies the color of a frame on an image. The default value is ‘#fff’.
1165
+ * @param {string} gradientColor - Specifies the gradient color of a frame on an image. The default value is ‘’.
1166
+ * @param {number} size - Specifies the size of the frame as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 20 if not specified.
1167
+ * @param {number} inset - Specifies the inset value for line, hook, and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1168
+ * @param {number} offset - Specifies the offset value for line and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1169
+ * @param {number} borderRadius - Specifies the border radius for line-type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.
1170
+ * @param {FrameLineStyle} frameLineStyle - Specifies the type of line to be drawn for line-type frames. Default to Solid if not specified.
1171
+ * @param {number} lineCount - Specifies the number of lines for line-type frames. Defaults to 0 if not specified.
1172
+ *
1173
+ * @returns {boolean}.
1174
+ */
1175
+ drawFrame(frameType: FrameType, color: string, gradientColor: string, size: number, inset: number, offset: number, borderRadius: number, frameLineStyle: FrameLineStyle, lineCount: number): boolean;
1076
1176
  private toolbarTemplateFn;
1077
1177
  private quickAccessToolbarTemplateFn;
1078
1178
  private templateParser;
@@ -1080,6 +1180,7 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
1080
1180
  private getFinetuneOption;
1081
1181
  private setPenStroke;
1082
1182
  private updateFreehandDrawColorChange;
1183
+ private updateImageTransformColl;
1083
1184
  private setInitialZoomState;
1084
1185
  /**
1085
1186
  * Set the old item Transform item state.
@@ -1243,6 +1344,32 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
1243
1344
  * @returns {void}.
1244
1345
  */
1245
1346
  updateFillColor(value: string): void;
1347
+ /**
1348
+ * Apply horizontal flip.
1349
+ *
1350
+ * @param { CanvasRenderingContext2D } ctx - Specifies the canvas context 2D.
1351
+ * @param { boolean } isPreventURC - Specifies to update undo redo collection.
1352
+ * @hidden
1353
+ * @returns {void}.
1354
+ */
1355
+ horizontalFlip(ctx: CanvasRenderingContext2D, isPreventURC?: boolean): void;
1356
+ /**
1357
+ * Apply vertical flip.
1358
+ *
1359
+ * @param { CanvasRenderingContext2D } ctx - Specifies the canvas context 2D.
1360
+ * @param { boolean } isPreventURC - Specifies to update undo redo collection.
1361
+ * @hidden
1362
+ * @returns {void}.
1363
+ */
1364
+ verticalFlip(ctx: CanvasRenderingContext2D, isPreventURC?: boolean): void;
1365
+ /**
1366
+ * Apply rotate image.
1367
+ *
1368
+ * @param { string } rotate - Specifies the direction of rotation.
1369
+ * @hidden
1370
+ * @returns {void}.
1371
+ */
1372
+ rotateImage(rotate: string): void;
1246
1373
  /**
1247
1374
  * Get pascalToSplitWords from string.
1248
1375
  *
@@ -1297,4 +1424,12 @@ export declare class ImageEditor extends Component<HTMLDivElement> implements IN
1297
1424
  * @returns {void}.
1298
1425
  */
1299
1426
  updateToolbar(element: HTMLDivElement, type: string, value?: string): void;
1427
+ /**
1428
+ * Trigger the shapeChanging event for after the shape applied.
1429
+ *
1430
+ * @param { ShapeChangeEventArgs } shapeChangedArgs - Specifies the shapeChaning event args.
1431
+ * @hidden
1432
+ * @returns {void}.
1433
+ */
1434
+ triggerShapeChanged(shapeChangedArgs: ShapeChangeEventArgs): void;
1300
1435
  }