Skip to content

Commit

Permalink
add polyfill and ui class
Browse files Browse the repository at this point in the history
  • Loading branch information
jinwoo-kim-nhn committed May 11, 2018
1 parent 605acd0 commit 19c3ec3
Show file tree
Hide file tree
Showing 12 changed files with 574 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore polyfill
src/js/polyfill.js
52 changes: 35 additions & 17 deletions examples/example00-design.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<meta charset="UTF-8">
<title>0. Design</title>
<link rel="stylesheet" href="img/icon/svg-bundle.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/svgxuse/1.2.6/svgxuse.js" integrity="sha256-TU+njGBu7T1DrfKgOBEH7kCKsl7UEvUNzpZaeUNNGi8=" crossorigin="anonymous"></script>
<style>

html, body {
height: 100%;
margin: 0;
Expand Down Expand Up @@ -91,21 +89,40 @@

.tui-image-editor-main-container .main {
position: absolute;
text-align: center;
top: 64px;
bottom: 0;
right: 0;
left: 0;
}
.tui-image-editor {
position: absolute;
display: inline-block;
transition: all .7s ease;
}

.tui-image-editor-main-container .main .sub-menu {
display: block;
display: none;
position: absolute;
border: 1px solid red;
bottom: 0;
width:100%;
height: 150px;
}

.tui-image-editor-main-container .main .sub-menu > div {
display: none;
vertical-align: middle;
}

.tui-image-editor-main-container .main .sub-menu.crop > div.crop {
display: table-cell;
}

.tui-image-editor-main-container .main .sub-menu.shape > div.shape {
display: table-cell;
}

.tui-image-editor-controls {
position: absolute;
background-color: #151515;
Expand Down Expand Up @@ -238,30 +255,25 @@
</html>
<body>

<div class="tui-image-editor-container">
</div>
<div class="tui-image-editor-container"></div>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.6.7/fabric.js"></script>
<script type="text/javascript" src="https://uicdn.toast.com/tui.code-snippet/v1.3.0/tui-code-snippet.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/nhnent/tui.component.colorpicker/1.0.2/dist/colorpicker.min.js"></script>
<script type="text/javascript" src="../dist/tui-image-editor.js"></script>
<script>
var $btnUndo = $('#btn-undo');
var $btnRedo = $('#btn-redo');

function resizeEditor() {
var $editor = $('.tui-image-editor');
var $container = $('.tui-image-editor-canvas-container');
var height = parseFloat($container.css('max-height'));

$editor.height(height);
}

// Image editor
var imageEditor = new tui.ImageEditor('.tui-image-editor-container', {
includeUi: true,
includeUi: {
loadImage: {
path: 'img/sampleImage.jpg',
name: 'SampleImage'
},
initMenu: 'shape',
menuBarPosition: 'bottom'
},
cssMaxWidth: 700,
cssMaxHeight: 500,
selectionStyle: {
Expand All @@ -270,6 +282,12 @@
}
});

window.onresize = function() {
imageEditor.ui.resizeEditor();
}



/*
imageEditor.on({
undoStackChanged: function(length) {
Expand Down
5 changes: 5 additions & 0 deletions examples/img/icon/ic-shape-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/img/icon/ic-shape-rectangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions examples/img/icon/ic-shape-triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 13 additions & 8 deletions examples/img/icon/svg-bundle.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
.svg_ic-crop,
.svg_ic-delete-all,
.svg_ic-delete,
.svg_ic-draw,
.svg_ic-crop,
.svg_ic-filter,
.svg_ic-mask,
.svg_ic-icon,
.svg_ic-rotate,
.svg_ic-shape,
.svg_ic-text,
.svg_ic-undo,
.svg_ic-mask,
.svg_ic-redo,
.svg_ic-reset,
.svg_ic-shape,
.svg_ic-rotate,
.svg_ic-flip,
.svg_ic-reset {
.svg_ic-text,
.svg_ic-undo {
width: 24px;
height: 24px;
}
.svg_ic-shape-circle,
.svg_ic-shape-rectangle,
.svg_ic-shape-triangle {
width: 32px;
height: 32px;
}
.svg_img-bi {
width: 257px;
height: 26px;
}


svg use {
display: none;
}
Expand Down
19 changes: 11 additions & 8 deletions examples/img/icon/svg-bundle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './js/polyfill';
import ImageEditor from './js/imageEditor';

// commands
Expand Down
Loading

0 comments on commit 19c3ec3

Please sign in to comment.