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 ui useable #38

Merged
merged 37 commits into from
Jun 20, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
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
60d64da
apply codereview
jinwoo-kim-nhn Jun 20, 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
apply codereview
  • Loading branch information
jinwoo-kim-nhn committed Jun 20, 2018
commit 60d64dadecbeb9f91a7703f50c9b8e708e6a68c6
4 changes: 2 additions & 2 deletions examples/example03-theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
var imageEditor = new tui.ImageEditor('#tui-image-editor-container', {
includeUI: {
loadImage: {
path: 'img/sampleImage.jpg',
path: 'img/sampleImage2.png',
name: 'SampleImage'
},
theme: blackTheme, // or whiteTheme
initMenu: 'shape',
initMenu: 'filter',
menuBarPosition: 'bottom'
},
cssMaxWidth: 700,
Expand Down
2 changes: 1 addition & 1 deletion src/css/position.styl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
.{prefix}-checkbox-wrap.fixed-width
width: 182px;
white-space: normal;
.{prefix}-range-wrap.newline label.range
.{prefix}-range-wrap.{prefix}-newline label.range
display: block;
text-align: left;
width: 75%;
Expand Down
2 changes: 1 addition & 1 deletion src/css/range.styl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
background-color: #ccc;
.{prefix}-virtual-range-subbar
background-color: #606060;
.{prefix}-range-wrap.newline.short
.{prefix}-range-wrap.{prefix}-newline.short
margin-top: 0;
margin-left: 17px;
label
Expand Down
42 changes: 21 additions & 21 deletions src/css/submenu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
white-space: nowrap;
.{prefix}-button:hover svg > use.active
display: block;
.tui-image-editor-submenu-item
.{prefix}-submenu-item
li
display: inline-block;
vertical-align: top;
.newline
.{prefix}-newline
display: block;
margin-top: 14px;
.{prefix}-button
Expand Down Expand Up @@ -42,7 +42,7 @@
height: 52px;
border-left: 1px solid #3c3c3c;
margin: 0 12px 0 14px;
.{prefix}-main.tui-image-editor-menu-filter .tui-image-editor-partition > div
.{prefix}-main.{prefix}-menu-filter .{prefix}-partition > div
height: 108px;
margin: 0 29px 0 0px;
.{prefix}-submenu-align
Expand All @@ -55,25 +55,25 @@
margin-right: 0;
label
width: 70px;
.{prefix}-main.tui-image-editor-menu-crop .{prefix}-submenu > div.tui-image-editor-menu-crop,
.{prefix}-main.tui-image-editor-menu-flip .{prefix}-submenu > div.tui-image-editor-menu-flip,
.{prefix}-main.tui-image-editor-menu-rotate .{prefix}-submenu > div.tui-image-editor-menu-rotate,
.{prefix}-main.tui-image-editor-menu-shape .{prefix}-submenu > div.tui-image-editor-menu-shape,
.{prefix}-main.tui-image-editor-menu-text .{prefix}-submenu > div.tui-image-editor-menu-text,
.{prefix}-main.tui-image-editor-menu-mask .{prefix}-submenu > div.tui-image-editor-menu-mask,
.{prefix}-main.tui-image-editor-menu-icon .{prefix}-submenu > div.tui-image-editor-menu-icon,
.{prefix}-main.tui-image-editor-menu-draw .{prefix}-submenu > div.tui-image-editor-menu-draw,
.{prefix}-main.tui-image-editor-menu-filter .{prefix}-submenu > div.tui-image-editor-menu-filter
.{prefix}-main.{prefix}-menu-crop .{prefix}-submenu > div.{prefix}-menu-crop,
.{prefix}-main.{prefix}-menu-flip .{prefix}-submenu > div.{prefix}-menu-flip,
.{prefix}-main.{prefix}-menu-rotate .{prefix}-submenu > div.{prefix}-menu-rotate,
.{prefix}-main.{prefix}-menu-shape .{prefix}-submenu > div.{prefix}-menu-shape,
.{prefix}-main.{prefix}-menu-text .{prefix}-submenu > div.{prefix}-menu-text,
.{prefix}-main.{prefix}-menu-mask .{prefix}-submenu > div.{prefix}-menu-mask,
.{prefix}-main.{prefix}-menu-icon .{prefix}-submenu > div.{prefix}-menu-icon,
.{prefix}-main.{prefix}-menu-draw .{prefix}-submenu > div.{prefix}-menu-draw,
.{prefix}-main.{prefix}-menu-filter .{prefix}-submenu > div.{prefix}-menu-filter
display: table-cell;
.{prefix}-main.tui-image-editor-menu-crop,
.{prefix}-main.tui-image-editor-menu-flip,
.{prefix}-main.tui-image-editor-menu-rotate,
.{prefix}-main.tui-image-editor-menu-shape,
.{prefix}-main.tui-image-editor-menu-text,
.{prefix}-main.tui-image-editor-menu-mask,
.{prefix}-main.tui-image-editor-menu-icon,
.{prefix}-main.tui-image-editor-menu-draw,
.{prefix}-main.tui-image-editor-menu-filter
.{prefix}-main.{prefix}-menu-crop,
.{prefix}-main.{prefix}-menu-flip,
.{prefix}-main.{prefix}-menu-rotate,
.{prefix}-main.{prefix}-menu-shape,
.{prefix}-main.{prefix}-menu-text,
.{prefix}-main.{prefix}-menu-mask,
.{prefix}-main.{prefix}-menu-icon,
.{prefix}-main.{prefix}-menu-draw,
.{prefix}-main.{prefix}-menu-filter
.{prefix}-submenu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

프리픽스 매번 붙여줄 필요 없이 아래 함수 쓰면 될 것 같아요.

+prefix-classes(prefix)

display: table;

6 changes: 5 additions & 1 deletion src/js/component/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ class Icon extends Component {
* @type {Object}
*/
this._pathMap = pathMap;
// this.useDragAddIcon = graphics.useDragAddIcon;

/**
* Option to add icon to drag.
* @type {boolean}
*/
this.useDragAddIcon = graphics.useDragAddIcon;
}

Expand Down
21 changes: 10 additions & 11 deletions src/js/graphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ const backstoreOnly = {
* @ignore
*/
class Graphics {
constructor(element, {cssMaxWidth, cssMaxHeight, useItext = false, useDragAddIcon = false} = {}) {
constructor(element, {
cssMaxWidth,
cssMaxHeight,
useItext = false,
useDragAddIcon = false
} = {}) {
/**
* Fabric image instance
* @type {fabric.Image}
Expand All @@ -72,13 +77,13 @@ class Graphics {

/**
* Use Itext mode for text component
* @type {number}
* @type {boolean}
*/
this.useItext = useItext;

/**
* Use add drag icon mode for icon component
* @type {number}
* @type {boolean}
*/
this.useDragAddIcon = useDragAddIcon;

Expand Down Expand Up @@ -986,9 +991,7 @@ class Graphics {
* @private
*/
_onSelectionCreated(fEvent) {
const {target} = fEvent;

this.fire(events.SELECTION_CREATED, target);
this.fire(events.SELECTION_CREATED, fEvent.target);
}

/**
Expand All @@ -1007,11 +1010,7 @@ class Graphics {
changeSelectableAll(selectable) {
this._canvas.forEachObject(obj => {
obj.selectable = selectable;
if (selectable) {
obj.hoverCursor = 'move';
} else {
obj.hoverCursor = 'crosshair';
}
obj.hoverCursor = selectable ? 'move' : 'crosshair';
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/imageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class ImageEditor {
* @private
*/
_removeObjectStream(targetObjects) {
if (targetObjects.length === 0) {
if (!targetObjects.length) {
return true;
}

Expand Down
14 changes: 9 additions & 5 deletions src/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const SUB_UI_COMPONENT = {
Filter
};

const BI_EXPRESSION_MINSIZE_WHEN_TOP_POSITION = '1300';

/**
* Ui class
* @class
Expand Down Expand Up @@ -123,11 +125,12 @@ export default class Ui {
this._editorElementWrap.style.top = `${top}px`;
this._editorElementWrap.style.left = `${left}px`;
this._editorElementWrap.style.width = `calc(100% - ${right}px)`;
const selectElementClassList = this._selectedElement.classList;

if (menuBarPosition === 'top' && this._selectedElement.offsetWidth < 1235) {
this._selectedElement.classList.add('tui-image-editor-top-optimization');
if (menuBarPosition === 'top' && this._selectedElement.offsetWidth < BI_EXPRESSION_MINSIZE_WHEN_TOP_POSITION) {
selectElementClassList.add('tui-image-editor-top-optimization');
} else {
this._selectedElement.classList.remove('tui-image-editor-top-optimization');
selectElementClassList.remove('tui-image-editor-top-optimization');
}
}

Expand Down Expand Up @@ -226,8 +229,9 @@ export default class Ui {
* @private
*/
_setUiSize(uiSize = this.options.uiSize) {
this._selectedElement.style.width = uiSize.width;
this._selectedElement.style.height = uiSize.height;
const elementDimension = this._selectedElement.style;
elementDimension.width = uiSize.width;
elementDimension.height = uiSize.height;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/template/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default ({
${subMenuLabelActive}
}
.tui-image-editor-container .tui-image-editor-submenu .tui-image-editor-button > label,
.tui-image-editor-container .tui-image-editor-range-wrap.newline.short label {
.tui-image-editor-container .tui-image-editor-range-wrap.tui-image-editor-newline.short label {
${subMenuLabelNormal}
}
.tui-image-editor-container .tui-image-editor-range-wrap label {
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/template/submenu/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default ({iconStyle: {normal, active}}) => (`
<li class="tui-image-editor-partition only-left-right">
<div></div>
</li>
<li class="newline tui-image-editor-range-wrap">
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
<label class="range">Range</label>
<div id="tie-draw-range"></div>
<input id="tie-draw-range-value" class="tui-image-editor-range-value" value="0" />
Expand Down
12 changes: 6 additions & 6 deletions src/js/ui/template/submenu/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ export default () => (`
<label for="tie-remove-white">Remove White</label>
</div>
</div>
<div class="newline tui-image-editor-range-wrap short">
<div class="tui-image-editor-newline tui-image-editor-range-wrap short">
<label>Threshold</label>
<div id="tie-removewhite-threshold-range"></div>
</div>
<div class="newline tui-image-editor-range-wrap short">
<div class="tui-image-editor-newline tui-image-editor-range-wrap short">
<label>Distance</label>
<div id="tie-removewhite-distance-range"></div>
</div>
</div>
<div>
<div class="newline tui-image-editor-checkbox-wrap">
<div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">
<div class="tui-image-editor-checkbox">
<input type="checkbox" id="tie-gradient-transparency">
<label for="tie-gradient-transparency">Grayscale</label>
</div>
</div>
<div class="newline tui-image-editor-range-wrap short">
<div class="tui-image-editor-newline tui-image-editor-range-wrap short">
<label>Value</label>
<div id="tie-gradient-transparency-range"></div>
</div>
Expand Down Expand Up @@ -98,13 +98,13 @@ export default () => (`
</div>
</div>
<div>
<div class="newline tui-image-editor-checkbox-wrap">
<div class="tui-image-editor-newline tui-image-editor-checkbox-wrap">
<div class="tui-image-editor-checkbox">
<input type="checkbox" id="tie-color-filter">
<label for="tie-color-filter">Color Filter</label>
</div>
</div>
<div class="newline tui-image-editor-range-wrap short">
<div class="tui-image-editor-newline tui-image-editor-range-wrap short">
<label>Threshold</label>
<div id="tie-colorfilter-threshole-range"></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/template/submenu/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default ({iconStyle: {normal, active}}) => (`
<li class="tui-image-editor-partition only-left-right">
<div></div>
</li>
<li id="tie-mask-apply" class="newline apply">
<li id="tie-mask-apply" class="tui-image-editor-newline apply">
<div class="tui-image-editor-button apply">
<svg class="svg_ic-menu">
<use xlink:href="${normal.path}#${normal.name}-ic-apply" class="normal"/>
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/template/submenu/rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default ({iconStyle: {normal, active}}) => (`
<li class="tui-image-editor-partition only-left-right">
<div></div>
</li>
<li class="newline tui-image-editor-range-wrap">
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
<label class="range">Range</label>
<div id="tie-rotate-range"></div>
<input id="tie-ratate-range-value" class="tui-image-editor-range-value" value="0" />
Expand Down
2 changes: 1 addition & 1 deletion src/js/ui/template/submenu/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default ({iconStyle: {normal, active}}) => (`
<li class="tui-image-editor-partition only-left-right">
<div></div>
</li>
<li class="newline tui-image-editor-range-wrap">
<li class="tui-image-editor-newline tui-image-editor-range-wrap">
<label class="range">Text size</label>
<div id="tie-text-range"></div>
<input id="tie-text-range-value" class="tui-image-editor-range-value" value="0" />
Expand Down