Skip to content

Commit 8b5cdaf

Browse files
committed
Merge branch 'master' into production
# Conflicts: # apps/image-editor/index.d.ts # apps/image-editor/package-lock.json # apps/react-image-editor/package-lock.json
2 parents 3bf91a4 + 2646ce4 commit 8b5cdaf

39 files changed

+29676
-28466
lines changed

apps/image-editor/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for TOAST UI Image Editor v3.13.0
1+
// Type definitions for TOAST UI Image Editor v3.14.0
22
// TypeScript Version: 3.2.2
33

44
declare namespace tuiImageEditor {

apps/image-editor/package-lock.json

Lines changed: 28422 additions & 28422 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/image-editor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tui-image-editor",
33
"author": "NHN. FE Development Lab <[email protected]>",
4-
"version": "3.13.0",
4+
"version": "3.14.0",
55
"license": "MIT",
66
"repository": {
77
"type": "git",

apps/image-editor/src/css/buttons.styl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,14 @@
7979
cursor: inherit;
8080
left: 0;
8181
top: 0;
82+
83+
84+
/* FLIP BUTTON */
85+
.tie-zoom-button
86+
&.resetFlip .{prefix}-button.resetFlip,
87+
&.flipX .{prefix}-button.flipX,
88+
&.flipY .{prefix}-button.flipY
89+
svg > use.normal
90+
display: none;
91+
svg > use.active
92+
display: block;

apps/image-editor/src/css/icon.styl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
display: block;
2323
.active svg:hover > use.hover
2424
display: none;
25+
.on svg > use.hover,
2526
.opened svg > use.hover
2627
display: block;
2728
svg > use.normal

apps/image-editor/src/css/position.styl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
.{prefix}-help-menu
163163
&.top
164164
white-space: nowrap;
165-
width: 340px;
165+
width: 506px;
166166
height: 40px;
167167
top: 8px;
168168
left: 50%;
@@ -197,7 +197,7 @@
197197
.{prefix}-help-menu
198198
&.bottom
199199
white-space: nowrap;
200-
width: 340px;
200+
width: 506px;
201201
height: 40px;
202202
bottom: 8px;
203203
left: 50%;
@@ -235,7 +235,7 @@
235235
&.left
236236
white-space: inherit;
237237
width: 40px;
238-
height: 340px;
238+
height: 506px;
239239
left: 8px;
240240
top: 50%;
241241
transform: translateY(-50%);
@@ -274,7 +274,7 @@
274274
&.right
275275
white-space: inherit;
276276
width: 40px;
277-
height: 340px;
277+
height: 506px;
278278
right: 8px;
279279
top: 50%;
280280
transform: translateY(-50%);

apps/image-editor/src/css/submenu.styl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
.{prefix}-main.{prefix}-menu-mask .{prefix}-submenu > div.{prefix}-menu-mask,
7575
.{prefix}-main.{prefix}-menu-icon .{prefix}-submenu > div.{prefix}-menu-icon,
7676
.{prefix}-main.{prefix}-menu-draw .{prefix}-submenu > div.{prefix}-menu-draw,
77-
.{prefix}-main.{prefix}-menu-filter .{prefix}-submenu > div.{prefix}-menu-filter
77+
.{prefix}-main.{prefix}-menu-filter .{prefix}-submenu > div.{prefix}-menu-filter,
78+
.{prefix}-main.{prefix}-menu-zoom .{prefix}-submenu > div.{prefix}-menu-zoom
7879
display: table-cell;
7980
.{prefix}-main.{prefix}-menu-crop,
8081
.{prefix}-main.{prefix}-menu-flip,
@@ -84,7 +85,8 @@
8485
.{prefix}-main.{prefix}-menu-mask,
8586
.{prefix}-main.{prefix}-menu-icon,
8687
.{prefix}-main.{prefix}-menu-draw,
87-
.{prefix}-main.{prefix}-menu-filter
88+
.{prefix}-main.{prefix}-menu-filter,
89+
.{prefix}-main.{prefix}-menu-zoom
8890
.{prefix}-submenu
8991
display: table;
9092

apps/image-editor/src/js/action.js

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { extend } from 'tui-code-snippet';
22
import Imagetracer from '@/helper/imagetracer';
33
import { isSupportFileApi, base64ToBlob, toInteger, isEmptyCropzone } from '@/util';
4-
import { eventNames, historyNames } from '@/consts';
4+
import { eventNames, historyNames, drawingModes, drawingMenuNames, zoomModes } from '@/consts';
55

66
export default {
77
/**
@@ -53,6 +53,28 @@ export default {
5353

5454
return result;
5555
};
56+
const toggleZoomMode = () => {
57+
const zoomMode = this._graphics.getZoomMode();
58+
59+
this.stopDrawingMode();
60+
if (zoomMode !== zoomModes.ZOOM) {
61+
this.startDrawingMode(drawingModes.ZOOM);
62+
this._graphics.startZoomInMode();
63+
} else {
64+
this._graphics.endZoomInMode();
65+
}
66+
};
67+
const toggleHandMode = () => {
68+
const zoomMode = this._graphics.getZoomMode();
69+
70+
this.stopDrawingMode();
71+
if (zoomMode !== zoomModes.HAND) {
72+
this.startDrawingMode(drawingModes.ZOOM);
73+
this._graphics.startHandMode();
74+
} else {
75+
this._graphics.endHandMode();
76+
}
77+
};
5678

5779
return extend(
5880
{
@@ -136,6 +158,20 @@ export default {
136158
history: (event) => {
137159
this.ui.toggleHistoryMenu(event);
138160
},
161+
zoomIn: () => {
162+
this.ui.toggleZoomButtonStatus('zoomIn');
163+
this.deactivateAll();
164+
toggleZoomMode();
165+
},
166+
zoomOut: () => {
167+
this._graphics.zoomOut();
168+
},
169+
hand: () => {
170+
this.ui.offZoomInButtonStatus();
171+
this.ui.toggleZoomButtonStatus('hand');
172+
this.deactivateAll();
173+
toggleHandMode();
174+
},
139175
},
140176
this._commonAction()
141177
);
@@ -523,19 +559,24 @@ export default {
523559
* @private
524560
*/
525561
_commonAction() {
562+
const { TEXT, CROPPER, SHAPE, ZOOM } = drawingModes;
563+
526564
return {
527565
modeChange: (menu) => {
528566
switch (menu) {
529-
case 'text':
530-
this._changeActivateMode('TEXT');
567+
case drawingMenuNames.TEXT:
568+
this._changeActivateMode(TEXT);
531569
break;
532-
case 'crop':
533-
this.startDrawingMode('CROPPER');
570+
case drawingMenuNames.CROP:
571+
this.startDrawingMode(CROPPER);
534572
break;
535-
case 'shape':
536-
this._changeActivateMode('SHAPE');
573+
case drawingMenuNames.SHAPE:
574+
this._changeActivateMode(SHAPE);
537575
this.setDrawingShape(this.ui.shape.type, this.ui.shape.options);
538576
break;
577+
case drawingMenuNames.ZOOM:
578+
this.startDrawingMode(ZOOM);
579+
break;
539580
default:
540581
break;
541582
}

0 commit comments

Comments
 (0)