@syncfusion/ej2-image-editor 22.1.34 → 22.1.37

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 (35) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/ej2-image-editor.umd.min.js +2 -2
  3. package/dist/ej2-image-editor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-image-editor.es2015.js +1018 -1064
  5. package/dist/es6/ej2-image-editor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-image-editor.es5.js +1016 -1066
  7. package/dist/es6/ej2-image-editor.es5.js.map +1 -1
  8. package/dist/global/ej2-image-editor.min.js +2 -2
  9. package/dist/global/ej2-image-editor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +9 -9
  12. package/src/image-editor/action/crop.d.ts +1 -0
  13. package/src/image-editor/action/crop.js +12 -1
  14. package/src/image-editor/action/draw.d.ts +4 -1
  15. package/src/image-editor/action/draw.js +137 -127
  16. package/src/image-editor/action/filter.js +1 -1
  17. package/src/image-editor/action/freehand-draw.js +9 -9
  18. package/src/image-editor/action/selection.d.ts +1 -1
  19. package/src/image-editor/action/selection.js +64 -226
  20. package/src/image-editor/action/shape.d.ts +1 -0
  21. package/src/image-editor/action/shape.js +97 -9
  22. package/src/image-editor/action/transform.js +211 -22
  23. package/src/image-editor/action/undo-redo.js +9 -7
  24. package/src/image-editor/base/image-editor-model.d.ts +2 -2
  25. package/src/image-editor/base/image-editor.d.ts +0 -15
  26. package/src/image-editor/base/image-editor.js +35 -225
  27. package/src/image-editor/base/interface.d.ts +11 -3
  28. package/src/image-editor/renderer/toolbar.js +362 -363
  29. package/styles/highcontrast-light.css +2 -2
  30. package/styles/highcontrast.css +6 -1
  31. package/styles/image-editor/_highcontrast-definition.scss +1 -1
  32. package/styles/image-editor/_highcontrast-light-definition.scss +1 -1
  33. package/styles/image-editor/_theme.scss +2 -4
  34. package/styles/image-editor/highcontrast-light.css +2 -2
  35. package/styles/image-editor/highcontrast.css +6 -1
@@ -114,6 +114,7 @@ var ToolbarModule = /** @class */ (function () {
114
114
  this.l10n = new L10n('image-editor', this.defaultLocale, this.parent.locale);
115
115
  };
116
116
  ToolbarModule.prototype.toolbar = function (args) {
117
+ var parent = this.parent;
117
118
  this.updatePrivateVariables();
118
119
  switch (args.prop) {
119
120
  case 'create-toolbar':
@@ -186,19 +187,19 @@ var ToolbarModule = /** @class */ (function () {
186
187
  this.selFhdColor = args.value['color'];
187
188
  break;
188
189
  case 'getCurrentFilter':
189
- args.value['obj']['currentFilter'] = this.parent.currentFilter;
190
+ args.value['obj']['currentFilter'] = parent.currentFilter;
190
191
  break;
191
192
  case 'setCurrentFilter':
192
- this.parent.currentFilter = args.value['filter'];
193
+ parent.currentFilter = args.value['filter'];
193
194
  break;
194
195
  case 'setInitialAdjustmentValue':
195
- this.parent.initialAdjustmentValue = args.value['value'];
196
+ parent.initialAdjustmentValue = args.value['value'];
196
197
  break;
197
198
  case 'getCanvasFilter':
198
- args.value['obj']['canvasFilter'] = this.parent.canvasFilter;
199
+ args.value['obj']['canvasFilter'] = parent.canvasFilter;
199
200
  break;
200
201
  case 'setCanvasFilter':
201
- this.parent.canvasFilter = args.value['filter'];
202
+ parent.canvasFilter = args.value['filter'];
202
203
  break;
203
204
  case 'getDefToolbarItems':
204
205
  args.value['obj']['defToolbarItems'] = this.defToolbarItems;
@@ -210,7 +211,7 @@ var ToolbarModule = /** @class */ (function () {
210
211
  this.performDefTbrClick(args.value['type'], args.value['isContextualToolbar'], args.value['isDisabledAdjustment'], args.value['isDisabledFilter'], args.value['isFilterFinetune']);
211
212
  break;
212
213
  case 'setTempFilterProperties':
213
- this.parent.setTempFilterProperties();
214
+ parent.setTempFilterProperties();
214
215
  break;
215
216
  case 'refreshSlider':
216
217
  this.refreshSlider();
@@ -219,28 +220,25 @@ var ToolbarModule = /** @class */ (function () {
219
220
  this.renderSlider(args.value['type']);
220
221
  break;
221
222
  case 'getCurrAdjustmentValue':
222
- this.parent.getCurrAdjustmentValue(args.value['type']);
223
+ parent.getCurrAdjustmentValue(args.value['type']);
223
224
  break;
224
225
  case 'setCurrAdjustmentValue':
225
- this.parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
226
+ parent.setCurrAdjustmentValue(args.value['type'], args.value['value']);
226
227
  break;
227
228
  case 'refreshShapeDrawing':
228
229
  this.refreshShapeDrawing();
229
230
  break;
230
- case 'getSquarePointForRotatedShape':
231
- this.parent.getSquarePointForRotatedShape(args.value['obj'], args.value['object']);
232
- break;
233
231
  case 'getCropToolbar':
234
- args.value['obj']['isCropToolbar'] = this.parent.isCropToolbar;
232
+ args.value['obj']['isCropToolbar'] = parent.isCropToolbar;
235
233
  break;
236
234
  case 'getPrevCurrSelectionPoint':
237
- args.value['obj']['prevCurrSelectionPoint'] = this.parent.prevCurrSelectionPoint;
235
+ args.value['obj']['prevCurrSelectionPoint'] = parent.prevCurrSelectionPoint;
238
236
  break;
239
237
  case 'setPrevCurrSelectionPoint':
240
- this.parent.prevCurrSelectionPoint = args.value['point'];
238
+ parent.prevCurrSelectionPoint = args.value['point'];
241
239
  break;
242
240
  case 'updateCropTransformItems':
243
- this.parent.updateCropTransformItems();
241
+ parent.updateCropTransformItems();
244
242
  break;
245
243
  case 'setEnableDisableUndoRedo':
246
244
  this.preventEnableDisableUr = args.value['isPrevent'];
@@ -253,52 +251,54 @@ var ToolbarModule = /** @class */ (function () {
253
251
  ToolbarModule.prototype.updatePrivateVariables = function () {
254
252
  var parent = this.parent;
255
253
  this.inMemoryCanvas = parent.inMemoryCanvas;
256
- if (!isNullOrUndefined(parent.lowerCanvas)) {
254
+ if (parent.lowerCanvas) {
257
255
  this.lowerContext = parent.lowerCanvas.getContext('2d');
258
256
  }
259
- if (!isNullOrUndefined(parent.upperCanvas)) {
257
+ if (parent.upperCanvas) {
260
258
  this.upperContext = parent.upperCanvas.getContext('2d');
261
259
  }
262
- if (!isNullOrUndefined(this.inMemoryCanvas)) {
260
+ if (this.inMemoryCanvas) {
263
261
  this.inMemoryContext = this.inMemoryCanvas.getContext('2d');
264
262
  }
265
263
  };
266
264
  ToolbarModule.prototype.reset = function () {
265
+ var parent = this.parent;
267
266
  this.defToolbarItems = [];
268
267
  this.toolbarHeight = 46;
269
- this.parent.prevCurrSelectionPoint = null;
268
+ parent.prevCurrSelectionPoint = null;
270
269
  this.zoomBtnHold = null;
271
270
  this.currToolbar = '';
272
271
  this.currentToolbar = 'main';
273
272
  this.selFhdColor = '#42a5f5';
274
- this.parent.currentFilter = '';
275
- this.preventZoomBtn = this.parent.isCropToolbar = this.preventEnableDisableUr = false;
276
- this.parent.initialAdjustmentValue = this.parent.canvasFilter =
273
+ parent.currentFilter = '';
274
+ this.preventZoomBtn = parent.isCropToolbar = this.preventEnableDisableUr = false;
275
+ parent.initialAdjustmentValue = parent.canvasFilter =
277
276
  'brightness(' + 1 + ') ' + 'contrast(' + 100 + '%) ' + 'hue-rotate(' + 0 + 'deg) ' +
278
277
  'saturate(' + 100 + '%) ' + 'opacity(' + 1 + ') ' + 'blur(' + 0 + 'px) ' + 'sepia(0%) ' + 'grayscale(0%) ' + 'invert(0%)';
279
278
  };
280
279
  ToolbarModule.prototype.destroyTopToolbar = function () {
281
280
  var parent = this.parent;
282
- if (this.isToolbar() && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) &&
283
- (!isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar')))) {
281
+ var toolbar = document.getElementById(parent.element.id + '_toolbar');
282
+ if (this.isToolbar() && toolbar && toolbar.classList.contains('e-control')) {
284
283
  getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
285
284
  }
286
285
  };
287
286
  ToolbarModule.prototype.destroyBottomToolbar = function () {
288
287
  var parent = this.parent;
289
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')) &&
290
- (!isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar')))) {
288
+ var toolbar = document.getElementById(parent.element.id + '_bottomToolbar');
289
+ if (toolbar && toolbar.classList.contains('e-control')) {
291
290
  getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
292
291
  }
293
292
  };
294
293
  ToolbarModule.prototype.isToolbar = function () {
295
- return (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.length > 0)
296
- || !isNullOrUndefined(this.parent.toolbarTemplate));
294
+ var parent = this.parent;
295
+ return (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)
296
+ || !isNullOrUndefined(parent.toolbarTemplate));
297
297
  };
298
298
  ToolbarModule.prototype.createToolbar = function () {
299
299
  var _this = this;
300
300
  var parent = this.parent;
301
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
301
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
302
302
  parent.element.appendChild(parent.createElement('div', {
303
303
  id: parent.element.id + '_toolbarArea', className: 'e-toolbar-area'
304
304
  }));
@@ -324,10 +324,10 @@ var ToolbarModule = /** @class */ (function () {
324
324
  if (!parent.disabled) {
325
325
  if (Browser.isDevice) {
326
326
  if (_this.defToolbarItems.length > 0 &&
327
- (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
327
+ document.getElementById(parent.element.id + '_toolbar')) {
328
328
  getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
329
329
  }
330
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar'))) {
330
+ if (document.getElementById(parent.element.id + '_bottomToolbar')) {
331
331
  getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
332
332
  }
333
333
  _this.initMainToolbar(false, Browser.isDevice, null);
@@ -335,7 +335,7 @@ var ToolbarModule = /** @class */ (function () {
335
335
  }
336
336
  else {
337
337
  if (_this.defToolbarItems.length > 0 &&
338
- (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
338
+ document.getElementById(parent.element.id + '_toolbar')) {
339
339
  getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
340
340
  }
341
341
  _this.initMainToolbar(false, false, null);
@@ -352,7 +352,7 @@ var ToolbarModule = /** @class */ (function () {
352
352
  clicked: this.defToolbarClicked.bind(this) });
353
353
  toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
354
354
  this.createLeftToolbarControls();
355
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) {
355
+ if (document.getElementById(parent.element.id + '_toolbar')) {
356
356
  this.toolbarHeight = document.getElementById(parent.element.id + '_toolbar').clientHeight;
357
357
  }
358
358
  }
@@ -362,7 +362,7 @@ var ToolbarModule = /** @class */ (function () {
362
362
  };
363
363
  ToolbarModule.prototype.createContextualToolbar = function () {
364
364
  var parent = this.parent;
365
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
365
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
366
366
  parent.element.appendChild(parent.createElement('div', { id: parent.element.id + '_contextualToolbarArea',
367
367
  className: 'e-contextual-toolbar-wrapper e-hide', attrs: { style: 'position: absolute;' }
368
368
  }));
@@ -373,7 +373,7 @@ var ToolbarModule = /** @class */ (function () {
373
373
  };
374
374
  ToolbarModule.prototype.createBottomToolbar = function () {
375
375
  var parent = this.parent;
376
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
376
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
377
377
  parent.element.appendChild(parent.createElement('div', {
378
378
  id: parent.element.id + '_bottomToolbarArea', className: 'e-bottom-toolbar'
379
379
  }));
@@ -437,7 +437,7 @@ var ToolbarModule = /** @class */ (function () {
437
437
  toolbarObj.appendTo('#' + parent.element.id + '_toolbar');
438
438
  this.createLeftToolbarControls();
439
439
  this.enableDisableTbrBtn();
440
- if (this.isToolbar() && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
440
+ if (this.isToolbar() && document.getElementById(parent.element.id + '_toolbar')) {
441
441
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
442
442
  var toolbar_4 = getComponent(parent.element.id + '_toolbar', 'toolbar');
443
443
  toolbar_4.refreshOverflow();
@@ -447,7 +447,7 @@ var ToolbarModule = /** @class */ (function () {
447
447
  ToolbarModule.prototype.initBottomToolbar = function () {
448
448
  var _this = this;
449
449
  var parent = this.parent;
450
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.length > 0)) {
450
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.length > 0)) {
451
451
  var items = this.getMainToolbarItem();
452
452
  var toolbarObj = new Toolbar({ items: items, width: '100%',
453
453
  created: function () {
@@ -459,7 +459,7 @@ var ToolbarModule = /** @class */ (function () {
459
459
  clicked: this.defToolbarClicked.bind(this)
460
460
  });
461
461
  toolbarObj.appendTo('#' + parent.element.id + '_bottomToolbar');
462
- if (this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')))) {
462
+ if (this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
463
463
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
464
464
  var toolbar_5 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
465
465
  toolbar_5.refreshOverflow();
@@ -474,21 +474,21 @@ var ToolbarModule = /** @class */ (function () {
474
474
  toolbarItems.push({ visible: false, cssClass: 'e-image-position e-btn e-flat', tooltipText: this.l10n.getConstant('Browse'), align: 'Left' });
475
475
  }
476
476
  if (parent.allowUndoRedo) {
477
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Undo') > -1)) {
477
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Undo') > -1)) {
478
478
  toolbarItems.push({ id: parent.element.id + '_undo', prefixIcon: 'e-icons e-undo', cssClass: 'top-icon e-undo',
479
479
  tooltipText: this.l10n.getConstant('Undo'), align: 'Left' });
480
480
  }
481
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Redo') > -1)) {
481
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Redo') > -1)) {
482
482
  toolbarItems.push({ id: parent.element.id + '_redo', prefixIcon: 'e-icons e-redo', cssClass: 'top-icon e-redo',
483
483
  tooltipText: this.l10n.getConstant('Redo'), align: 'Left' });
484
484
  }
485
485
  }
486
486
  if (!this.preventZoomBtn && (parent.zoomSettings.zoomTrigger & ZoomTrigger.Toolbar) === ZoomTrigger.Toolbar) {
487
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('ZoomOut') > -1)) {
487
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomOut') > -1)) {
488
488
  toolbarItems.push({ id: parent.element.id + '_zoomOut', prefixIcon: 'e-icons e-zoom-out', cssClass: 'top-icon e-dec-zoom',
489
489
  tooltipText: this.l10n.getConstant('ZoomOut'), align: 'Left' });
490
490
  }
491
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('ZoomIn') > -1)) {
491
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('ZoomIn') > -1)) {
492
492
  toolbarItems.push({ id: parent.element.id + '_zoomIn', prefixIcon: 'e-icons e-zoom-in', cssClass: 'top-icon e-inc-zoom',
493
493
  tooltipText: this.l10n.getConstant('ZoomIn'), align: 'Left' });
494
494
  }
@@ -508,12 +508,12 @@ var ToolbarModule = /** @class */ (function () {
508
508
  toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
509
509
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
510
510
  }
511
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Reset') > -1)) {
511
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Reset') > -1)) {
512
512
  toolbarItems.push({ id: parent.element.id + '_reset', prefixIcon: 'e-icons e-btn-reset', cssClass: 'top-icon e-img-reset',
513
513
  tooltipText: this.l10n.getConstant('Reset'), align: 'Right' });
514
514
  }
515
515
  if (!isOkBtn) {
516
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Save') > -1)) {
516
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Save') > -1)) {
517
517
  toolbarItems.push({ id: parent.element.id + '_save', prefixIcon: 'e-icons e-btn-save', cssClass: 'top-icon e-save',
518
518
  tooltipText: this.l10n.getConstant('Save'), align: 'Right', template: '<button id="' + parent.element.id + '_saveBtn"></button>' });
519
519
  }
@@ -527,19 +527,19 @@ var ToolbarModule = /** @class */ (function () {
527
527
  ToolbarModule.prototype.getMainToolbarItem = function (isApplyOption) {
528
528
  var parent = this.parent;
529
529
  var toolbarItems = [];
530
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Crop') > -1)) {
530
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Crop') > -1)) {
531
531
  toolbarItems.push({ id: parent.element.id + '_cropTransform', prefixIcon: 'e-icons e-crop', cssClass: 'top-icon e-crop',
532
532
  tooltipText: this.l10n.getConstant('CropAndTransform'), align: 'Center' });
533
533
  }
534
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Annotate') > -1)) {
534
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Annotate') > -1)) {
535
535
  toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
536
- template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
536
+ template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
537
537
  }
538
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Finetune') > -1)) {
538
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Finetune') > -1)) {
539
539
  toolbarItems.push({ id: parent.element.id + '_adjustment', prefixIcon: 'e-icons e-adjustment', cssClass: 'top-icon e-adjustment',
540
540
  tooltipText: this.l10n.getConstant('Finetune'), align: 'Center' });
541
541
  }
542
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Filter') > -1)) {
542
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Filter') > -1)) {
543
543
  toolbarItems.push({ id: parent.element.id + '_filter', prefixIcon: 'e-icons e-filters', cssClass: 'top-icon e-filters',
544
544
  tooltipText: this.l10n.getConstant('Filter'), align: 'Center' });
545
545
  }
@@ -602,7 +602,7 @@ var ToolbarModule = /** @class */ (function () {
602
602
  if (typeof (parent.toolbar[i]) === 'object') {
603
603
  if (isNullOrUndefined(parent.toolbar[i].align)) {
604
604
  if (position === 'left') {
605
- toolbarItems.push(this.parent.toolbar[i]);
605
+ toolbarItems.push(parent.toolbar[i]);
606
606
  }
607
607
  }
608
608
  else if (parent.toolbar[i].align.toLowerCase() === position) {
@@ -628,13 +628,13 @@ var ToolbarModule = /** @class */ (function () {
628
628
  ToolbarModule.prototype.wireZoomBtnEvents = function () {
629
629
  var zoomIn = document.querySelector('#' + this.parent.element.id + '_zoomIn');
630
630
  var zoomOut = document.querySelector('#' + this.parent.element.id + '_zoomOut');
631
- if (!isNullOrUndefined(zoomIn)) {
631
+ if (zoomIn) {
632
632
  zoomIn.addEventListener('mousedown', this.zoomInBtnMouseDownHandler.bind(this));
633
633
  zoomIn.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
634
634
  zoomIn.addEventListener('click', this.zoomInBtnClickHandler.bind(this));
635
635
  zoomIn.addEventListener('touchstart', this.zoomInBtnClickHandler.bind(this));
636
636
  }
637
- if (!isNullOrUndefined(zoomOut)) {
637
+ if (zoomOut) {
638
638
  zoomOut.addEventListener('mousedown', this.zoomOutBtnMouseDownHandler.bind(this));
639
639
  zoomOut.addEventListener('mouseup', this.zoomBtnMouseUpHandler.bind(this));
640
640
  zoomOut.addEventListener('click', this.zoomOutBtnClickHandler.bind(this));
@@ -649,58 +649,58 @@ var ToolbarModule = /** @class */ (function () {
649
649
  var undoRedoObj = { undoRedoStep: null };
650
650
  parent.notify('undo-redo', { prop: 'getUndoRedoStep', value: { obj: undoRedoObj } });
651
651
  var undo = document.querySelector('#' + parent.element.id + '_undo');
652
- if (!isNullOrUndefined(undo) && undoRedoObj['undoRedoStep'] === 0) {
652
+ if (undo && undoRedoObj['undoRedoStep'] === 0) {
653
653
  undo.classList.add('e-disabled');
654
654
  undo.parentElement.classList.add('e-overlay');
655
655
  }
656
- else if (!isNullOrUndefined(undo) && undoRedoObj['undoRedoStep'] > 0) {
656
+ else if (undo && undoRedoObj['undoRedoStep'] > 0) {
657
657
  undo.classList.remove('e-disabled');
658
658
  undo.parentElement.classList.remove('e-overlay');
659
659
  }
660
660
  var redo = document.querySelector('#' + parent.element.id + '_redo');
661
- if (!isNullOrUndefined(redo) && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
661
+ if (redo && (undoRedoObj['undoRedoStep'] === object['appliedUndoRedoColl'].length)) {
662
662
  redo.classList.add('e-disabled');
663
663
  redo.parentElement.classList.add('e-overlay');
664
664
  }
665
- else if (!isNullOrUndefined(redo) && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
665
+ else if (redo && (undoRedoObj['undoRedoStep'] === 0 && object['appliedUndoRedoColl'].length > 0)) {
666
666
  redo.classList.remove('e-disabled');
667
667
  redo.parentElement.classList.remove('e-overlay');
668
668
  }
669
- else if (!isNullOrUndefined(redo) && undoRedoObj['undoRedoStep'] > 0) {
669
+ else if (redo && undoRedoObj['undoRedoStep'] > 0) {
670
670
  redo.classList.remove('e-disabled');
671
671
  redo.parentElement.classList.remove('e-overlay');
672
672
  }
673
673
  }
674
674
  var zoomIn = document.querySelector('#' + parent.element.id + '_zoomIn');
675
- if (!isNullOrUndefined(zoomIn) && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
675
+ if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
676
676
  zoomIn.classList.add('e-disabled');
677
677
  zoomIn.parentElement.classList.add('e-overlay');
678
678
  }
679
- else if (!isNullOrUndefined(zoomIn)) {
679
+ else if (zoomIn) {
680
680
  zoomIn.classList.remove('e-disabled');
681
681
  zoomIn.parentElement.classList.remove('e-overlay');
682
682
  }
683
683
  var zoomOut = document.querySelector('#' + parent.element.id + '_zoomOut');
684
- if (!isNullOrUndefined(zoomOut) && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
684
+ if (zoomOut && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
685
685
  zoomOut.classList.add('e-disabled');
686
686
  zoomOut.parentElement.classList.add('e-overlay');
687
687
  }
688
- else if (!isNullOrUndefined(zoomOut)) {
688
+ else if (zoomOut) {
689
689
  zoomOut.classList.remove('e-disabled');
690
690
  zoomOut.parentElement.classList.remove('e-overlay');
691
691
  }
692
692
  var pan = document.querySelector('#' + parent.element.id + '_pan');
693
- if (!isNullOrUndefined(pan) && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
693
+ if (pan && parent.zoomSettings.zoomFactor <= parent.zoomSettings.minZoomFactor) {
694
694
  pan.style.display = 'none';
695
695
  }
696
- else if (!isNullOrUndefined(pan)) {
696
+ else if (pan) {
697
697
  pan.style.display = 'block';
698
698
  }
699
699
  };
700
700
  ToolbarModule.prototype.createLeftToolbarControls = function () {
701
701
  var parent = this.parent;
702
702
  if (this.defToolbarItems !== undefined && this.defToolbarItems.length > 0 &&
703
- (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
703
+ (document.getElementById(parent.element.id + '_toolbar'))) {
704
704
  var uploadDiv = document.getElementById(parent.element.id + '_toolbar')
705
705
  .querySelector('.e-image-upload');
706
706
  if (uploadDiv) {
@@ -722,25 +722,25 @@ var ToolbarModule = /** @class */ (function () {
722
722
  var _this = this;
723
723
  var parent = this.parent;
724
724
  var items = [];
725
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Pen') > -1)) {
725
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Pen') > -1)) {
726
726
  items.push({ text: this.l10n.getConstant('Pen'), id: 'pen', iconCss: 'e-icons e-free-pen' });
727
727
  }
728
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && parent.toolbar.indexOf('Line') > -1)) {
728
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Line') > -1)) {
729
729
  items.push({ text: this.l10n.getConstant('Line'), id: 'line', iconCss: 'e-icons e-line' });
730
730
  }
731
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Rectangle') > -1)) {
731
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Rectangle') > -1)) {
732
732
  items.push({ text: this.l10n.getConstant('Rectangle'), id: 'rectangle', iconCss: 'e-icons e-rectangle' });
733
733
  }
734
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Ellipse') > -1)) {
734
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Ellipse') > -1)) {
735
735
  items.push({ text: this.l10n.getConstant('Ellipse'), id: 'ellipse', iconCss: 'e-icons e-circle' });
736
736
  }
737
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(toolbar) && parent.toolbar.indexOf('Arrow') > -1)) {
737
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Arrow') > -1)) {
738
738
  items.push({ text: this.l10n.getConstant('Arrow'), id: 'arrow', iconCss: 'e-icons e-arrow-right-up' });
739
739
  }
740
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Path') > -1)) {
740
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Path') > -1)) {
741
741
  items.push({ text: this.l10n.getConstant('Path'), id: 'path', iconCss: 'e-icons e-critical-path' });
742
742
  }
743
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('Text') > -1)) {
743
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Text') > -1)) {
744
744
  items.push({ text: this.l10n.getConstant('Text'), id: 'text', iconCss: 'e-icons e-add-text' });
745
745
  }
746
746
  var obj = { freehandDrawSelectedId: null };
@@ -749,7 +749,7 @@ var ToolbarModule = /** @class */ (function () {
749
749
  var removeElement = document.querySelector('#' + parent.element.id + '_remove');
750
750
  var editTextElement = document.querySelector('#' + parent.element.id + '_editText');
751
751
  if ((parent.activeObj.activePoint.width === 0 && parent.activeObj.activePoint.height === 0) &&
752
- (isNullOrUndefined(parent.activeObj.pointColl) || (!isNullOrUndefined(parent.activeObj.pointColl)
752
+ (isNullOrUndefined(parent.activeObj.pointColl) || (parent.activeObj.pointColl
753
753
  && parent.activeObj.pointColl.length === 0)) &&
754
754
  isNullOrUndefined(obj['freehandDrawSelectedId'])) {
755
755
  if (duplicateElement) {
@@ -781,10 +781,10 @@ var ToolbarModule = /** @class */ (function () {
781
781
  args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
782
782
  args.element.parentElement.offsetHeight + 'px';
783
783
  }
784
- if (!isNullOrUndefined(_this.parent.activeObj.shape)) {
785
- document.getElementById(_this.parent.activeObj.shape).classList.add('e-selected');
784
+ if (parent.activeObj.shape) {
785
+ document.getElementById(parent.activeObj.shape).classList.add('e-selected');
786
786
  }
787
- else if (_this.parent.togglePen) {
787
+ else if (parent.togglePen) {
788
788
  document.getElementById('pen').classList.add('e-selected');
789
789
  }
790
790
  },
@@ -839,22 +839,22 @@ var ToolbarModule = /** @class */ (function () {
839
839
  }
840
840
  });
841
841
  // Render initialized DropDownButton.
842
- drpDownBtn.appendTo('#' + this.parent.element.id + '_annotationBtn');
842
+ drpDownBtn.appendTo('#' + parent.element.id + '_annotationBtn');
843
843
  };
844
844
  ToolbarModule.prototype.renderCropBtn = function () {
845
845
  var _this = this;
846
846
  var parent = this.parent;
847
847
  var items = [];
848
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('CustomSelection') > -1)) {
848
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CustomSelection') > -1)) {
849
849
  items.push({ text: this.l10n.getConstant('Custom'), id: 'custom', iconCss: 'e-icons e-custom' });
850
850
  }
851
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('CircleSelection') > -1)) {
851
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('CircleSelection') > -1)) {
852
852
  items.push({ text: this.l10n.getConstant('Circle'), id: 'circle', iconCss: 'e-icons e-circle' });
853
853
  }
854
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('SquareSelection') > -1)) {
854
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('SquareSelection') > -1)) {
855
855
  items.push({ text: this.l10n.getConstant('Square'), id: 'square', iconCss: 'e-icons e-square' });
856
856
  }
857
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RatioSelection') > -1)) {
857
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RatioSelection') > -1)) {
858
858
  items.push({ text: '3:2', id: '3:2', iconCss: 'e-icons e-custom-a' });
859
859
  items.push({ text: '4:3', id: '4:3', iconCss: 'e-icons e-custom-b' });
860
860
  items.push({ text: '5:4', id: '5:4', iconCss: 'e-icons e-custom-c' });
@@ -863,11 +863,11 @@ var ToolbarModule = /** @class */ (function () {
863
863
  }
864
864
  var iconCss;
865
865
  var shape;
866
- if (!isNullOrUndefined(parent.activeObj.shape)) {
866
+ if (parent.activeObj.shape) {
867
867
  iconCss = this.getCurrentShapeIcon(parent.activeObj.shape);
868
868
  shape = parent.activeObj.shape;
869
869
  }
870
- else if (!isNullOrUndefined(parent.currSelectionPoint)) {
870
+ else if (parent.currSelectionPoint) {
871
871
  iconCss = this.getCurrentShapeIcon(parent.currSelectionPoint.shape);
872
872
  shape = parent.currSelectionPoint.shape;
873
873
  }
@@ -884,8 +884,8 @@ var ToolbarModule = /** @class */ (function () {
884
884
  args.element.parentElement.style.top = drpDownBtn.element.getBoundingClientRect().top -
885
885
  args.element.parentElement.offsetHeight + 'px';
886
886
  }
887
- if (!isNullOrUndefined(_this.parent.activeObj.shape) && _this.parent.activeObj.shape.split('-').length > 1) {
888
- document.getElementById(_this.parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
887
+ if (parent.activeObj.shape && parent.activeObj.shape.split('-').length > 1) {
888
+ document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
889
889
  }
890
890
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
891
891
  },
@@ -898,21 +898,21 @@ var ToolbarModule = /** @class */ (function () {
898
898
  iconCss: 'e-icons ' + iconCss, cssClass: 'e-image-popup',
899
899
  content: parent.toPascalCase(shape.replace('crop-', ''))
900
900
  });
901
- drpDownBtn.appendTo('#' + this.parent.element.id + '_cropBtn');
901
+ drpDownBtn.appendTo('#' + parent.element.id + '_cropBtn');
902
902
  };
903
903
  ToolbarModule.prototype.renderTransformBtn = function () {
904
904
  var parent = this.parent;
905
905
  var items = [];
906
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RotateLeft') > -1)) {
906
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateLeft') > -1)) {
907
907
  items.push({ text: this.l10n.getConstant('RotateLeft'), id: 'rotateleft', iconCss: 'e-icons e-anti-clock-wise' });
908
908
  }
909
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('RotateRight') > -1)) {
909
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('RotateRight') > -1)) {
910
910
  items.push({ text: this.l10n.getConstant('RotateRight'), id: 'rotateright', iconCss: 'e-icons e-clock-wise' });
911
911
  }
912
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
912
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipHorizontal') > -1)) {
913
913
  items.push({ text: this.l10n.getConstant('HorizontalFlip'), id: 'horizontalflip', iconCss: 'e-icons e-horizontal-flip' });
914
914
  }
915
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar) && parent.toolbar.indexOf('FlipVertical') > -1)) {
915
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('FlipVertical') > -1)) {
916
916
  items.push({ text: this.l10n.getConstant('VerticalFlip'), id: 'verticalflip', iconCss: 'e-icons e-vertical-flip' });
917
917
  }
918
918
  var drpDownBtn = new DropDownButton({
@@ -925,27 +925,27 @@ var ToolbarModule = /** @class */ (function () {
925
925
  args.element.parentElement.style.display = 'block';
926
926
  }
927
927
  },
928
- items: items, select: this.parent.transformSelect.bind(this),
928
+ items: items, select: parent.transformSelect.bind(this),
929
929
  iconCss: 'e-icons e-transform', cssClass: 'e-image-popup'
930
930
  });
931
931
  drpDownBtn.appendTo('#' + parent.element.id + '_transformBtn');
932
932
  };
933
933
  ToolbarModule.prototype.renderSaveBtn = function () {
934
- var imageEditorObj = this.parent;
934
+ var parent = this.parent;
935
935
  var saveItems = [
936
936
  { text: 'JPEG', id: 'jpeg' },
937
937
  { text: 'PNG', id: 'png' },
938
938
  { text: 'SVG', id: 'svg' }
939
939
  ];
940
- var ddbElem = document.getElementById(this.parent.element.id + '_saveBtn');
940
+ var ddbElem = document.getElementById(parent.element.id + '_saveBtn');
941
941
  if (ddbElem) {
942
942
  // Initialize the DropDownButton component.
943
943
  var saveDrpDownBtn = new DropDownButton({ items: saveItems, cssClass: 'e-caret-hide e-image-popup', iconCss: 'e-icons e-save',
944
944
  select: function (args) {
945
- imageEditorObj.export(args.item.text);
945
+ parent.export(args.item.text);
946
946
  }
947
947
  });
948
- saveDrpDownBtn.appendTo('#' + this.parent.element.id + '_saveBtn');
948
+ saveDrpDownBtn.appendTo('#' + parent.element.id + '_saveBtn');
949
949
  }
950
950
  };
951
951
  ToolbarModule.prototype.getCropTransformToolbarItem = function () {
@@ -955,19 +955,19 @@ var ToolbarModule = /** @class */ (function () {
955
955
  template: '<button id="' + parent.element.id + '_cropBtn"></button>'
956
956
  });
957
957
  toolbarItems.push({ align: 'Center', type: 'Separator' });
958
- toolbarItems.push({ id: this.parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
958
+ toolbarItems.push({ id: parent.element.id + '_rotateLeft', prefixIcon: 'e-icons e-anti-clock-wise',
959
959
  tooltipText: this.l10n.getConstant('RotateLeft'), align: 'Center' });
960
- toolbarItems.push({ id: this.parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
960
+ toolbarItems.push({ id: parent.element.id + '_rotateRight', prefixIcon: 'e-icons e-clock-wise',
961
961
  tooltipText: this.l10n.getConstant('RotateRight'), align: 'Center' });
962
962
  toolbarItems.push({ align: 'Center', type: 'Separator' });
963
- toolbarItems.push({ id: this.parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
963
+ toolbarItems.push({ id: parent.element.id + '_horizontalFlip', prefixIcon: 'e-icons e-horizontal-flip',
964
964
  tooltipText: this.l10n.getConstant('HorizontalFlip'), align: 'Center' });
965
- toolbarItems.push({ id: this.parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
965
+ toolbarItems.push({ id: parent.element.id + '_verticalFlip', prefixIcon: 'e-icons e-vertical-flip',
966
966
  tooltipText: this.l10n.getConstant('VerticalFlip'), align: 'Center' });
967
967
  if (!Browser.isDevice) {
968
- toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
968
+ toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
969
969
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
970
- toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
970
+ toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
971
971
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
972
972
  }
973
973
  return toolbarItems;
@@ -975,31 +975,31 @@ var ToolbarModule = /** @class */ (function () {
975
975
  ToolbarModule.prototype.getShapesToolbarItem = function (items) {
976
976
  var parent = this.parent;
977
977
  var toolbarItems = [];
978
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
978
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
979
979
  toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
980
- template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
980
+ template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
981
981
  }
982
982
  if (items.indexOf('fillColor') > -1) {
983
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_fillcolor',
983
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_fillcolor',
984
984
  cssClass: 'top-icon e-fill', tooltipText: this.l10n.getConstant('FillColor'), align: 'Center', type: 'Input',
985
- template: '<button id="' + this.parent.element.id + '_fillColorBtn"></button>' });
985
+ template: '<button id="' + parent.element.id + '_fillColorBtn"></button>' });
986
986
  }
987
987
  if (items.indexOf('strokeColor') > -1) {
988
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_strokecolor',
988
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_strokecolor',
989
989
  cssClass: 'top-icon e-stroke', tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
990
- template: '<button id="' + this.parent.element.id + '_borderColorBtn"></button>' });
990
+ template: '<button id="' + parent.element.id + '_borderColorBtn"></button>' });
991
991
  }
992
992
  if (items.indexOf('strokeWidth') > -1) {
993
- toolbarItems.push({ id: this.parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
994
- type: 'Input', template: '<button id="' + this.parent.element.id + '_borderWidthBtn"></button>' });
993
+ toolbarItems.push({ id: parent.element.id + '_strokeWidth', cssClass: 'top-icon e-size', tooltipText: 'Stroke Width', align: 'Center',
994
+ type: 'Input', template: '<button id="' + parent.element.id + '_borderWidthBtn"></button>' });
995
995
  }
996
996
  if (items.indexOf('start') > -1) {
997
- toolbarItems.push({ id: this.parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
998
- type: 'Input', template: '<button id="' + this.parent.element.id + '_startBtn"></button>' });
997
+ toolbarItems.push({ id: parent.element.id + '_start', cssClass: 'top-icon e-size', tooltipText: 'Start', align: 'Center',
998
+ type: 'Input', template: '<button id="' + parent.element.id + '_startBtn"></button>' });
999
999
  }
1000
1000
  if (items.indexOf('end') > -1) {
1001
- toolbarItems.push({ id: this.parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
1002
- type: 'Input', template: '<button id="' + this.parent.element.id + '_endBtn"></button>' });
1001
+ toolbarItems.push({ id: parent.element.id + '_end', cssClass: 'top-icon e-size', tooltipText: 'End', align: 'Center',
1002
+ type: 'Input', template: '<button id="' + parent.element.id + '_endBtn"></button>' });
1003
1003
  }
1004
1004
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1005
1005
  if (items.indexOf('duplicate') > -1) {
@@ -1022,9 +1022,9 @@ var ToolbarModule = /** @class */ (function () {
1022
1022
  var obj = { shape: null };
1023
1023
  parent.notify('selection', { prop: 'getCurrentDrawingShape', value: { obj: obj } });
1024
1024
  if (obj['shape'] !== 'path') {
1025
- toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1025
+ toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1026
1026
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1027
- toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1027
+ toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1028
1028
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1029
1029
  }
1030
1030
  }
@@ -1032,6 +1032,7 @@ var ToolbarModule = /** @class */ (function () {
1032
1032
  };
1033
1033
  ToolbarModule.prototype.initCropTransformToolbar = function () {
1034
1034
  var _this = this;
1035
+ var parent = this.parent;
1035
1036
  var leftItem = this.getLeftToolbarItem();
1036
1037
  var rightItem = this.getRightToolbarItem();
1037
1038
  var mainItem = this.getCropTransformToolbarItem();
@@ -1052,9 +1053,9 @@ var ToolbarModule = /** @class */ (function () {
1052
1053
  if (!Browser.isDevice) {
1053
1054
  _this.renderSaveBtn();
1054
1055
  }
1055
- _this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1056
+ parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1056
1057
  if (Browser.isDevice) {
1057
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
1058
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
1058
1059
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1059
1060
  toolbar.refreshOverflow();
1060
1061
  toolbar.refreshOverflow();
@@ -1063,22 +1064,22 @@ var ToolbarModule = /** @class */ (function () {
1063
1064
  }
1064
1065
  else {
1065
1066
  _this.createLeftToolbarControls();
1066
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
1067
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1067
1068
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1068
1069
  toolbar.refreshOverflow();
1069
1070
  }
1070
1071
  }
1071
- _this.parent.select('custom');
1072
+ parent.select('custom');
1072
1073
  }
1073
1074
  });
1074
1075
  if (Browser.isDevice) {
1075
- toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
1076
+ toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
1076
1077
  }
1077
1078
  else {
1078
- toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
1079
+ toolbar.appendTo('#' + parent.element.id + '_toolbar');
1079
1080
  }
1080
1081
  this.enableDisableTbrBtn();
1081
- this.parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1082
+ parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
1082
1083
  };
1083
1084
  ToolbarModule.prototype.getCurrentShapeIcon = function (shape) {
1084
1085
  var icon = '';
@@ -1089,9 +1090,6 @@ var ToolbarModule = /** @class */ (function () {
1089
1090
  case 'ellipse':
1090
1091
  icon = 'e-circle';
1091
1092
  break;
1092
- case 'triangle':
1093
- icon = 'e-triangle';
1094
- break;
1095
1093
  case 'line':
1096
1094
  icon = 'e-line';
1097
1095
  break;
@@ -1139,6 +1137,7 @@ var ToolbarModule = /** @class */ (function () {
1139
1137
  };
1140
1138
  ToolbarModule.prototype.initShapesToolbarItem = function (items) {
1141
1139
  var _this = this;
1140
+ var parent = this.parent;
1142
1141
  var leftItem = this.getLeftToolbarItem();
1143
1142
  var rightItem = this.getRightToolbarItem();
1144
1143
  var mainItem = this.getShapesToolbarItem(items);
@@ -1157,7 +1156,7 @@ var ToolbarModule = /** @class */ (function () {
1157
1156
  _this.renderAnnotationBtn(true);
1158
1157
  _this.createShapeColor(items);
1159
1158
  _this.createShapeBtn(items);
1160
- if (_this.parent.activeObj.shape === 'arrow') {
1159
+ if (parent.activeObj.shape === 'arrow') {
1161
1160
  _this.createStartBtn();
1162
1161
  _this.createEndBtn();
1163
1162
  }
@@ -1165,9 +1164,9 @@ var ToolbarModule = /** @class */ (function () {
1165
1164
  if (!Browser.isDevice) {
1166
1165
  _this.renderSaveBtn();
1167
1166
  }
1168
- _this.parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1167
+ parent.trigger('toolbarCreated', { toolbarType: 'shapes' });
1169
1168
  if (Browser.isDevice) {
1170
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar')))) {
1169
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
1171
1170
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1172
1171
  toolbar.refreshOverflow();
1173
1172
  toolbar.refreshOverflow();
@@ -1176,7 +1175,7 @@ var ToolbarModule = /** @class */ (function () {
1176
1175
  }
1177
1176
  else {
1178
1177
  _this.createLeftToolbarControls();
1179
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
1178
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1180
1179
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1181
1180
  toolbar.refreshOverflow();
1182
1181
  }
@@ -1184,15 +1183,14 @@ var ToolbarModule = /** @class */ (function () {
1184
1183
  }
1185
1184
  });
1186
1185
  if (Browser.isDevice) {
1187
- toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
1186
+ toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
1188
1187
  }
1189
1188
  else {
1190
- toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
1189
+ toolbar.appendTo('#' + parent.element.id + '_toolbar');
1191
1190
  }
1192
1191
  this.enableDisableTbrBtn();
1193
1192
  };
1194
1193
  ToolbarModule.prototype.createShapeColor = function (items) {
1195
- var _this = this;
1196
1194
  var parent = this.parent;
1197
1195
  if (items.indexOf('fillColor') > -1) {
1198
1196
  parent.element.querySelector('.e-template.e-fill').appendChild(parent.createElement('input', {
@@ -1202,7 +1200,7 @@ var ToolbarModule = /** @class */ (function () {
1202
1200
  modeSwitcher: false, noColor: true, value: '',
1203
1201
  showButtons: false, mode: 'Palette', cssClass: 'e-shape-fill-color',
1204
1202
  change: function (args) {
1205
- _this.parent.updateFillColor(args.currentValue.hex);
1203
+ parent.updateFillColor(args.currentValue.hex);
1206
1204
  if (args.currentValue.rgba === '') {
1207
1205
  fillDDB_1.element.children[0].classList.add('e-nocolor-item');
1208
1206
  }
@@ -1223,7 +1221,7 @@ var ToolbarModule = /** @class */ (function () {
1223
1221
  },
1224
1222
  target: '.e-shape-fill-color',
1225
1223
  iconCss: 'e-dropdownbtn-preview'
1226
- }, '#' + this.parent.element.id + '_fillColorBtn');
1224
+ }, '#' + parent.element.id + '_fillColorBtn');
1227
1225
  fillColor.inline = true;
1228
1226
  parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview').classList.add('e-nocolor-item');
1229
1227
  }
@@ -1235,7 +1233,7 @@ var ToolbarModule = /** @class */ (function () {
1235
1233
  modeSwitcher: false, noColor: false, value: '#fff',
1236
1234
  showButtons: false, mode: 'Palette', cssClass: 'e-shape-stroke-color',
1237
1235
  change: function (args) {
1238
- _this.parent.updateStrokeColor(args.currentValue.hex);
1236
+ parent.updateStrokeColor(args.currentValue.hex);
1239
1237
  strokeDDB_1.element.children[0].style.backgroundColor = args.currentValue.rgba;
1240
1238
  strokeDDB_1.toggle();
1241
1239
  }
@@ -1245,7 +1243,7 @@ var ToolbarModule = /** @class */ (function () {
1245
1243
  if (Browser.isDevice) {
1246
1244
  args.element.parentElement.style.top = strokeDDB_1.element.getBoundingClientRect().top -
1247
1245
  args.element.parentElement.offsetHeight + 'px';
1248
- args.element.parentElement.style.left = _this.parent.element.offsetLeft + 'px';
1246
+ args.element.parentElement.style.left = parent.element.offsetLeft + 'px';
1249
1247
  }
1250
1248
  },
1251
1249
  target: '.e-shape-stroke-color',
@@ -1256,7 +1254,6 @@ var ToolbarModule = /** @class */ (function () {
1256
1254
  }
1257
1255
  };
1258
1256
  ToolbarModule.prototype.createShapeBtn = function (items) {
1259
- var _this = this;
1260
1257
  var parent = this.parent;
1261
1258
  var strokeWidthItems = [
1262
1259
  { id: '1', text: this.l10n.getConstant('XSmall') },
@@ -1285,18 +1282,18 @@ var ToolbarModule = /** @class */ (function () {
1285
1282
  },
1286
1283
  select: function (args) {
1287
1284
  spanElem_1.textContent = args.item.text;
1288
- _this.parent.updateStrokeWidth(args.item.id);
1285
+ parent.updateStrokeWidth(args.item.id);
1289
1286
  if (Browser.isDevice) {
1290
- if (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_bottomToolbar'))) {
1287
+ if (document.getElementById(parent.element.id + '_bottomToolbar')) {
1291
1288
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1292
- var toolbar_6 = getComponent(_this.parent.element.id + '_bottomToolbar', 'toolbar');
1289
+ var toolbar_6 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
1293
1290
  toolbar_6.refreshOverflow();
1294
1291
  }
1295
1292
  }
1296
1293
  else {
1297
- if (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar'))) {
1294
+ if (document.getElementById(parent.element.id + '_toolbar')) {
1298
1295
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1299
- var toolbar_7 = getComponent(_this.parent.element.id + '_toolbar', 'toolbar');
1296
+ var toolbar_7 = getComponent(parent.element.id + '_toolbar', 'toolbar');
1300
1297
  toolbar_7.refreshOverflow();
1301
1298
  }
1302
1299
  }
@@ -1320,10 +1317,10 @@ var ToolbarModule = /** @class */ (function () {
1320
1317
  ];
1321
1318
  var strokeWidthBtn = document.getElementById(parent.element.id + '_startBtn');
1322
1319
  var spanElem = document.createElement('span');
1323
- if (isNullOrUndefined(this.parent.activeObj.start)) {
1324
- this.parent.activeObj.start = 'none';
1320
+ if (isNullOrUndefined(parent.activeObj.start)) {
1321
+ parent.activeObj.start = 'none';
1325
1322
  }
1326
- spanElem.innerHTML = this.parent.pascalToSplitWords(this.parent.activeObj.start);
1323
+ spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.start);
1327
1324
  spanElem.className = 'e-shape-start';
1328
1325
  strokeWidthBtn.appendChild(spanElem);
1329
1326
  // Initialize the DropDownButton component.
@@ -1360,10 +1357,10 @@ var ToolbarModule = /** @class */ (function () {
1360
1357
  ];
1361
1358
  var strokeEndBtn = document.getElementById(parent.element.id + '_endBtn');
1362
1359
  var spanElem = document.createElement('span');
1363
- if (isNullOrUndefined(this.parent.activeObj.end)) {
1364
- this.parent.activeObj.end = 'arrowSolid';
1360
+ if (isNullOrUndefined(parent.activeObj.end)) {
1361
+ parent.activeObj.end = 'arrowSolid';
1365
1362
  }
1366
- spanElem.innerHTML = this.parent.pascalToSplitWords(this.parent.activeObj.end);
1363
+ spanElem.innerHTML = parent.pascalToSplitWords(parent.activeObj.end);
1367
1364
  spanElem.className = 'e-shape-end';
1368
1365
  strokeEndBtn.appendChild(spanElem);
1369
1366
  // Initialize the DropDownButton component.
@@ -1389,9 +1386,9 @@ var ToolbarModule = /** @class */ (function () {
1389
1386
  ToolbarModule.prototype.getTextToolbarItem = function (items) {
1390
1387
  var parent = this.parent;
1391
1388
  var toolbarItems = [];
1392
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
1389
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar)) {
1393
1390
  toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1394
- template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
1391
+ template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
1395
1392
  }
1396
1393
  if (items.indexOf('fontFamily') > -1) {
1397
1394
  toolbarItems.push({ id: parent.element.id + '_fontFamily', cssClass: 'top-icon e-img-font-family',
@@ -1476,7 +1473,7 @@ var ToolbarModule = /** @class */ (function () {
1476
1473
  }
1477
1474
  parent.trigger('toolbarCreated', { toolbarType: 'text' });
1478
1475
  if (Browser.isDevice) {
1479
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar')))) {
1476
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_bottomToolbar')) {
1480
1477
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1481
1478
  toolbar.refreshOverflow();
1482
1479
  toolbar.refreshOverflow();
@@ -1485,7 +1482,7 @@ var ToolbarModule = /** @class */ (function () {
1485
1482
  }
1486
1483
  else {
1487
1484
  _this.createLeftToolbarControls();
1488
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
1485
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1489
1486
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1490
1487
  toolbar.refreshOverflow();
1491
1488
  }
@@ -1501,9 +1498,8 @@ var ToolbarModule = /** @class */ (function () {
1501
1498
  this.enableDisableTbrBtn();
1502
1499
  };
1503
1500
  ToolbarModule.prototype.createTextColor = function (items) {
1504
- var _this = this;
1505
1501
  var parent = this.parent;
1506
- if (items.indexOf('fontColor') > -1 && !isNullOrUndefined(parent.element.querySelector('.e-template.e-text-font-color'))) {
1502
+ if (items.indexOf('fontColor') > -1 && parent.element.querySelector('.e-template.e-text-font-color')) {
1507
1503
  parent.element.querySelector('.e-template.e-text-font-color').appendChild(parent.createElement('input', {
1508
1504
  id: parent.element.id + '_text_font'
1509
1505
  }));
@@ -1511,7 +1507,7 @@ var ToolbarModule = /** @class */ (function () {
1511
1507
  modeSwitcher: false, value: '#fff',
1512
1508
  showButtons: false, mode: 'Palette', cssClass: 'e-text-fontt-color',
1513
1509
  change: function (args) {
1514
- _this.parent.updateFontColor(args.currentValue.hex);
1510
+ parent.updateFontColor(args.currentValue.hex);
1515
1511
  strokeDDB_2.element.children[0].style.backgroundColor = args.currentValue.rgba;
1516
1512
  strokeDDB_2.toggle();
1517
1513
  }
@@ -1545,7 +1541,7 @@ var ToolbarModule = /** @class */ (function () {
1545
1541
  spanElem_2.innerHTML = 'Arial';
1546
1542
  }
1547
1543
  spanElem_2.className = 'e-text-font-family';
1548
- if (!isNullOrUndefined(fontNameBtn)) {
1544
+ if (fontNameBtn) {
1549
1545
  fontNameBtn.appendChild(spanElem_2);
1550
1546
  }
1551
1547
  var fontFamilyBtn_1 = new DropDownButton({ items: this.getFontFamilyItems(),
@@ -1606,24 +1602,25 @@ var ToolbarModule = /** @class */ (function () {
1606
1602
  }
1607
1603
  };
1608
1604
  ToolbarModule.prototype.refreshToolbar = function (type, isApplyBtn, isCropping, isZooming, cType) {
1609
- if (!this.parent.isImageLoaded || this.parent.isCropToolbar) {
1605
+ var parent = this.parent;
1606
+ if (!parent.isImageLoaded || parent.isCropToolbar) {
1610
1607
  return;
1611
1608
  }
1612
1609
  var args = { toolbarType: type };
1613
1610
  if (type !== 'filter' && type !== 'color') {
1614
- if (document.getElementById(this.parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
1615
- getComponent(document.getElementById(this.parent.element.id + '_toolbar'), 'toolbar').destroy();
1616
- document.getElementById(this.parent.element.id + '_toolbar').innerHTML = '';
1611
+ if (document.getElementById(parent.element.id + '_toolbar') && this.defToolbarItems.length > 0) {
1612
+ getComponent(document.getElementById(parent.element.id + '_toolbar'), 'toolbar').destroy();
1613
+ document.getElementById(parent.element.id + '_toolbar').innerHTML = '';
1617
1614
  }
1618
- if (document.getElementById(this.parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
1619
- if (document.getElementById(this.parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
1620
- getComponent(document.getElementById(this.parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
1621
- document.getElementById(this.parent.element.id + '_bottomToolbar').innerHTML = '';
1615
+ if (document.getElementById(parent.element.id + '_bottomToolbar') && this.defToolbarItems.length > 0) {
1616
+ if (document.getElementById(parent.element.id + '_bottomToolbar').className.indexOf('e-control') > -1) {
1617
+ getComponent(document.getElementById(parent.element.id + '_bottomToolbar'), 'toolbar').destroy();
1618
+ document.getElementById(parent.element.id + '_bottomToolbar').innerHTML = '';
1622
1619
  }
1623
1620
  }
1624
1621
  }
1625
1622
  this.refreshSlider();
1626
- this.parent.isCropTab = false;
1623
+ parent.isCropTab = false;
1627
1624
  switch (type) {
1628
1625
  case 'main':
1629
1626
  if (Browser.isDevice) {
@@ -1650,16 +1647,16 @@ var ToolbarModule = /** @class */ (function () {
1650
1647
  if (Browser.isDevice) {
1651
1648
  this.initMainToolbar(false, true, true);
1652
1649
  }
1653
- if (this.parent.activeObj.shape === 'line' || this.parent.activeObj.shape === 'path') {
1650
+ if (parent.activeObj.shape === 'line' || parent.activeObj.shape === 'path') {
1654
1651
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'duplicate', 'remove'];
1655
1652
  }
1656
- else if (this.parent.activeObj.shape === 'arrow') {
1653
+ else if (parent.activeObj.shape === 'arrow') {
1657
1654
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'start', 'end', 'duplicate', 'remove'];
1658
1655
  }
1659
1656
  else {
1660
1657
  args.toolbarItems = ['fillColor', 'strokeColor', 'strokeWidth', 'duplicate', 'remove'];
1661
1658
  }
1662
- this.parent.trigger('toolbarUpdating', args);
1659
+ parent.trigger('toolbarUpdating', args);
1663
1660
  this.initShapesToolbarItem(args.toolbarItems);
1664
1661
  break;
1665
1662
  case 'text':
@@ -1667,7 +1664,7 @@ var ToolbarModule = /** @class */ (function () {
1667
1664
  this.initMainToolbar(false, true, true);
1668
1665
  }
1669
1666
  args.toolbarItems = ['fontFamily', 'fontSize', 'fontColor', 'bold', 'italic', 'duplicate', 'remove', 'text'];
1670
- this.parent.trigger('toolbarUpdating', args);
1667
+ parent.trigger('toolbarUpdating', args);
1671
1668
  this.initTextToolbarItem(args.toolbarItems);
1672
1669
  break;
1673
1670
  case 'pen':
@@ -1675,7 +1672,7 @@ var ToolbarModule = /** @class */ (function () {
1675
1672
  this.initMainToolbar(false, true, true);
1676
1673
  }
1677
1674
  args.toolbarItems = ['strokeColor', 'strokeWidth', 'remove'];
1678
- this.parent.trigger('toolbarUpdating', args);
1675
+ parent.trigger('toolbarUpdating', args);
1679
1676
  this.initPenToolbarItem(args.toolbarItems);
1680
1677
  break;
1681
1678
  case 'adjustment':
@@ -1691,11 +1688,11 @@ var ToolbarModule = /** @class */ (function () {
1691
1688
  this.updateContextualToolbar(type, cType);
1692
1689
  break;
1693
1690
  case 'croptransform':
1694
- this.parent.isCropTab = true;
1691
+ parent.isCropTab = true;
1695
1692
  if (Browser.isDevice) {
1696
1693
  this.initMainToolbar(false, true, true);
1697
1694
  }
1698
- this.parent.updateCropTransformItems();
1695
+ parent.updateCropTransformItems();
1699
1696
  this.initCropTransformToolbar();
1700
1697
  break;
1701
1698
  }
@@ -1704,32 +1701,33 @@ var ToolbarModule = /** @class */ (function () {
1704
1701
  };
1705
1702
  ToolbarModule.prototype.getAdjustmentToolbarItem = function () {
1706
1703
  var toolbarItems = [];
1707
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Brightness') > -1)) {
1708
- toolbarItems.push({ id: this.parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
1704
+ var parent = this.parent;
1705
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Brightness') > -1)) {
1706
+ toolbarItems.push({ id: parent.element.id + '_brightness', prefixIcon: 'e-icons e-brightness', cssClass: 'top-icon e-brightness',
1709
1707
  tooltipText: this.l10n.getConstant('Brightness'), align: 'Center' });
1710
1708
  }
1711
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Contrast') > -1)) {
1712
- toolbarItems.push({ id: this.parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
1709
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Contrast') > -1)) {
1710
+ toolbarItems.push({ id: parent.element.id + '_contrast', prefixIcon: 'e-icons e-contrast', cssClass: 'top-icon e-contrast',
1713
1711
  tooltipText: this.l10n.getConstant('Contrast'), align: 'Center' });
1714
1712
  }
1715
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Hue') > -1)) {
1716
- toolbarItems.push({ id: this.parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
1713
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Hue') > -1)) {
1714
+ toolbarItems.push({ id: parent.element.id + '_hue', prefixIcon: 'e-icons e-fade', cssClass: 'top-icon e-fade',
1717
1715
  tooltipText: this.l10n.getConstant('Hue'), align: 'Center' });
1718
1716
  }
1719
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Saturation') > -1)) {
1720
- toolbarItems.push({ id: this.parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
1717
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Saturation') > -1)) {
1718
+ toolbarItems.push({ id: parent.element.id + '_saturation', prefixIcon: 'e-icons e-saturation', cssClass: 'top-icon e-saturation',
1721
1719
  tooltipText: this.l10n.getConstant('Saturation'), align: 'Center' });
1722
1720
  }
1723
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Exposure') > -1)) {
1724
- toolbarItems.push({ id: this.parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
1721
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Exposure') > -1)) {
1722
+ toolbarItems.push({ id: parent.element.id + '_exposure', prefixIcon: 'e-icons e-grain', cssClass: 'top-icon e-grain',
1725
1723
  tooltipText: this.l10n.getConstant('Exposure'), align: 'Center' });
1726
1724
  }
1727
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Opacity') > -1)) {
1728
- toolbarItems.push({ id: this.parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
1725
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Opacity') > -1)) {
1726
+ toolbarItems.push({ id: parent.element.id + '_opacity', prefixIcon: 'e-icons e-opacity', cssClass: 'top-icon e-opacity',
1729
1727
  tooltipText: this.l10n.getConstant('Opacity'), align: 'Center' });
1730
1728
  }
1731
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Blur') > -1)) {
1732
- toolbarItems.push({ id: this.parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
1729
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Blur') > -1)) {
1730
+ toolbarItems.push({ id: parent.element.id + '_blur', prefixIcon: 'e-icons e-tint', cssClass: 'top-icon e-tint',
1733
1731
  tooltipText: this.l10n.getConstant('Blur'), align: 'Center' });
1734
1732
  }
1735
1733
  var tempToolbarItems = this.processToolbar('center');
@@ -1737,49 +1735,50 @@ var ToolbarModule = /** @class */ (function () {
1737
1735
  toolbarItems.push(tempToolbarItems[i]);
1738
1736
  }
1739
1737
  if (!Browser.isDevice) {
1740
- toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1738
+ toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1741
1739
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1742
- toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1740
+ toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1743
1741
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1744
1742
  }
1745
1743
  return toolbarItems;
1746
1744
  };
1747
1745
  ToolbarModule.prototype.getFilterToolbarItem = function () {
1748
1746
  var toolbarItems = [];
1749
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Default') > -1)) {
1750
- toolbarItems.push({ id: this.parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1747
+ var parent = this.parent;
1748
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Default') > -1)) {
1749
+ toolbarItems.push({ id: parent.element.id + '_default', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1751
1750
  tooltipText: this.l10n.getConstant('Default'), align: 'Center',
1752
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
1751
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_defaultCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Default') + '</span></div></div>' });
1753
1752
  }
1754
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Chrome') > -1)) {
1755
- toolbarItems.push({ id: this.parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1753
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Chrome') > -1)) {
1754
+ toolbarItems.push({ id: parent.element.id + '_chrome', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1756
1755
  tooltipText: this.l10n.getConstant('Chrome'), align: 'Center',
1757
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
1756
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_chromeCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Chrome') + '</span></div></div>' });
1758
1757
  }
1759
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Cold') > -1)) {
1760
- toolbarItems.push({ id: this.parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1758
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Cold') > -1)) {
1759
+ toolbarItems.push({ id: parent.element.id + '_cold', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1761
1760
  tooltipText: this.l10n.getConstant('Cold'), align: 'Center',
1762
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
1761
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_coldCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Cold') + '</span></div></div>' });
1763
1762
  }
1764
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Warm') > -1)) {
1765
- toolbarItems.push({ id: this.parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1763
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Warm') > -1)) {
1764
+ toolbarItems.push({ id: parent.element.id + '_warm', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1766
1765
  tooltipText: this.l10n.getConstant('Warm'), align: 'Center',
1767
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
1766
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_warmCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Warm') + '</span></div></div>' });
1768
1767
  }
1769
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Grayscale') > -1)) {
1770
- toolbarItems.push({ id: this.parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1768
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Grayscale') > -1)) {
1769
+ toolbarItems.push({ id: parent.element.id + '_grayscale', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1771
1770
  tooltipText: this.l10n.getConstant('Grayscale'), align: 'Center',
1772
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
1771
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_grayscaleCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Grayscale') + '</span></div></div>' });
1773
1772
  }
1774
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Sepia') > -1)) {
1775
- toolbarItems.push({ id: this.parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1773
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Sepia') > -1)) {
1774
+ toolbarItems.push({ id: parent.element.id + '_sepia', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1776
1775
  tooltipText: this.l10n.getConstant('Sepia'), align: 'Center',
1777
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
1776
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_sepiaCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Sepia') + '</span></div></div>' });
1778
1777
  }
1779
- if (isNullOrUndefined(this.parent.toolbar) || (!isNullOrUndefined(this.parent.toolbar) && this.parent.toolbar.indexOf('Invert') > -1)) {
1780
- toolbarItems.push({ id: this.parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1778
+ if (isNullOrUndefined(parent.toolbar) || (parent.toolbar && parent.toolbar.indexOf('Invert') > -1)) {
1779
+ toolbarItems.push({ id: parent.element.id + '_invert', prefixIcon: 'e-icons e-none', cssClass: 'top-icon e-none',
1781
1780
  tooltipText: this.l10n.getConstant('Invert'), align: 'Center',
1782
- template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + this.parent.element.id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
1781
+ template: '<div class="filter-wrapper" style="box-sizing: content-box;"><canvas id=' + parent.element.id + '_invertCanvas' + '></canvas><div style="text-align:center;"><span>' + this.l10n.getConstant('Invert') + '</span></div></div>' });
1783
1782
  }
1784
1783
  var tempToolbarItems = this.processToolbar('center');
1785
1784
  for (var i = 0, len = tempToolbarItems.length; i < len; i++) {
@@ -1790,20 +1789,20 @@ var ToolbarModule = /** @class */ (function () {
1790
1789
  ToolbarModule.prototype.getPenToolbarItem = function (items) {
1791
1790
  var parent = this.parent;
1792
1791
  var toolbarItems = [];
1793
- if (isNullOrUndefined(parent.toolbar) || (!isNullOrUndefined(parent.toolbar))) {
1792
+ if (isNullOrUndefined(parent.toolbar) || parent.toolbar) {
1794
1793
  toolbarItems.push({ id: parent.element.id + '_annotation', tooltipText: this.l10n.getConstant('Annotation'), align: 'Center',
1795
- template: '<button id="' + this.parent.element.id + '_annotationBtn"></button>' });
1794
+ template: '<button id="' + parent.element.id + '_annotationBtn"></button>' });
1796
1795
  }
1797
1796
  if (items.indexOf('strokeColor') > -1) {
1798
- toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: this.parent.element.id + '_pen_strokecolor',
1797
+ toolbarItems.push({ prefixIcon: 'e-icons e-copy', id: parent.element.id + '_pen_strokecolor',
1799
1798
  cssClass: 'top-icon e-pen-stroke-color',
1800
1799
  tooltipText: this.l10n.getConstant('StrokeColor'), align: 'Center', type: 'Input',
1801
- template: '<button id="' + this.parent.element.id + '_penColorBtn"></button>' });
1800
+ template: '<button id="' + parent.element.id + '_penColorBtn"></button>' });
1802
1801
  }
1803
1802
  if (items.indexOf('strokeWidth') > -1) {
1804
1803
  toolbarItems.push({ prefixIcon: 'e-icons e-copy', cssClass: 'top-icon e-size',
1805
1804
  tooltipText: this.l10n.getConstant('StrokeWidth'),
1806
- align: 'Center', type: 'Input', template: '<button id="' + this.parent.element.id + '_penStrokeWidth"></button>' });
1805
+ align: 'Center', type: 'Input', template: '<button id="' + parent.element.id + '_penStrokeWidth"></button>' });
1807
1806
  }
1808
1807
  toolbarItems.push({ align: 'Center', type: 'Separator' });
1809
1808
  if (items.indexOf('remove') > -1) {
@@ -1815,15 +1814,16 @@ var ToolbarModule = /** @class */ (function () {
1815
1814
  toolbarItems.push(tempToolbarItems[i]);
1816
1815
  }
1817
1816
  if (!Browser.isDevice) {
1818
- toolbarItems.push({ id: this.parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1817
+ toolbarItems.push({ id: parent.element.id + '_ok', prefixIcon: 'e-icons e-check', cssClass: 'top-icon e-tick',
1819
1818
  tooltipText: this.l10n.getConstant('OK'), align: 'Right' });
1820
- toolbarItems.push({ id: this.parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1819
+ toolbarItems.push({ id: parent.element.id + '_cancel', prefixIcon: 'e-icons e-close', cssClass: 'top-icon e-save',
1821
1820
  tooltipText: this.l10n.getConstant('Cancel'), align: 'Right' });
1822
1821
  }
1823
1822
  return toolbarItems;
1824
1823
  };
1825
1824
  ToolbarModule.prototype.initPenToolbarItem = function (items) {
1826
1825
  var _this = this;
1826
+ var parent = this.parent;
1827
1827
  var leftItem = this.getLeftToolbarItem();
1828
1828
  var rightItem = this.getRightToolbarItem();
1829
1829
  var mainItem = this.getPenToolbarItem(items);
@@ -1846,9 +1846,9 @@ var ToolbarModule = /** @class */ (function () {
1846
1846
  if (!Browser.isDevice) {
1847
1847
  _this.renderSaveBtn();
1848
1848
  }
1849
- _this.parent.trigger('toolbarCreated', { toolbarType: 'pen' });
1849
+ parent.trigger('toolbarCreated', { toolbarType: 'pen' });
1850
1850
  if (Browser.isDevice) {
1851
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
1851
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1852
1852
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1853
1853
  toolbar.refreshOverflow();
1854
1854
  toolbar.refreshOverflow();
@@ -1856,7 +1856,7 @@ var ToolbarModule = /** @class */ (function () {
1856
1856
  }
1857
1857
  else {
1858
1858
  _this.createLeftToolbarControls();
1859
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(_this.parent.element.id + '_toolbar')))) {
1859
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
1860
1860
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1861
1861
  toolbar.refreshOverflow();
1862
1862
  }
@@ -1864,18 +1864,16 @@ var ToolbarModule = /** @class */ (function () {
1864
1864
  }
1865
1865
  });
1866
1866
  if (Browser.isDevice) {
1867
- toolbar.appendTo('#' + this.parent.element.id + '_bottomToolbar');
1867
+ toolbar.appendTo('#' + parent.element.id + '_bottomToolbar');
1868
1868
  }
1869
1869
  else {
1870
- toolbar.appendTo('#' + this.parent.element.id + '_toolbar');
1870
+ toolbar.appendTo('#' + parent.element.id + '_toolbar');
1871
1871
  }
1872
1872
  this.enableDisableTbrBtn();
1873
1873
  };
1874
1874
  ToolbarModule.prototype.createPenColor = function (items) {
1875
1875
  var _this = this;
1876
1876
  var parent = this.parent;
1877
- // eslint-disable-next-line @typescript-eslint/no-this-alias
1878
- var proxy = this;
1879
1877
  if (items.indexOf('strokeColor') > -1) {
1880
1878
  parent.element.querySelector('.e-template.e-pen-stroke-color').appendChild(parent.createElement('input', {
1881
1879
  id: parent.element.id + '_pen_stroke'
@@ -1884,7 +1882,7 @@ var ToolbarModule = /** @class */ (function () {
1884
1882
  modeSwitcher: false, value: '#fff',
1885
1883
  showButtons: false, mode: 'Palette', cssClass: 'e-pen-color',
1886
1884
  change: function (args) {
1887
- _this.parent.updatePenStrokeColor(args.currentValue.hex);
1885
+ parent.updatePenStrokeColor(args.currentValue.hex);
1888
1886
  _this.selFhdColor = args.currentValue.hex;
1889
1887
  strokeDDB_3.element.children[0].style.backgroundColor = args.currentValue.rgba;
1890
1888
  strokeDDB_3.toggle();
@@ -1907,7 +1905,7 @@ var ToolbarModule = /** @class */ (function () {
1907
1905
  var indexObj = { freehandSelectedIndex: null };
1908
1906
  parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
1909
1907
  if (!isNullOrUndefined(indexObj['freehandSelectedIndex']) && indexObj['freehandSelectedIndex'] > -1) {
1910
- this.parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
1908
+ parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview').style.background
1911
1909
  = this.selFhdColor === '#42a5f5' ? obj['tempFreeHandDrawEditingStyles'].strokeColor :
1912
1910
  parent.pointColl[indexObj['freehandSelectedIndex']].strokeColor;
1913
1911
  }
@@ -1918,7 +1916,6 @@ var ToolbarModule = /** @class */ (function () {
1918
1916
  }
1919
1917
  };
1920
1918
  ToolbarModule.prototype.createPenBtn = function (items) {
1921
- var _this = this;
1922
1919
  var parent = this.parent;
1923
1920
  var strokeWidthItems = [
1924
1921
  { id: '1', text: this.l10n.getConstant('XSmall') },
@@ -1941,7 +1938,6 @@ var ToolbarModule = /** @class */ (function () {
1941
1938
  spanElem_3.className = 'e-pen-stroke-width';
1942
1939
  strokeWidthBtn.appendChild(spanElem_3);
1943
1940
  // eslint-disable-next-line @typescript-eslint/no-this-alias
1944
- var proxy = this;
1945
1941
  var drpDownBtn_2 = new DropDownButton({ items: strokeWidthItems,
1946
1942
  open: function (args) {
1947
1943
  if (Browser.isDevice) {
@@ -1953,16 +1949,16 @@ var ToolbarModule = /** @class */ (function () {
1953
1949
  },
1954
1950
  select: function (args) {
1955
1951
  spanElem_3.textContent = args.item.text;
1956
- _this.parent.updatePenStrokeWidth(args.item.id);
1952
+ parent.updatePenStrokeWidth(args.item.id);
1957
1953
  if (Browser.isDevice) {
1958
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_bottomToolbar'))) {
1954
+ if (document.getElementById(parent.element.id + '_bottomToolbar')) {
1959
1955
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1960
1956
  var toolbar_8 = getComponent(parent.element.id + '_bottomToolbar', 'toolbar');
1961
1957
  toolbar_8.refreshOverflow();
1962
1958
  }
1963
1959
  }
1964
1960
  else {
1965
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar'))) {
1961
+ if (document.getElementById(parent.element.id + '_toolbar')) {
1966
1962
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
1967
1963
  var toolbar_9 = getComponent(parent.element.id + '_toolbar', 'toolbar');
1968
1964
  toolbar_9.refreshOverflow();
@@ -2011,14 +2007,14 @@ var ToolbarModule = /** @class */ (function () {
2011
2007
  _this.renderSaveBtn();
2012
2008
  }
2013
2009
  if (Browser.isDevice) {
2014
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
2010
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2015
2011
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2016
2012
  toolbar.refreshOverflow();
2017
2013
  }
2018
2014
  }
2019
2015
  else {
2020
2016
  _this.createLeftToolbarControls();
2021
- if (_this.defToolbarItems.length > 0 && (!isNullOrUndefined(document.getElementById(parent.element.id + '_toolbar')))) {
2017
+ if (_this.defToolbarItems.length > 0 && document.getElementById(parent.element.id + '_toolbar')) {
2022
2018
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
2023
2019
  toolbar.refreshOverflow();
2024
2020
  }
@@ -2037,8 +2033,8 @@ var ToolbarModule = /** @class */ (function () {
2037
2033
  var _this = this;
2038
2034
  var parent = this.parent;
2039
2035
  var mainItem = this.getFilterToolbarItem();
2040
- if (document.querySelector('#' + this.parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
2041
- getComponent(document.getElementById(this.parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
2036
+ if (document.querySelector('#' + parent.element.id + '_contextualToolbar').classList.contains('e-control')) {
2037
+ getComponent(document.getElementById(parent.element.id + '_contextualToolbar'), 'toolbar').destroy();
2042
2038
  }
2043
2039
  var toolbar = new Toolbar({
2044
2040
  width: '100%',
@@ -2048,7 +2044,7 @@ var ToolbarModule = /** @class */ (function () {
2048
2044
  _this.updatePrivateVariables();
2049
2045
  _this.createCanvasFilter();
2050
2046
  if (parent.currentFilter === '') {
2051
- parent.currentFilter = _this.parent.element.id + '_default';
2047
+ parent.currentFilter = parent.element.id + '_default';
2052
2048
  }
2053
2049
  var hdrWrapper = document.querySelector('#' + parent.element.id + '_headWrapper');
2054
2050
  if (hdrWrapper) {
@@ -2059,10 +2055,12 @@ var ToolbarModule = /** @class */ (function () {
2059
2055
  toolbar.refreshOverflow();
2060
2056
  }
2061
2057
  });
2062
- toolbar.appendTo('#' + this.parent.element.id + '_contextualToolbar');
2058
+ toolbar.appendTo('#' + parent.element.id + '_contextualToolbar');
2063
2059
  };
2064
2060
  ToolbarModule.prototype.createCanvasFilter = function () {
2065
2061
  var parent = this.parent;
2062
+ showSpinner(parent.element);
2063
+ parent.element.style.opacity = '0.5';
2066
2064
  var imageData = parent.getCurrentCanvasData();
2067
2065
  this.inMemoryCanvas.width = imageData.width;
2068
2066
  this.inMemoryCanvas.height = imageData.height;
@@ -2074,16 +2072,19 @@ var ToolbarModule = /** @class */ (function () {
2074
2072
  this.updateFilterCanvas('_grayscaleCanvas', 'grayscale');
2075
2073
  this.updateFilterCanvas('_sepiaCanvas', 'sepia');
2076
2074
  this.updateFilterCanvas('_invertCanvas', 'invert');
2075
+ hideSpinner(parent.element);
2076
+ parent.element.style.opacity = '1';
2077
2077
  parent.initialAdjustmentValue = this.lowerContext.filter;
2078
2078
  };
2079
2079
  ToolbarModule.prototype.updateFilterCanvas = function (selector, type) {
2080
- var filter = this.parent.element.querySelector('#' + this.parent.element.id + selector);
2081
- if (!isNullOrUndefined(filter)) {
2080
+ var parent = this.parent;
2081
+ var filter = parent.element.querySelector('#' + parent.element.id + selector);
2082
+ if (filter) {
2082
2083
  var ctx = filter.getContext('2d');
2083
2084
  ctx = filter.getContext('2d');
2084
2085
  filter.style.width = '100px';
2085
2086
  filter.style.height = '100px';
2086
- this.parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
2087
+ parent.notify('filter', { prop: 'updateAdj', value: { type: type, value: null, isPreview: true, ctx: ctx } });
2087
2088
  ctx.drawImage(this.inMemoryCanvas, 0, 0, 300, 150);
2088
2089
  }
2089
2090
  };
@@ -2133,47 +2134,51 @@ var ToolbarModule = /** @class */ (function () {
2133
2134
  return orgToolbarItems;
2134
2135
  };
2135
2136
  ToolbarModule.prototype.renderQAT = function (isPenEdit) {
2136
- if (!isNullOrUndefined(this.parent.activeObj) && this.parent.showQuickAccessToolbar) {
2137
- var qtArea = document.getElementById(this.parent.element.id + '_quickAccessToolbarArea');
2138
- if (!isNullOrUndefined(document.getElementById(this.parent.element.id + '_quickAccessToolbarArea'))) {
2137
+ var parent = this.parent;
2138
+ if (parent.activeObj && parent.showQuickAccessToolbar) {
2139
+ var qtArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
2140
+ if (qtArea) {
2139
2141
  this.destroyQuickAccessToolbar();
2140
- document.getElementById(this.parent.element.id + '_quickAccessToolbarArea').style.display = 'block';
2142
+ qtArea.style.display = 'block';
2141
2143
  }
2142
2144
  var items = this.getQuickAccessToolbarItem(isPenEdit);
2143
2145
  if (items.length === 0) {
2144
2146
  return;
2145
2147
  }
2146
- if (isNullOrUndefined(this.parent.quickAccessToolbarTemplate)) {
2148
+ if (isNullOrUndefined(parent.quickAccessToolbarTemplate)) {
2147
2149
  var toolbarObj = new Toolbar({
2148
2150
  items: items,
2149
2151
  clicked: this.quickAccessToolbarClicked.bind(this)
2150
2152
  });
2151
- toolbarObj.appendTo('#' + this.parent.element.id + '_quickAccessToolbar');
2153
+ toolbarObj.appendTo('#' + parent.element.id + '_quickAccessToolbar');
2152
2154
  }
2153
2155
  if (isNullOrUndefined(isPenEdit)) {
2154
2156
  qtArea.style.width = 'auto';
2155
- this.parent.activeObj.activePoint.width = Math.abs(this.parent.activeObj.activePoint.width);
2156
- this.parent.activeObj.activePoint.height = Math.abs(this.parent.activeObj.activePoint.height);
2157
- var x = this.parent.activeObj.activePoint.startX < this.parent.activeObj.activePoint.endX ?
2158
- this.parent.activeObj.activePoint.startX : this.parent.activeObj.activePoint.endX;
2159
- var y = this.parent.activeObj.activePoint.startY < this.parent.activeObj.activePoint.endY ?
2160
- this.parent.activeObj.activePoint.startY : this.parent.activeObj.activePoint.endY;
2161
- var width = this.parent.activeObj.activePoint.width;
2162
- if (this.parent.activeObj.rotatedAngle !== 0 && this.parent.activeObj.shape !== 'arrow') {
2163
- var point = this.parent.getSquarePointForRotatedShape(this.parent.activeObj);
2157
+ parent.activeObj.activePoint.width = Math.abs(parent.activeObj.activePoint.width);
2158
+ parent.activeObj.activePoint.height = Math.abs(parent.activeObj.activePoint.height);
2159
+ var x = parent.activeObj.activePoint.startX < parent.activeObj.activePoint.endX ?
2160
+ parent.activeObj.activePoint.startX : parent.activeObj.activePoint.endX;
2161
+ var y = parent.activeObj.activePoint.startY < parent.activeObj.activePoint.endY ?
2162
+ parent.activeObj.activePoint.startY : parent.activeObj.activePoint.endY;
2163
+ var width = parent.activeObj.activePoint.width;
2164
+ if (parent.activeObj.rotatedAngle !== 0 && parent.activeObj.shape !== 'arrow') {
2165
+ var object = { activePoint: null };
2166
+ parent.notify('shape', { prop: 'getSquarePointForRotatedShape', onPropertyChange: false,
2167
+ value: { obj: parent.activeObj, object: object } });
2168
+ var point = object['activePoint'];
2164
2169
  x = point.startX;
2165
2170
  y = point.startY;
2166
2171
  width = point.width;
2167
2172
  }
2168
- else if (this.parent.activeObj.shape === 'path') {
2169
- var path = this.parent.getSquarePointForPath(this.parent.activeObj);
2173
+ else if (parent.activeObj.shape === 'path') {
2174
+ var path = parent.getSquarePointForPath(parent.activeObj);
2170
2175
  x = path.startX;
2171
2176
  y = path.startY;
2172
2177
  width = path.width;
2173
2178
  }
2174
2179
  qtArea.style.left = (x + (width / 2)) - (items.length * 25) + 'px';
2175
- if (y - 60 < this.parent.img.destTop) {
2176
- qtArea.style.top = this.parent.img.destTop + 'px';
2180
+ if (y - 60 < parent.img.destTop) {
2181
+ qtArea.style.top = parent.img.destTop + 'px';
2177
2182
  }
2178
2183
  else {
2179
2184
  qtArea.style.top = y - 60 + 'px';
@@ -2182,14 +2187,14 @@ var ToolbarModule = /** @class */ (function () {
2182
2187
  else if (isPenEdit) {
2183
2188
  var obj = { activePoint: null };
2184
2189
  var indexObj = { freehandSelectedIndex: null };
2185
- this.parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2186
- this.parent.notify('freehand-draw', { prop: 'getSqPtFD',
2190
+ parent.notify('freehand-draw', { prop: 'getFreehandSelectedIndex', onPropertyChange: false, value: { obj: indexObj } });
2191
+ parent.notify('freehand-draw', { prop: 'getSqPtFD',
2187
2192
  value: { idx: indexObj['freehandSelectedIndex'], obj: obj } });
2188
2193
  var point = obj['activePoint'];
2189
2194
  qtArea.style.width = 'auto';
2190
2195
  qtArea.style.left = (point.startX + (point.width / 2)) - (items.length * 27) + 'px';
2191
- if (point.startY - 60 < this.parent.img.destTop) {
2192
- qtArea.style.top = this.parent.img.destTop + 'px';
2196
+ if (point.startY - 60 < parent.img.destTop) {
2197
+ qtArea.style.top = parent.img.destTop + 'px';
2193
2198
  }
2194
2199
  else {
2195
2200
  qtArea.style.top = point.startY - 60 + 'px';
@@ -2201,8 +2206,9 @@ var ToolbarModule = /** @class */ (function () {
2201
2206
  if (isNullOrUndefined(isDisabled)) {
2202
2207
  return;
2203
2208
  }
2204
- var annotation = document.querySelector('#' + this.parent.element.id + '_annotationBtn');
2205
- if (!isNullOrUndefined(annotation)) {
2209
+ var parent = this.parent;
2210
+ var annotation = document.querySelector('#' + parent.element.id + '_annotationBtn');
2211
+ if (annotation) {
2206
2212
  if (isDisabled) {
2207
2213
  annotation.classList.add('e-disabled');
2208
2214
  annotation.parentElement.classList.add('e-overlay');
@@ -2213,8 +2219,8 @@ var ToolbarModule = /** @class */ (function () {
2213
2219
  }
2214
2220
  getComponent(annotation, 'dropdown-btn').disabled = isDisabled;
2215
2221
  }
2216
- var transform = document.querySelector('#' + this.parent.element.id + '_transformBtn');
2217
- if (!isNullOrUndefined(transform)) {
2222
+ var transform = document.querySelector('#' + parent.element.id + '_transformBtn');
2223
+ if (transform) {
2218
2224
  if (isDisabled) {
2219
2225
  transform.classList.add('e-disabled');
2220
2226
  transform.parentElement.classList.add('e-overlay');
@@ -2225,8 +2231,8 @@ var ToolbarModule = /** @class */ (function () {
2225
2231
  }
2226
2232
  getComponent(transform, 'dropdown-btn').disabled = isDisabled;
2227
2233
  }
2228
- var adjustment = document.querySelector('#' + this.parent.element.id + '_adjustment');
2229
- if (!isNullOrUndefined(adjustment)) {
2234
+ var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
2235
+ if (adjustment) {
2230
2236
  if (isDisabled) {
2231
2237
  adjustment.classList.add('e-disabled');
2232
2238
  adjustment.parentElement.classList.add('e-overlay');
@@ -2237,8 +2243,8 @@ var ToolbarModule = /** @class */ (function () {
2237
2243
  }
2238
2244
  getComponent(adjustment, 'btn').disabled = isDisabled;
2239
2245
  }
2240
- var filter = document.querySelector('#' + this.parent.element.id + '_filter');
2241
- if (!isNullOrUndefined(filter)) {
2246
+ var filter = document.querySelector('#' + parent.element.id + '_filter');
2247
+ if (filter) {
2242
2248
  if (isDisabled) {
2243
2249
  filter.classList.add('e-disabled');
2244
2250
  filter.parentElement.classList.add('e-overlay');
@@ -2268,7 +2274,7 @@ var ToolbarModule = /** @class */ (function () {
2268
2274
  ToolbarModule.prototype.quickAccessToolbarClicked = function (args, isContextualToolbar) {
2269
2275
  var parent = this.parent;
2270
2276
  var points = { x: parent.activeObj.activePoint.startX, y: parent.activeObj.activePoint.startY };
2271
- if (!isNullOrUndefined(args.item)) {
2277
+ if (args.item) {
2272
2278
  var duplicateObj = void 0;
2273
2279
  var objColl = void 0;
2274
2280
  var isPreventUndoRedo = null;
@@ -2281,7 +2287,7 @@ var ToolbarModule = /** @class */ (function () {
2281
2287
  parent.notify('draw', { prop: 'getNewPath', value: { obj: pathObject } });
2282
2288
  switch (args.item.id.replace(parent.element.id + '_', '').toLowerCase()) {
2283
2289
  case 'duplicate':
2284
- if (!this.parent.element.querySelector('#' + this.parent.element.id + '_duplicate').classList.contains('e-disabled')) {
2290
+ if (!parent.element.querySelector('#' + parent.element.id + '_duplicate').classList.contains('e-disabled')) {
2285
2291
  if (!pathObject['isNewPath'] && JSON.stringify(object['tempObj']) === JSON.stringify(parent.activeObj)) {
2286
2292
  isPreventUndoRedo = true;
2287
2293
  }
@@ -2289,7 +2295,7 @@ var ToolbarModule = /** @class */ (function () {
2289
2295
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
2290
2296
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
2291
2297
  }
2292
- else if (!isNullOrUndefined(obj['prevActObj'])) {
2298
+ else if (obj['prevActObj']) {
2293
2299
  parent.activeObj.currIndex = null;
2294
2300
  duplicateObj.currIndex = null;
2295
2301
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: isPreventUndoRedo } });
@@ -2316,19 +2322,19 @@ var ToolbarModule = /** @class */ (function () {
2316
2322
  parent.notify('shape', { prop: 'setPointCollForLineArrow', onPropertyChange: false,
2317
2323
  value: { obj: parent.activeObj } });
2318
2324
  }
2319
- // parent.updateTrianglePoints(this.parent.activeObj); Invoke
2325
+ // parent.updateTrianglePoints(parent.activeObj); Invoke
2320
2326
  parent.notify('draw', { prop: 'drawObject', onPropertyChange: false, value: { canvas: 'duplicate', obj: parent.activeObj } });
2321
2327
  parent.notify('undo-redo', { prop: 'updateUrObj', onPropertyChange: false, value: { objColl: objColl } });
2322
2328
  this.renderQAT();
2323
2329
  }
2324
2330
  break;
2325
2331
  case 'remove':
2326
- if (!this.parent.element.querySelector('#' + this.parent.element.id + '_remove').classList.contains('e-disabled')) {
2332
+ if (!parent.element.querySelector('#' + parent.element.id + '_remove').classList.contains('e-disabled')) {
2327
2333
  parent.notify('selection', { prop: 'deleteItem', onPropertyChange: false });
2328
2334
  }
2329
2335
  break;
2330
2336
  case 'edittext':
2331
- if (!this.parent.element.querySelector('#' + this.parent.element.id + '_editText').classList.contains('e-disabled')) {
2337
+ if (!parent.element.querySelector('#' + parent.element.id + '_editText').classList.contains('e-disabled')) {
2332
2338
  this.upperContext.clearRect(0, 0, parent.upperCanvas.width, parent.upperCanvas.height);
2333
2339
  parent.notify('selection', { prop: 'setTempActObj', onPropertyChange: false,
2334
2340
  value: { obj: extend({}, parent.activeObj, {}, true) } });
@@ -2345,10 +2351,10 @@ var ToolbarModule = /** @class */ (function () {
2345
2351
  if (isNullOrUndefined(parent.activeObj.currIndex)) {
2346
2352
  parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
2347
2353
  }
2348
- else if (!isNullOrUndefined(obj['prevActObj'])) {
2354
+ else if (obj['prevActObj']) {
2349
2355
  parent.notify('draw', { prop: 'setShapeTextInsert', onPropertyChange: false, value: { bool: true } });
2350
2356
  }
2351
- if (!isNullOrUndefined(document.getElementById(this.parent.element.id + '_quickAccessToolbarArea'))) {
2357
+ if (document.getElementById(parent.element.id + '_quickAccessToolbarArea')) {
2352
2358
  document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
2353
2359
  }
2354
2360
  }
@@ -2369,7 +2375,7 @@ var ToolbarModule = /** @class */ (function () {
2369
2375
  }
2370
2376
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
2371
2377
  }
2372
- if (!isNullOrUndefined(args.item)) {
2378
+ if (args.item) {
2373
2379
  var type = args.item.id.replace(parent.element.id + '_', '').toLowerCase();
2374
2380
  if (type === 'duplicate' || type === 'remove' || type === 'edittext') {
2375
2381
  this.quickAccessToolbarClicked(args, true);
@@ -2379,11 +2385,11 @@ var ToolbarModule = /** @class */ (function () {
2379
2385
  var isDisabledFilter = false;
2380
2386
  var isDisabledAdjustment = false;
2381
2387
  var adjustment = document.querySelector('#' + parent.element.id + '_adjustment');
2382
- if (!isNullOrUndefined(adjustment) && adjustment.classList.contains('e-disabled')) {
2388
+ if (adjustment && adjustment.classList.contains('e-disabled')) {
2383
2389
  isDisabledAdjustment = true;
2384
2390
  }
2385
2391
  var filter = document.querySelector('#' + parent.element.id + '_filter');
2386
- if (!isNullOrUndefined(filter) && filter.classList.contains('e-disabled')) {
2392
+ if (filter && filter.classList.contains('e-disabled')) {
2387
2393
  isDisabledFilter = true;
2388
2394
  }
2389
2395
  this.enableDisableTbrBtn();
@@ -2428,18 +2434,18 @@ var ToolbarModule = /** @class */ (function () {
2428
2434
  }
2429
2435
  }
2430
2436
  else {
2431
- panBtn = this.parent.element.querySelector('.e-img-pan .e-btn');
2432
- if (!isNullOrUndefined(panBtn)) {
2437
+ panBtn = parent.element.querySelector('.e-img-pan .e-btn');
2438
+ if (panBtn) {
2433
2439
  panBtn.classList.add('e-selected-btn');
2434
2440
  }
2435
2441
  parent.pan(true);
2436
2442
  parent.notify('transform', { prop: 'setDisablePan', onPropertyChange: false, value: { bool: false } });
2437
2443
  }
2438
- if (!isNullOrUndefined(zoomIn) && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
2444
+ if (zoomIn && parent.zoomSettings.zoomFactor >= parent.zoomSettings.maxZoomFactor) {
2439
2445
  zoomIn.classList.add('e-disabled');
2440
2446
  zoomIn.parentElement.classList.add('e-overlay');
2441
2447
  }
2442
- else if (!isNullOrUndefined(zoomIn)) {
2448
+ else if (zoomIn) {
2443
2449
  zoomIn.classList.remove('e-disabled');
2444
2450
  zoomIn.parentElement.classList.remove('e-overlay');
2445
2451
  }
@@ -2454,19 +2460,6 @@ var ToolbarModule = /** @class */ (function () {
2454
2460
  this.currentToolbar = 'main';
2455
2461
  break;
2456
2462
  case 'crop':
2457
- if (!isNullOrUndefined(parent.currSelectionPoint)) {
2458
- if (parent.currObjType.isUndoAction) {
2459
- parent.notify('undo-redo', { prop: 'refreshUrc', value: { bool: null } });
2460
- }
2461
- if (!isNullOrUndefined(parent.cropObj.activeObj.shape)) {
2462
- parent.select(parent.activeObj.shape);
2463
- }
2464
- this.refreshToolbar('main', true, true);
2465
- getComponent(parent.element.querySelector('#' + this.parent.element.id + '_cropBtn'), 'dropdown-btn').toggle();
2466
- if (!isNullOrUndefined(parent.activeObj.shape)) {
2467
- document.getElementById(parent.activeObj.shape.split('-')[1]).classList.add('e-selected');
2468
- }
2469
- }
2470
2463
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
2471
2464
  break;
2472
2465
  case 'reset':
@@ -2580,7 +2573,7 @@ var ToolbarModule = /** @class */ (function () {
2580
2573
  case 'rotateright':
2581
2574
  case 'horizontalflip':
2582
2575
  case 'verticalflip':
2583
- this.parent.transformSelect(type);
2576
+ parent.transformSelect(type);
2584
2577
  parent.notify('transform', { prop: 'disableZoomOutBtn', value: { isZoomOut: true } });
2585
2578
  break;
2586
2579
  case 'save':
@@ -2605,7 +2598,7 @@ var ToolbarModule = /** @class */ (function () {
2605
2598
  }
2606
2599
  var type = args.item.id.replace(parent.element.id, '').split('_')[1];
2607
2600
  var imageFiltering = { filter: parent.toPascalCase(type), cancel: false };
2608
- this.parent.trigger('imageFiltering', imageFiltering);
2601
+ parent.trigger('imageFiltering', imageFiltering);
2609
2602
  if (imageFiltering.cancel) {
2610
2603
  return;
2611
2604
  }
@@ -2616,11 +2609,12 @@ var ToolbarModule = /** @class */ (function () {
2616
2609
  this.enableDisableTbrBtn();
2617
2610
  };
2618
2611
  ToolbarModule.prototype.refreshShapeDrawing = function () {
2612
+ var parent = this.parent;
2619
2613
  var object = { shape: '' };
2620
- this.parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
2614
+ parent.notify('selection', { prop: 'getCurrentDrawingShape', onPropertyChange: false, value: { obj: object } });
2621
2615
  if (object['shape'] !== '') {
2622
- this.parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2623
- this.parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2616
+ parent.notify('selection', { prop: 'setCurrentDrawingShape', onPropertyChange: false, value: { value: '' } });
2617
+ parent.notify('shape', { prop: 'refreshActiveObj', onPropertyChange: false });
2624
2618
  this.refreshToolbar('main', false);
2625
2619
  }
2626
2620
  };
@@ -2699,9 +2693,9 @@ var ToolbarModule = /** @class */ (function () {
2699
2693
  ToolbarModule.prototype.closeContextualToolbar = function () {
2700
2694
  var parent = this.parent;
2701
2695
  var isContextualToolbar = false;
2702
- if ((!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_contextualToolbar')) &&
2696
+ if ((parent.element.querySelector('#' + parent.element.id + '_contextualToolbar') &&
2703
2697
  !parent.element.querySelector('#' + parent.element.id + '_contextualToolbar').parentElement.classList.contains('e-hide')) ||
2704
- (!isNullOrUndefined(parent.element.querySelector('#' + parent.element.id + '_headWrapper'))
2698
+ (parent.element.querySelector('#' + parent.element.id + '_headWrapper')
2705
2699
  && !parent.element.querySelector('#' + parent.element.id + '_headWrapper').parentElement.classList.contains('e-hide'))) {
2706
2700
  parent.element.querySelector('.e-contextual-toolbar-wrapper').classList.add('e-hide');
2707
2701
  parent.okBtn();
@@ -2712,12 +2706,13 @@ var ToolbarModule = /** @class */ (function () {
2712
2706
  };
2713
2707
  ToolbarModule.prototype.destroyQuickAccessToolbar = function () {
2714
2708
  var parent = this.parent;
2715
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbar')) &&
2716
- !isNullOrUndefined(getComponent(document.getElementById(parent.element.id + '_quickAccessToolbar'), 'toolbar'))) {
2717
- getComponent(document.getElementById(parent.element.id + '_quickAccessToolbar'), 'toolbar').destroy();
2709
+ var quickToolbar = document.getElementById(parent.element.id + '_quickAccessToolbar');
2710
+ if (quickToolbar && quickToolbar.classList.contains('e-control')) {
2711
+ getComponent(quickToolbar, 'toolbar').destroy();
2718
2712
  }
2719
- if (!isNullOrUndefined(document.getElementById(parent.element.id + '_quickAccessToolbarArea'))) {
2720
- document.getElementById(parent.element.id + '_quickAccessToolbarArea').style.display = 'none';
2713
+ var qatArea = document.getElementById(parent.element.id + '_quickAccessToolbarArea');
2714
+ if (qatArea) {
2715
+ qatArea.style.display = 'none';
2721
2716
  }
2722
2717
  };
2723
2718
  ToolbarModule.prototype.renderSlider = function (type) {
@@ -2730,7 +2725,7 @@ var ToolbarModule = /** @class */ (function () {
2730
2725
  id: parent.element.id + '_headWrapper',
2731
2726
  styles: 'position: relative'
2732
2727
  }));
2733
- labelWrapper = hdrWrapper.appendChild(this.parent.createElement('label', {
2728
+ labelWrapper = hdrWrapper.appendChild(parent.createElement('label', {
2734
2729
  id: parent.element.id + '_labelWrapper',
2735
2730
  styles: Browser.isDevice ? 'position: absolute; top: 25%; left: calc(50% - 150px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
2736
2731
  : 'position: absolute; top: 25%; left: calc(50% - 226px); font-size: 15px; text-transform: capitalize; font-weight: 400;'
@@ -2744,12 +2739,12 @@ var ToolbarModule = /** @class */ (function () {
2744
2739
  id: parent.element.id + '_sliderWrapper',
2745
2740
  styles: 'position: absolute'
2746
2741
  }));
2747
- var value = this.parent.getCurrAdjustmentValue(type);
2742
+ var value = parent.getCurrAdjustmentValue(type);
2748
2743
  var min;
2749
2744
  var max;
2750
2745
  var slider;
2751
2746
  if (type === 'brightness' || type === 'contrast' || type === 'saturation' || type === 'exposure') {
2752
- if (this.parent.finetuneSettings) {
2747
+ if (parent.finetuneSettings) {
2753
2748
  if (type === 'brightness' && parent.finetuneSettings.brightness) {
2754
2749
  min = parent.finetuneSettings.brightness.min;
2755
2750
  max = parent.finetuneSettings.brightness.max;
@@ -2762,7 +2757,7 @@ var ToolbarModule = /** @class */ (function () {
2762
2757
  min = parent.finetuneSettings.saturation.min;
2763
2758
  max = parent.finetuneSettings.saturation.max;
2764
2759
  }
2765
- else if (type === 'exposure' && this.parent.finetuneSettings.exposure) {
2760
+ else if (type === 'exposure' && parent.finetuneSettings.exposure) {
2766
2761
  min = parent.finetuneSettings.exposure.min;
2767
2762
  max = parent.finetuneSettings.exposure.max;
2768
2763
  }
@@ -2818,27 +2813,29 @@ var ToolbarModule = /** @class */ (function () {
2818
2813
  width: Browser.isDevice ? '200px' : '300px',
2819
2814
  cssClass: 'e-slider',
2820
2815
  change: function (args) {
2821
- _this.parent.setCurrAdjustmentValue(type, args.value);
2816
+ parent.setCurrAdjustmentValue(type, args.value);
2822
2817
  _this.enableDisableTbrBtn();
2823
2818
  }
2824
2819
  });
2825
2820
  };
2826
2821
  ToolbarModule.prototype.applyPreviewFilter = function () {
2827
- if (!isNullOrUndefined(document.querySelector('#' + this.parent.element.id + '_sliderWrapper')) ||
2828
- this.parent.currObjType.isFiltered) {
2829
- this.parent.initialAdjustmentValue = this.parent.canvasFilter = this.lowerContext.filter;
2830
- this.parent.currObjType.isFiltered = false;
2822
+ var parent = this.parent;
2823
+ if (document.querySelector('#' + parent.element.id + '_sliderWrapper') ||
2824
+ parent.currObjType.isFiltered) {
2825
+ parent.initialAdjustmentValue = parent.canvasFilter = this.lowerContext.filter;
2826
+ parent.currObjType.isFiltered = false;
2831
2827
  }
2832
2828
  };
2833
2829
  ToolbarModule.prototype.unselectBtn = function () {
2830
+ var parent = this.parent;
2834
2831
  var selectors = [
2835
- '#' + this.parent.element.id + '_brightness',
2836
- '#' + this.parent.element.id + '_contrast',
2837
- '#' + this.parent.element.id + '_hue',
2838
- '#' + this.parent.element.id + '_saturation',
2839
- '#' + this.parent.element.id + '_opacity',
2840
- '#' + this.parent.element.id + '_blur',
2841
- '#' + this.parent.element.id + '_exposure'
2832
+ '#' + parent.element.id + '_brightness',
2833
+ '#' + parent.element.id + '_contrast',
2834
+ '#' + parent.element.id + '_hue',
2835
+ '#' + parent.element.id + '_saturation',
2836
+ '#' + parent.element.id + '_opacity',
2837
+ '#' + parent.element.id + '_blur',
2838
+ '#' + parent.element.id + '_exposure'
2842
2839
  ];
2843
2840
  for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) {
2844
2841
  var selector = selectors_1[_i];
@@ -2863,68 +2860,69 @@ var ToolbarModule = /** @class */ (function () {
2863
2860
  if (hdrWrapper) {
2864
2861
  hdrWrapper.style.display = 'none';
2865
2862
  }
2866
- if (!isNullOrUndefined(sliderWrapper) && !isNullOrUndefined(slider)) {
2863
+ if (sliderWrapper && slider) {
2867
2864
  slider.ej2_instances[0].destroy();
2868
2865
  sliderWrapper.remove();
2869
2866
  }
2870
2867
  };
2871
2868
  ToolbarModule.prototype.updateToolbarItems = function () {
2872
- var selFillElem = this.parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
2873
- var selStrokeElem = this.parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
2874
- var selTextStrokeElem = this.parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
2875
- var selPenStrokeElem = this.parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
2876
- var strokeWidthElem = this.parent.element.querySelector('.e-shape-stroke-width');
2877
- var fontFamilyElem = this.parent.element.querySelector('.e-text-font-family');
2878
- var fontSizeElem = this.parent.element.querySelector('.e-text-font-size');
2879
- var boldBtn = this.parent.element.querySelector('#' + this.parent.element.id + '_bold');
2880
- var italicBtn = this.parent.element.querySelector('#' + this.parent.element.id + '_italic');
2881
- if (isNullOrUndefined(this.parent.activeObj.strokeSettings.strokeWidth)) {
2882
- this.parent.activeObj.strokeSettings.strokeWidth = 2;
2869
+ var parent = this.parent;
2870
+ var selFillElem = parent.element.querySelector('.e-fill.e-template .e-dropdownbtn-preview');
2871
+ var selStrokeElem = parent.element.querySelector('.e-stroke.e-template .e-dropdownbtn-preview');
2872
+ var selTextStrokeElem = parent.element.querySelector('.e-text-font-color.e-template .e-dropdownbtn-preview');
2873
+ var selPenStrokeElem = parent.element.querySelector('.e-pen-stroke-color.e-template .e-dropdownbtn-preview');
2874
+ var strokeWidthElem = parent.element.querySelector('.e-shape-stroke-width');
2875
+ var fontFamilyElem = parent.element.querySelector('.e-text-font-family');
2876
+ var fontSizeElem = parent.element.querySelector('.e-text-font-size');
2877
+ var boldBtn = parent.element.querySelector('#' + parent.element.id + '_bold');
2878
+ var italicBtn = parent.element.querySelector('#' + parent.element.id + '_italic');
2879
+ if (isNullOrUndefined(parent.activeObj.strokeSettings.strokeWidth)) {
2880
+ parent.activeObj.strokeSettings.strokeWidth = 2;
2883
2881
  }
2884
2882
  if (selFillElem) {
2885
- if (this.parent.activeObj.strokeSettings.fillColor === '') {
2883
+ if (parent.activeObj.strokeSettings.fillColor === '') {
2886
2884
  selFillElem.classList.add('e-nocolor-item');
2887
2885
  }
2888
2886
  else {
2889
2887
  selFillElem.classList.remove('e-nocolor-item');
2890
- selFillElem.style.background = this.parent.activeObj.strokeSettings.fillColor;
2888
+ selFillElem.style.background = parent.activeObj.strokeSettings.fillColor;
2891
2889
  }
2892
- getComponent(this.parent.element.id + '_shape_fill', 'colorpicker').value
2893
- = this.parent.activeObj.strokeSettings.fillColor + 'ff';
2890
+ getComponent(parent.element.id + '_shape_fill', 'colorpicker').value
2891
+ = parent.activeObj.strokeSettings.fillColor + 'ff';
2894
2892
  }
2895
2893
  if (selStrokeElem) {
2896
- selStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
2897
- getComponent(this.parent.element.id + '_shape_stroke', 'colorpicker').value
2898
- = this.parent.activeObj.strokeSettings.strokeColor + 'ff';
2894
+ selStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
2895
+ getComponent(parent.element.id + '_shape_stroke', 'colorpicker').value
2896
+ = parent.activeObj.strokeSettings.strokeColor + 'ff';
2899
2897
  }
2900
2898
  if (selTextStrokeElem) {
2901
- selTextStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
2902
- getComponent(this.parent.element.id + '_text_font', 'colorpicker').value
2903
- = this.parent.activeObj.strokeSettings.strokeColor + 'ff';
2899
+ selTextStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
2900
+ getComponent(parent.element.id + '_text_font', 'colorpicker').value
2901
+ = parent.activeObj.strokeSettings.strokeColor + 'ff';
2904
2902
  }
2905
2903
  if (selPenStrokeElem) {
2906
- selPenStrokeElem.style.background = this.parent.activeObj.strokeSettings.strokeColor;
2907
- getComponent(this.parent.element.id + '_pen_stroke', 'colorpicker').value
2908
- = this.parent.activeObj.strokeSettings.strokeColor + 'ff';
2904
+ selPenStrokeElem.style.background = parent.activeObj.strokeSettings.strokeColor;
2905
+ getComponent(parent.element.id + '_pen_stroke', 'colorpicker').value
2906
+ = parent.activeObj.strokeSettings.strokeColor + 'ff';
2909
2907
  }
2910
2908
  if (fontFamilyElem) {
2911
2909
  if (Browser.isDevice) {
2912
- fontFamilyElem.setAttribute('style', 'font-family:' + this.parent.activeObj.textSettings.fontFamily.toLowerCase());
2910
+ fontFamilyElem.setAttribute('style', 'font-family:' + parent.activeObj.textSettings.fontFamily.toLowerCase());
2913
2911
  }
2914
2912
  else {
2915
- fontFamilyElem.textContent = this.parent.activeObj.textSettings.fontFamily;
2913
+ fontFamilyElem.textContent = parent.activeObj.textSettings.fontFamily;
2916
2914
  }
2917
2915
  }
2918
2916
  if (fontSizeElem) {
2919
- for (var i = 0; i < this.parent.fontSizeColl.length; i++) {
2920
- if (parseInt(this.parent.fontSizeColl[i].text, 10) >= Math.round(this.parent.activeObj.textSettings.fontSize)) {
2917
+ for (var i = 0; i < parent.fontSizeColl.length; i++) {
2918
+ if (parseInt(parent.fontSizeColl[i].text, 10) >= Math.round(parent.activeObj.textSettings.fontSize)) {
2921
2919
  fontSizeElem.textContent = (i + 1).toString();
2922
2920
  break;
2923
2921
  }
2924
2922
  }
2925
2923
  }
2926
2924
  if (boldBtn) {
2927
- if (this.parent.activeObj.textSettings.bold) {
2925
+ if (parent.activeObj.textSettings.bold) {
2928
2926
  boldBtn.classList.add('e-selected-btn');
2929
2927
  }
2930
2928
  else {
@@ -2932,7 +2930,7 @@ var ToolbarModule = /** @class */ (function () {
2932
2930
  }
2933
2931
  }
2934
2932
  if (italicBtn) {
2935
- if (this.parent.activeObj.textSettings.italic) {
2933
+ if (parent.activeObj.textSettings.italic) {
2936
2934
  italicBtn.classList.add('e-selected-btn');
2937
2935
  }
2938
2936
  else {
@@ -2940,7 +2938,7 @@ var ToolbarModule = /** @class */ (function () {
2940
2938
  }
2941
2939
  }
2942
2940
  if (strokeWidthElem) {
2943
- var strokeWidth = Math.round((this.parent.activeObj.strokeSettings.strokeWidth)).toString();
2941
+ var strokeWidth = Math.round((parent.activeObj.strokeSettings.strokeWidth)).toString();
2944
2942
  strokeWidthElem.textContent = this.getStrokeWidth(strokeWidth);
2945
2943
  }
2946
2944
  };
@@ -2970,7 +2968,7 @@ var ToolbarModule = /** @class */ (function () {
2970
2968
  var parent = this.parent;
2971
2969
  parent.notify('shape', { prop: 'applyActObj', onPropertyChange: false, value: { isMouseDown: true } });
2972
2970
  var panBtn = parent.element.querySelector('.e-img-pan .e-btn');
2973
- if (!isNullOrUndefined(panBtn)) {
2971
+ if (panBtn) {
2974
2972
  panBtn.classList.remove('e-selected-btn');
2975
2973
  }
2976
2974
  parent.pan(false);
@@ -2981,22 +2979,23 @@ var ToolbarModule = /** @class */ (function () {
2981
2979
  }
2982
2980
  };
2983
2981
  ToolbarModule.prototype.destroySubComponents = function () {
2984
- var inputElement = this.parent.element.querySelectorAll('input.e-control');
2985
- var btnElement = this.parent.element.querySelectorAll('button.e-control');
2982
+ var parent = this.parent;
2983
+ var inputElement = parent.element.querySelectorAll('input.e-control');
2984
+ var btnElement = parent.element.querySelectorAll('button.e-control');
2986
2985
  for (var i = 0, len = inputElement.length; i < len; i++) {
2987
2986
  if (inputElement[i].classList.contains('e-color-picker')) {
2988
2987
  getComponent(inputElement[i], 'color-picker').destroy();
2989
- detach(select('input#' + inputElement[i].id, this.parent.element));
2988
+ detach(select('input#' + inputElement[i].id, parent.element));
2990
2989
  }
2991
2990
  }
2992
2991
  for (var i = 0, len = btnElement.length; i < len; i++) {
2993
2992
  if (btnElement[i].classList.contains('e-dropdown-btn')) {
2994
2993
  getComponent(btnElement[i], 'dropdown-btn').destroy();
2995
- detach(select('button#' + btnElement[i].id, this.parent.element));
2994
+ detach(select('button#' + btnElement[i].id, parent.element));
2996
2995
  }
2997
2996
  else if (btnElement[i].classList.contains('e-btn')) {
2998
2997
  getComponent(btnElement[i], 'btn').destroy();
2999
- detach(select('button#' + btnElement[i].id, this.parent.element));
2998
+ detach(select('button#' + btnElement[i].id, parent.element));
3000
2999
  }
3001
3000
  }
3002
3001
  };