Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/design #34

Merged
merged 161 commits into from
Jul 11, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
5d26c93
feat: add design markup - 1
jinwoo-kim-nhn May 4, 2018
1a78ba5
changing: menu bar position change
jinwoo-kim-nhn May 4, 2018
5cf6b84
change markup ing
jinwoo-kim-nhn May 4, 2018
614fd8f
css for markup align left, right, bottom, top
jinwoo-kim-nhn May 8, 2018
9729357
markup middle commit
jinwoo-kim-nhn May 8, 2018
605acd0
feat add ui code
jinwoo-kim-nhn May 10, 2018
19c3ec3
add polyfill and ui class
jinwoo-kim-nhn May 11, 2018
3c0b090
feat: design - add ui middle commit
jinwoo-kim-nhn May 11, 2018
9c31204
feat: design add svg and layout
May 12, 2018
00439d2
change: design middle fixed svg iconf bug
May 12, 2018
d2dae9a
feat: crop menu for add design
jinwoo-kim-nhn May 14, 2018
b9c0d97
change sample style
jinwoo-kim-nhn May 14, 2018
bca7d6f
add color picker design 1
superlucky84 May 14, 2018
2dcc9bf
feat: design add rotate & flip & range control
jinwoo-kim-nhn May 15, 2018
b528822
feat: desing add Range bar
jinwoo-kim-nhn May 15, 2018
a90f560
feat: design - add colorpicker & shape menu
jinwoo-kim-nhn May 16, 2018
4b5bc38
fixed svg export
jinwoo-kim-nhn May 16, 2018
db4b865
fixed makesvg
jinwoo-kim-nhn May 16, 2018
d99c10a
feat: design for text menu and mask menu
jinwoo-kim-nhn May 17, 2018
833635d
add imagetracer
jinwoo-kim-nhn May 17, 2018
6fd6d5d
feat: design - code middle refactoring
May 17, 2018
0321c92
feat: design - add action
May 17, 2018
fd8df5d
feat: design - icon & draw
jinwoo-kim-nhn May 18, 2018
ee38a69
feat: design - code refectoring
jinwoo-kim-nhn May 18, 2018
63b4bea
feat: design - event action refactoring
jinwoo-kim-nhn May 18, 2018
fa08250
feat: design -
May 18, 2018
6b3d1e9
feat: design - css refactoring
May 19, 2018
5012248
feat: design - code refactoring
May 19, 2018
efb6732
action refactoring
May 19, 2018
08e8c81
feat: design - refactoring for action & reaction
May 19, 2018
ac18f6c
feat: design - filter
jinwoo-kim-nhn May 21, 2018
8ce76ea
feat: design - filter2 & add sample image
jinwoo-kim-nhn May 21, 2018
19b7236
feat: design - fixed range input
jinwoo-kim-nhn May 21, 2018
98494d4
feat: design - filter implement and refactoring
May 21, 2018
e453382
feat: design - explode template
May 22, 2018
2d0d1a3
feat: design - menu optional refactoring
May 22, 2018
8ffada9
feat: design - selctionControl and initload error
May 22, 2018
de26748
feat: design - refactoring
May 22, 2018
ab764e4
feat: design - colorpicker refactoring
May 22, 2018
766d20c
feat: design - filter menu refactoring
jinwoo-kim-nhn May 23, 2018
bee9a06
feat: design - filter refactoring2
jinwoo-kim-nhn May 23, 2018
27f0c5e
feat: design - add icon type c , disabeld icon action
May 23, 2018
e918c67
feat: design - Edit the details by menu
jinwoo-kim-nhn May 24, 2018
c2744c3
feat: design - control align at left, right position
jinwoo-kim-nhn May 24, 2018
07af033
feat: design - for left and right position bar
jinwoo-kim-nhn May 24, 2018
47d1695
feat: design - refactoring for action
May 24, 2018
0bd6fc5
feat: design - control align at position left & right
May 26, 2018
ea46d50
feat: design - add stylus config
May 26, 2018
2dab588
feat: design - add document
jinwoo-kim-nhn May 28, 2018
f7689fe
feat: design - add action test - 1
jinwoo-kim-nhn May 28, 2018
49c0c8c
feat: design - add test code
May 28, 2018
66f8a0b
feat: design - add test complete
May 28, 2018
b428950
feat: design - code clean up
jinwoo-kim-nhn May 29, 2018
83c5f06
feat: design - change code position
jinwoo-kim-nhn May 29, 2018
5677d8c
feat: design - change for test code
jinwoo-kim-nhn May 29, 2018
fe11f9b
feat: design-theme - theme job start
jinwoo-kim-nhn May 29, 2018
d069dab
feat: design-theme - middle commit
jinwoo-kim-nhn May 29, 2018
4846cb9
feat: design-theme - add stylemaker
May 29, 2018
6435e44
feat: design-theme add theme code cleanup
May 29, 2018
46a2863
feat: design-theme add style template
May 29, 2018
e79f054
feat: design-theme - add theme complete
jinwoo-kim-nhn May 30, 2018
f5ff9fb
feat: design - edit test code error
jinwoo-kim-nhn May 30, 2018
59ae1a5
feat: design - add stylus
jinwoo-kim-nhn May 30, 2018
16541e5
feat: design - fixed stylus.js
May 30, 2018
7d4e2cb
feat: design - fixed menu active bug
jinwoo-kim-nhn May 31, 2018
3def02a
feat: design - add ui test (theme, ui)
jinwoo-kim-nhn May 31, 2018
8a008af
feat: design - change stylus and bugfix
jinwoo-kim-nhn May 31, 2018
3aa2e87
feat: design - add range subbar
May 31, 2018
3fb49c1
feat: design - fixed mode change original bug
May 31, 2018
dcbe7db
fixed: action filter test
May 31, 2018
320e750
feat: design - apply code review
jinwoo-kim-nhn Jun 1, 2018
0996a5c
feat: design - apply code review
jinwoo-kim-nhn Jun 1, 2018
95aa6c7
feat: design - fixed example review
jinwoo-kim-nhn Jun 1, 2018
c8d2d84
feat: design - apply for codereview
jinwoo-kim-nhn Jun 1, 2018
4197980
feat: design - change theme style
Jun 2, 2018
baf9e7b
feat: design - apply code review (getter setter)
Jun 2, 2018
75aa79b
feat: design - apply codereview (range default value)
Jun 2, 2018
df5d208
apply code review
jinwoo-kim-nhn Jun 4, 2018
f6c0bba
chore: update readme - 1
jinwoo-kim-nhn Jun 4, 2018
00df494
Update representative image
jinwoo-kim-nhn Jun 4, 2018
582624e
Change representative image.
jinwoo-kim-nhn Jun 4, 2018
08d773d
update reade - middle grade
jinwoo-kim-nhn Jun 4, 2018
6c3d397
Update README.md
jinwoo-kim-nhn Jun 5, 2018
c1be888
Update Table of Contents
jinwoo-kim-nhn Jun 5, 2018
39959d7
chore: add - code of conduct
jinwoo-kim-nhn Jun 5, 2018
4bccad1
chore: add - contritute md
jinwoo-kim-nhn Jun 5, 2018
5887a4b
chore: read link update
jinwoo-kim-nhn Jun 5, 2018
31635ec
chore: readme - Table of Contents update
jinwoo-kim-nhn Jun 5, 2018
1019711
Move feature subtitle
jinwoo-kim-nhn Jun 5, 2018
e9cd465
feat: design - code refactoring
jinwoo-kim-nhn Jun 5, 2018
6a906da
fixed: icon and selection defalut option
Jun 5, 2018
c63ec5d
feat: design - change safed id name
Jun 5, 2018
30a03ca
corrected broken test
Jun 5, 2018
6366c86
apply codereview
Jun 5, 2018
d70b3dd
feat: design - fixed icon path and resize function
jinwoo-kim-nhn Jun 7, 2018
4d12fd3
feat: ui improvement start
jinwoo-kim-nhn Jun 8, 2018
6bede58
feat: shape, draw menu Improved usability.
jinwoo-kim-nhn Jun 11, 2018
2e070e8
middle commit
jinwoo-kim-nhn Jun 11, 2018
a65c61b
add icon add with resize
Jun 11, 2018
9c9f738
icon useable resize icon
Jun 11, 2018
3cff2e4
complete icon menu useable
jinwoo-kim-nhn Jun 12, 2018
694ba62
middle commit
jinwoo-kim-nhn Jun 12, 2018
322a05b
middle commit2
Jun 12, 2018
d8d25f5
fixed middlecommit 3
Jun 12, 2018
59f5b5d
fixed bug all
Jun 13, 2018
504fe05
refactoring icon action
Jun 13, 2018
80b3045
feat: group selction style & action for ui usable
jinwoo-kim-nhn Jun 14, 2018
9aa3f67
fixed: shape stroke limit maxsize
jinwoo-kim-nhn Jun 14, 2018
959258c
fixed: submenu transition and mask apply hidden
Jun 14, 2018
d46b595
fixed crop zone bug
Jun 14, 2018
58be310
fixed action test
Jun 14, 2018
5cd6b06
added big menu tooltip
jinwoo-kim-nhn Jun 15, 2018
ebc9292
crop zone Flicker removal.
jinwoo-kim-nhn Jun 15, 2018
cf932dd
fixed shape standard mode
jinwoo-kim-nhn Jun 15, 2018
e5792cd
fixed shpae change stanbymode bug and filter partition height
jinwoo-kim-nhn Jun 15, 2018
3a41377
added iconsize theme
jinwoo-kim-nhn Jun 15, 2018
6d0cc9b
add jsdoc
jinwoo-kim-nhn Jun 15, 2018
f7a650d
add jsdoc & editor-wrap style
jinwoo-kim-nhn Jun 15, 2018
0527890
add test code job - 1
jinwoo-kim-nhn Jun 15, 2018
f065c12
feat: design - ui useable - add test all
Jun 17, 2018
8f3ae35
fixed undo stack bug
Jun 17, 2018
866158c
broken test fixed
jinwoo-kim-nhn Jun 18, 2018
ba1e4f4
fixed broken test2
jinwoo-kim-nhn Jun 18, 2018
4ed8c4b
fixed broken test 3
jinwoo-kim-nhn Jun 18, 2018
040766a
fixed broken test - 4
jinwoo-kim-nhn Jun 18, 2018
140530c
apply ui review
Jun 18, 2018
e05f58f
fixed: added file cleanup and theme properties.
jinwoo-kim-nhn Jun 19, 2018
c9e429b
fixed typpo
jinwoo-kim-nhn Jun 19, 2018
5368e6e
apply codereview
jinwoo-kim-nhn Jun 19, 2018
80bad1f
add sample bg file
jinwoo-kim-nhn Jun 19, 2018
9b51ae1
fixed broken test
jinwoo-kim-nhn Jun 19, 2018
f8b5bf8
readme 개선 - 1
jinwoo-kim-nhn Jun 20, 2018
d60e2fb
chore: add docs
jinwoo-kim-nhn Jun 20, 2018
f8b5171
chore: features table expression
jinwoo-kim-nhn Jun 20, 2018
8185872
chore: readme main gif image grade up
jinwoo-kim-nhn Jun 20, 2018
7c254bf
fixed change
jinwoo-kim-nhn Jun 20, 2018
60d64da
apply codereview
jinwoo-kim-nhn Jun 20, 2018
be35abf
Merge pull request #38 from nhnent/feat/design-ui-useable
jinwoo-kim-nhn Jun 20, 2018
09a3236
fixed: top position colorpicker tooltip - 1
jinwoo-kim-nhn Jun 20, 2018
4d580c9
chore: Complete the contents of the wiki by reconstructing it.
jinwoo-kim-nhn Jun 21, 2018
700bd83
Merge branch 'feat/readme' of https://github.com/nhnent/tui.image-edi…
jinwoo-kim-nhn Jun 21, 2018
21b807d
fixed Additional translation missing parts.
jinwoo-kim-nhn Jun 21, 2018
70660b7
add test
jinwoo-kim-nhn Jun 21, 2018
b16a75e
fixed boken markdown
jinwoo-kim-nhn Jun 22, 2018
1cff85d
Update Basic-Tutorial.md
jinwoo-kim-nhn Jun 22, 2018
b956162
added filter feature
jinwoo-kim-nhn Jun 22, 2018
dd14d95
Update README.md
jinwoo-kim-nhn Jun 22, 2018
7e8fb5f
Fiexed Table of Contents
jinwoo-kim-nhn Jun 22, 2018
5db3351
chore: Example sequence and name change
jinwoo-kim-nhn Jun 22, 2018
0f64b8a
chore: tutorials and api links to the latest changes.
jinwoo-kim-nhn Jun 22, 2018
a289543
Merge branch 'feat/readme' into feat/design
jinwoo-kim-nhn Jun 22, 2018
da38d5a
feat/design - jsdoc Document reinforcement
jinwoo-kim-nhn Jun 22, 2018
313db0f
fixed colorpicker position bug when top menubar
jinwoo-kim-nhn Jun 22, 2018
50ebdfa
add theme style property bisize
jinwoo-kim-nhn Jun 22, 2018
4fc7b16
fixed jsdoc logo-url and change tagline message
jinwoo-kim-nhn Jun 22, 2018
42c78f9
fixed broken test
jinwoo-kim-nhn Jun 22, 2018
f9b9188
fixed broken test
jinwoo-kim-nhn Jun 26, 2018
d01a382
fixed download bug
jinwoo-kim-nhn Jul 9, 2018
991052c
fixed webpack config for css minifiled
jinwoo-kim-nhn Jul 9, 2018
3e595df
fixed saveAs bug
jinwoo-kim-nhn Jul 9, 2018
5ab706d
Add jsdoc for theme property
jinwoo-kim-nhn Jul 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
action refactoring
  • Loading branch information
jinwoo-kim-nhn authored and jinwoo-kim-nhn committed May 19, 2018
commit efb6732fa5f0593079f25dce5ba72f9462605b8c
5 changes: 4 additions & 1 deletion src/js/imageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ class ImageEditor {
}, option);

this.activeObjectId = null;
console.log(this);

/**
* Ui instance
* @type {Ui}
*/
this.ui = option.includeUi ? new Ui(wrapper, option.includeUi, new Action(this)) : null;
this.ui = option.includeUi ? new Ui(wrapper, option.includeUi, this.getActions()) : null;

/**
* Invoker
Expand Down Expand Up @@ -1280,5 +1281,7 @@ class ImageEditor {
}
}

Action.mixin(ImageEditor);
CustomEvents.mixin(ImageEditor);

module.exports = ImageEditor;
178 changes: 91 additions & 87 deletions src/js/ui/action.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,62 @@
import snippet from 'tui-code-snippet';
import Imagetracer from '../plugin/imagetracer';
export default class Action {
constructor(imageEditor) {
this._editorEventHandler(imageEditor);

export default {
mixin(ImageEditor) {
snippet.extend(ImageEditor.prototype, this);
},

getActions() {
return {
main: this.mainAction(imageEditor),
shape: this.shapeAction(imageEditor),
crop: this.cropAction(imageEditor),
flip: this.flipAction(imageEditor),
rotate: this.rotateAction(imageEditor),
text: this.textAction(imageEditor),
mask: this.maskAction(imageEditor),
draw: this.drawAction(imageEditor),
icon: this.iconAction(imageEditor)
main: this.mainAction(),
shape: this.shapeAction(),
crop: this.cropAction(),
flip: this.flipAction(),
rotate: this.rotateAction(),
text: this.textAction(),
mask: this.maskAction(),
draw: this.drawAction(),
icon: this.iconAction()
};
}
},

mainAction(imageEditor) {
mainAction() {
return {
initLoadImage: (imagePath, imageName) => {
imageEditor.loadImageFromURL(imagePath, imageName).then(sizeValue => {
imageEditor.ui.resizeEditor(sizeValue);
imageEditor.clearUndoStack();
this.loadImageFromURL(imagePath, imageName).then(sizeValue => {
this.ui.resizeEditor(sizeValue);
this.clearUndoStack();
});
},
modeChange: menu => {
switch (menu) {
case 'text':
imageEditor._changeActivateMode('TEXT');
this._changeActivateMode('TEXT');
break;
case 'crop':
imageEditor.startDrawingMode('CROPPER');
this.startDrawingMode('CROPPER');
break;
case 'shape':
imageEditor.setDrawingShape(imageEditor.ui.shape.type, imageEditor.ui.shape.options);
imageEditor.stopDrawingMode();
imageEditor._changeActivateMode('SHAPE');
this.setDrawingShape(this.ui.shape.type, this.ui.shape.options);
this.stopDrawingMode();
this._changeActivateMode('SHAPE');
break;
default:
imageEditor.stopDrawingMode();
this.stopDrawingMode();
break;
}
}
};
}
},

iconAction(imageEditor) {
iconAction() {
return {
changeColor: color => {
imageEditor.changeIconColor(imageEditor.activeObjectId, color);
this.changeIconColor(this.activeObjectId, color);
},
addIcon: iconType => {
imageEditor.once('mousedown', (e, originPointer) => {
imageEditor.addIcon(iconType, {
this.once('mousedown', (e, originPointer) => {
this.addIcon(iconType, {
left: originPointer.x,
top: originPointer.y
}).then(objectProps => {
Expand All @@ -63,7 +67,7 @@ export default class Action {
registDefalutIcons: (type, path) => {
const iconObj = {};
iconObj[type] = path;
imageEditor.registerIcons(iconObj);
this.registerIcons(iconObj);
},
registCustomIcon: (imgUrl, file) => {
const imagetracer = new Imagetracer();
Expand All @@ -73,8 +77,8 @@ export default class Action {
const [, svgPath] = svgstr.match(/path[^>]*d="([^"]*)"/);
const iconObj = {};
iconObj[file.name] = svgPath;
imageEditor.registerIcons(iconObj);
imageEditor.addIcon(file.name, {
this.registerIcons(iconObj);
this.addIcon(file.name, {
left: 100,
top: 100
}).then(objectProps => {
Expand Down Expand Up @@ -106,153 +110,153 @@ export default class Action {
);
}
};
}
},

drawAction(imageEditor) {
drawAction() {
return {
setDrawMode: (type, settings) => {
imageEditor.stopDrawingMode();
this.stopDrawingMode();
if (type === 'free') {
imageEditor.startDrawingMode('FREE_DRAWING', settings);
this.startDrawingMode('FREE_DRAWING', settings);
} else {
imageEditor.startDrawingMode('LINE_DRAWING', settings);
this.startDrawingMode('LINE_DRAWING', settings);
}
},
setColor: color => {
imageEditor.setBrush({
this.setBrush({
color
});
}
};
}
},

maskAction(imageEditor) {
maskAction() {
return {
loadImageFromURL: (imgUrl, file) => {
imageEditor.loadImageFromURL(imageEditor.toDataURL(), 'FilterImage').then(() => {
imageEditor.addImageObject(imgUrl).then(objectProps => {
this.loadImageFromURL(this.toDataURL(), 'FilterImage').then(() => {
this.addImageObject(imgUrl).then(objectProps => {
URL.revokeObjectURL(file);
console.log(objectProps);
});
});
},
applyFilter: () => {
imageEditor.applyFilter('mask', {
maskObjId: imageEditor.activeObjectId
this.applyFilter('mask', {
maskObjId: this.activeObjectId
}).then(result => {
console.log(result);
});
}
};
}
},

textAction(imageEditor) {
textAction() {
return {
changeTextStyle: styleObj => {
if (imageEditor.activeObjectId) {
imageEditor.changeTextStyle(imageEditor.activeObjectId, styleObj);
if (this.activeObjectId) {
this.changeTextStyle(this.activeObjectId, styleObj);
}
}
};
}
},

rotateAction(imageEditor) {
rotateAction() {
return {
rotate: angle => {
imageEditor.rotate(angle);
imageEditor.ui.resizeEditor();
this.rotate(angle);
this.ui.resizeEditor();
},
setAngle: angle => {
imageEditor.setAngle(angle);
imageEditor.ui.resizeEditor();
this.setAngle(angle);
this.ui.resizeEditor();
}
};
}
},

shapeAction(imageEditor) {
shapeAction() {
return {
changeShape: changeShapeObject => {
if (imageEditor.activeObjectId) {
imageEditor.changeShape(imageEditor.activeObjectId, changeShapeObject);
if (this.activeObjectId) {
this.changeShape(this.activeObjectId, changeShapeObject);
}
},
setDrawingShape: shapeType => {
imageEditor.setDrawingShape(shapeType);
this.setDrawingShape(shapeType);
}
};
}
},

cropAction(imageEditor) {
cropAction() {
return {
crop: () => {
imageEditor.crop(imageEditor.getCropzoneRect()).then(() => {
imageEditor.stopDrawingMode();
imageEditor.ui.resizeEditor();
imageEditor.ui.changeMenu('crop');
this.crop(this.getCropzoneRect()).then(() => {
this.stopDrawingMode();
this.ui.resizeEditor();
this.ui.changeMenu('crop');
});
},
cancel: () => {
imageEditor.stopDrawingMode();
imageEditor.ui.changeMenu('crop');
this.stopDrawingMode();
this.ui.changeMenu('crop');
}
};
}
},

flipAction(imageEditor) {
flipAction() {
return {
flip: flipType => {
imageEditor[flipType]().then(status => {
this[flipType]().then(status => {
console.log(status);
});
}
};
}
},

_editorEventHandler(imageEditor) {
imageEditor.on({
_editorEventHandler() {
this.on({
undoStackChanged: length => {
if (length) {
// $btnUndo.removeClass('disabled');
} else {
// $btnUndo.addClass('disabled');
}
imageEditor.ui.resizeEditor();
this.ui.resizeEditor();
},
objectActivated: obj => {
imageEditor.activeObjectId = obj.id;
this.activeObjectId = obj.id;

if (obj.type === 'cropzone') {
imageEditor.ui.crop._btnElement.apply.classList.add('active');
this.ui.crop._btnElement.apply.classList.add('active');
} else if (obj.type === 'rect' || obj.type === 'circle' || obj.type === 'triangle') {
imageEditor._changeActivateMode('SHAPE');
this._changeActivateMode('SHAPE');
const strokeColor = obj.stroke;
const {strokeWidth} = obj;
const fillColor = obj.fill;
imageEditor.ui.shape._btnElement.strokeRange.setValue(strokeWidth);
imageEditor.ui.shape._btnElement.strokeColorpicker.setColor(strokeColor);
imageEditor.ui.shape._btnElement.fillColorpicker.setColor(fillColor);
imageEditor.ui.shape.options.stroke = strokeColor;
imageEditor.ui.shape.options.fill = fillColor;
imageEditor.ui.shape.options.strokeWidth = strokeWidth;
this.ui.shape._btnElement.strokeRange.setValue(strokeWidth);
this.ui.shape._btnElement.strokeColorpicker.setColor(strokeColor);
this.ui.shape._btnElement.fillColorpicker.setColor(fillColor);
this.ui.shape.options.stroke = strokeColor;
this.ui.shape.options.fill = fillColor;
this.ui.shape.options.strokeWidth = strokeWidth;
} else if (obj.type === 'text') {
imageEditor._changeActivateMode('TEXT');
this._changeActivateMode('TEXT');
}
},
addText: pos => {
imageEditor.addText('Double Click', {
this.addText('Double Click', {
position: pos.originPosition
}).then(objectProps => {
console.log(objectProps);
});
},
mousedown: (event, originPointer) => {
if (imageEditor.ui.submenu && imageEditor.hasFilter('colorFilter')) {
imageEditor.applyFilter('colorFilter', {
if (this.ui.submenu && this.hasFilter('colorFilter')) {
this.applyFilter('colorFilter', {
x: parseInt(originPointer.x, 10),
y: parseInt(originPointer.y, 10)
});
}
}
});
}
}
};