ding-image-editor 3.15.4 → 3.15.6

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.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for TOAST UI Image Editor v3.15.3
1
+ // Type definitions for TOAST UI Image Editor v3.15.5
2
2
  // TypeScript Version: 3.2.2
3
3
 
4
4
  declare namespace tuiImageEditor {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ding-image-editor",
3
- "version": "3.15.4",
3
+ "version": "3.15.6",
4
4
  "description": "TOAST UI ImageEditor",
5
5
  "keywords": [
6
6
  "nhn",
@@ -226,6 +226,13 @@ export default class Shape extends Component {
226
226
 
227
227
  this._bindEventOnShape(shapeObj);
228
228
 
229
+ shapeObj.hasControls = false;
230
+ shapeObj.hasBorders = false;
231
+
232
+ console.log('shapObe',shapeObj)
233
+ shapeObj.borderColor ='black'
234
+ console.log('shapObe',shapeObj)
235
+
229
236
  canvas.add(shapeObj).setActiveObject(shapeObj);
230
237
 
231
238
  this._resetPositionFillFilter(shapeObj);
@@ -488,6 +488,7 @@ class Text extends Component {
488
488
  * @private
489
489
  */
490
490
  _onFabricSelect(fEvent) {
491
+ console.log('ssssssss')
491
492
  this.isPrevEditing = true;
492
493
 
493
494
  this.setSelectedInfo(fEvent.target, true);
@@ -505,11 +506,11 @@ class Text extends Component {
505
506
  return;
506
507
  }
507
508
 
508
- if (this.isPrevEditing) {
509
- this.isPrevEditing = false;
509
+ // if (this.isPrevEditing) {
510
+ // this.isPrevEditing = false;
510
511
 
511
- return;
512
- }
512
+ // return;
513
+ // }
513
514
 
514
515
  this._fireAddText(fEvent);
515
516
  }
@@ -562,10 +562,30 @@ class Zoom extends Component {
562
562
  _onMouseMoveWithHandMode({ e }) {
563
563
  const canvas = this.getCanvas();
564
564
  const { x, y } = canvas.getPointer(e);
565
+
566
+
565
567
  const deltaX = x - this._startHandPoint.x;
566
568
  const deltaY = y - this._startHandPoint.y;
567
569
 
568
- this._movePointOfZoom({ x: deltaX, y: deltaY });
570
+ console.log('deltaX',deltaX)
571
+ console.log('deltaY',deltaY)
572
+
573
+ const canvasImage = this.getCanvasImage()
574
+ const bounding = canvasImage.getBoundingRect();
575
+ console.log( bounding)
576
+
577
+ const halfWidth = Math.floor(bounding.width/2);
578
+ const left = Math.floor(Math.abs(bounding.left))
579
+ if((bounding.left<0 && deltaX>0 && Math.abs(deltaX) > Math.abs(deltaY)) || (deltaX <0 && left< halfWidth && Math.abs(deltaX) > Math.abs(deltaY)) ){
580
+ this._movePointOfZoom({ x: deltaX, y: 0 });
581
+ }
582
+
583
+
584
+ const halfHeight = Math.floor(bounding.height/2);
585
+ const top = Math.floor(Math.abs(bounding.top))
586
+ if((bounding.top<0 && deltaY>0 && Math.abs(deltaX) < Math.abs(deltaY) ) ||(top<halfHeight && deltaY<0 && Math.abs(deltaX) < Math.abs(deltaY) ) ){
587
+ this._movePointOfZoom({ x: 0, y: deltaY });
588
+ }
569
589
  }
570
590
 
571
591
  /**
@@ -666,8 +686,8 @@ class Zoom extends Component {
666
686
  _addScrollBar() {
667
687
  const canvas = this.getCanvas();
668
688
 
669
- canvas.add(this._horizontalScroll);
670
- canvas.add(this._verticalScroll);
689
+ // canvas.add(this._horizontalScroll);
690
+ // canvas.add(this._verticalScroll);
671
691
 
672
692
  if (this.scrollBarTid) {
673
693
  clearTimeout(this.scrollBarTid);
@@ -132,6 +132,8 @@ class Graphics {
132
132
  */
133
133
  this._componentMap = {};
134
134
 
135
+ this._zoomLevel = 1;
136
+
135
137
  /**
136
138
  * fabric event handlers
137
139
  * @type {Object.<string, function>}
@@ -462,6 +464,7 @@ class Graphics {
462
464
  const zoom = this.getComponent(components.ZOOM);
463
465
 
464
466
  zoom.zoom({ x, y }, zoomLevel);
467
+ this._zoomLevel = zoomLevel
465
468
  }
466
469
 
467
470
  /**
@@ -584,9 +587,21 @@ class Graphics {
584
587
  canvasImage = this.canvasImage;
585
588
  }
586
589
 
587
- const { width, height } = canvasImage.getBoundingRect();
590
+ let { width, height } = canvasImage.getBoundingRect();
591
+
592
+ if(this._zoomLevel!==1){
593
+ width= width/this._zoomLevel
594
+ height= height/this._zoomLevel
595
+ }
596
+
597
+ console.log('adjustimage',width,height)
598
+
599
+ console.log('adjustmax',this.cssMaxWidth,this.cssMaxHeight)
600
+
601
+ // 修改了 _calcMaxDimension
588
602
  const maxDimension = this._calcMaxDimension(width, height);
589
603
 
604
+ console.log('maxDimension',maxDimension)
590
605
  this.setCanvasCssDimension({
591
606
  width: '100%',
592
607
  height: '100%', // Set height '' for IE9
@@ -1046,8 +1061,10 @@ class Graphics {
1046
1061
  _calcMaxDimension(width, height) {
1047
1062
  const wScaleFactor = this.cssMaxWidth / width;
1048
1063
  const hScaleFactor = this.cssMaxHeight / height;
1049
- let cssMaxWidth = Math.min(width, this.cssMaxWidth);
1050
- let cssMaxHeight = Math.min(height, this.cssMaxHeight);
1064
+ // let cssMaxWidth = Math.min(width, this.cssMaxWidth);
1065
+ // let cssMaxHeight = Math.min(height, this.cssMaxHeight);
1066
+ let cssMaxWidth = this.cssMaxWidth;
1067
+ let cssMaxHeight = this.cssMaxHeight;
1051
1068
 
1052
1069
  if (wScaleFactor < 1 && wScaleFactor < hScaleFactor) {
1053
1070
  cssMaxWidth = width * wScaleFactor;
@@ -972,6 +972,7 @@ class ImageEditor {
972
972
  * });
973
973
  */
974
974
  rotate(angle, isSilent) {
975
+ console.log('isSilent',isSilent)
975
976
  return this._rotate('rotate', angle, isSilent);
976
977
  }
977
978