Commit 1d6ddfa62a5df9074474072382595d1e2d607269

Authored by TRUONG
Exists in master and in 1 other branch develop

merge

Merge branch 'master' of timesfun.net:TRUONG/t-shats

Showing 21 changed files Side-by-side Diff

app/bower_components/bootstrap/.bower.json
... ... @@ -39,7 +39,7 @@
39 39 "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86"
40 40 },
41 41 "_source": "https://github.com/twbs/bootstrap.git",
42   - "_target": "~3.3.7",
  42 + "_target": "^3.3.7",
43 43 "_originalSource": "bootstrap"
44 44 }
app/bower_components/jquery/.bower.json
... ... @@ -20,7 +20,7 @@
20 20 "commit": "1b30f3ad466ebf2714d47eda34dbd7fdf6849fe3"
21 21 },
22 22 "_source": "https://github.com/jquery/jquery-dist.git",
23   - "_target": "~3.1.1",
  23 + "_target": "^3.1.1",
24 24 "_originalSource": "jquery"
25 25 }
... ... @@ -46,7 +46,7 @@
46 46 <script src="bower_components/json3/lib/json3.min.js"></script>
47 47 <![endif]-->
48 48 <script type="text/javascript">
49   - var VERSION = new Date().getTime();
  49 + var VERSION = '15-11_01';
50 50 var require = {
51 51 urlArgs: "ver="+VERSION,
52 52 };
app/scripts/controllers/main.js
... ... @@ -2,6 +2,8 @@
2 2 'use strict';
3 3 app.controller('MainCtrl', function ($rootScope, $scope, $illustration, $t_shirt) {
4 4 $scope.designFrameView = 'views/tshirt-design.html?ver='+VERSION;
  5 + $scope.designPartIllustration = 'views/design_part/illustration.html?ver='+VERSION;
  6 +
5 7 //Action T-Shirt choice color and Back or Front
6 8 $scope.tShirtColor = $t_shirt.getTShirtColor(0);
7 9 //Set color name default
... ... @@ -37,8 +39,8 @@
37 39  
38 40  
39 41 $scope.showIllustration = function(tab){
40   - $scope.isShowLeftPanel = tab;
41   - switch (tab){
  42 + $rootScope.isShowLeftPanel = tab;
  43 + switch (tab) {
42 44 case 'illustration': {
43 45 $scope.IllustrationList = $illustration.getAll();
44 46 $scope.illustrationSelectConfig = {
45 47  
... ... @@ -46,10 +48,24 @@
46 48 };
47 49 break;
48 50 }
49   - // case: ''
  51 + case 'text': {
  52 + break;
  53 + }
50 54 }
51 55 };
52 56  
  57 + //safeApply
  58 + $rootScope.safeApply = function(fn) {
  59 + var phase = this.$root.$$phase;
  60 + if(phase == '$apply' || phase == '$digest') {
  61 + if(fn && (typeof(fn) === 'function')) {
  62 + fn();
  63 + }
  64 + } else {
  65 + this.$apply(fn);
  66 + }
  67 + };
  68 +
53 69 $scope.modalTShirtDesign = function() {
54 70 $('#tshirt-design').modal(
55 71 {
... ... @@ -62,6 +78,8 @@
62 78 $scope.modalClose = function(){
63 79 $('#tshirt-design').modal('hide');
64 80 };
  81 +
  82 +
65 83  
66 84  
67 85 });
app/scripts/controllers/tshirtdesign.js
1 1 define(['app'], function (app) {
2   - 'use strict';
  2 + //'use strict';
3 3  
4 4 app.controller('TshirtdesignCtrl', function ($scope, $rootScope, $illustration) {
5   -
6 5 var canvas = new fabric.Canvas('main-design-container');
7 6 fabric.Object.prototype.transparentCorners = false;
8 7  
... ... @@ -13,8 +12,11 @@
13 12 'object:moving': onIllustrationChange,
14 13 'object:scaling': onIllustrationChange,
15 14 'object:rotating': onIllustrationChange,
16   - 'object:selected': onllustrationSelected,
17   - 'object:modified': onllustrationModifield
  15 + 'object:selected': onIllustrationSelected,
  16 + 'object:modified': onIllustrationModifield,
  17 + 'selected:deselected' : onIllustrationOut,
  18 + //'selected:out' : onIllustrationOut,
  19 + //'mouse:up' : onIllustrationOut,
18 20 });
19 21  
20 22 var currentObj;
21 23  
... ... @@ -47,10 +49,10 @@
47 49 refreshObj = true;
48 50 }
49 51  
50   - function onllustrationModifield(options){
  52 + function onIllustrationModifield(options){
51 53 var objOffset = canvas.getActiveObject().getBoundingRect();
52 54 var cH = canvas.height, cW = canvas.width, H0 = 50, W0 = 50;
53   - console.log(objOffset,canvas.height,canvas.width);
  55 + //console.log(objOffset,canvas.height,canvas.width);
54 56 if (objOffset.left<W0-objOffset.width || objOffset.left>cW-W0 || objOffset.top<H0-objOffset.height || objOffset.top>cH-H0){
55 57 if (confirm('削除してもよろしいですか')){
56 58 canvas.getActiveObject().remove();
57 59  
58 60  
... ... @@ -87,12 +89,13 @@
87 89 // if (obj === options.target) return;
88 90 // obj.setOpacity(options.target.intersectsWithObject(obj) ? 0.5 : 1);
89 91 // });
  92 +
90 93 }
91 94  
92   - function onllustrationSelected(options){
93   - //console.log(canvas.getActiveObject());
  95 + function onIllustrationOut() {
  96 + console.log('out object');
94 97 }
95   -
  98 +
96 99 function undoCanvas() {
97 100 if (indexCurr <= 0) {
98 101 indexCurr = 0;
99 102  
100 103  
... ... @@ -134,11 +137,32 @@
134 137 currentObj.setCoords();
135 138 canvas.renderAll();
136 139 }
  140 +
  141 + $scope.currentObject = null;
  142 + function onIllustrationSelected(options) {
  143 + var object = options.target;
  144 + $scope.typeObject = object.type;
  145 + switch ($scope.typeObject) {
  146 + case 'i-text' :
  147 + $('#input-design-text').focus();
  148 + $rootScope.isShowLeftPanel = 'text';
  149 + break;
137 150  
  151 + case 'path-group' :
  152 + $rootScope.isShowLeftPanel = 'illustration';
  153 + break;
  154 +
  155 + default :
  156 + $rootScope.isShowLeftPanel = 'default';
  157 + break;
  158 + }
  159 + $rootScope.safeApply();
  160 + }
  161 +
138 162 // Illustration process
139 163 $scope.changeIllustrationCategory = function(currentIllustration){
140 164 $scope.currentIllustrationCate = $illustration.getList(currentIllustration);
141   - console.log($scope.currentIllustrationCate);
  165 + //console.log($scope.currentIllustrationCate);
142 166 };
143 167  
144 168 $scope.insertSvg = function(item){
145 169  
146 170  
147 171  
... ... @@ -166,17 +190,22 @@
166 190 '#333333'
167 191 ];
168 192  
  193 + $scope.focusInputText = function() {
  194 + if($scope.typeObject != 'i-text')
  195 + $scope.iText = new fabric.IText('');
  196 + };
169 197  
170 198 //Design text
171 199 $scope.inputText = function(e) {
172   - var text = e;
173   - var iText = new fabric.IText(text);
  200 + var iText = $scope.iText;
  201 + iText.text = e;
174 202 canvas.add(iText);
175 203 canvas.renderAll();
176 204 canvas.setActiveObject(iText);
177   - }
  205 + };
178 206  
179   -
  207 + //init
  208 + //$scope.showIllustration('default');
180 209 });
181 210 });
... ... @@ -386,20 +386,22 @@
386 386  
387 387 /*Aside modal*/
388 388 .aside{
389   - padding-left: 0;
390 389 }
391   -.aside #choice-design-option{
  390 +
  391 +.aside .box-design-option{
392 392 list-style: none;
393 393 padding-left: 0;
394 394 margin-top: 10px;
  395 +}
  396 +.aside .box-design-option li{
395 397  
396 398 }
397   -.aside #choice-design-option li{
  399 +.aside .box-design-option li{
398 400 border: 1px solid #cdcdcd;
399 401 position: relative;
400 402 cursor: pointer;
401 403 }
402   -.aside #choice-design-option li .hover{
  404 +.aside .box-design-option li .hover{
403 405 background-color: #fddad4;
404 406 opacity: 0.6;
405 407 position: absolute;
406 408  
407 409  
408 410  
409 411  
410 412  
411 413  
412 414  
... ... @@ -407,55 +409,33 @@
407 409 height: 100%;
408 410 display: none;
409 411 }
410   -.aside #choice-design-option li:hover .hover{
  412 +.aside .box-design-option li:hover .hover{
411 413 display: block;
412 414 }
413 415  
414   -.aside #choice-design-option li .title{
  416 +.aside .box-design-option li .title{
415 417 background: url("../images/bg1.png") repeat #cdcdcd;
416 418 padding: 3px 10px;
417 419 }
418   -.aside #choice-design-option li .title i.fa{
  420 +.aside .box-design-option li .title i.fa{
419 421 color: #000000;
420 422 }
421 423  
422   -.aside #choice-design-option li .content{
  424 +.aside .box-design-option li .content{
423 425  
424 426 }
425   -.aside #choice-design-option li .content i.fa{
  427 +.aside .box-design-option li .content i.fa{
426 428 font-size: 30px;
427 429 color: #fe070f;
428 430 margin: 8px 0;
429 431 }
430   -.aside #choice-design-option li .content .des{
  432 +.aside .box-design-option li .content .des{
431 433 padding: 3px 10px 3px 0;
432 434 }
433 435  
434   -
435   -.aside #choice-illustration{
436   - list-style: none;
437   - padding-left: 0;
438   - margin-top: 10px;
439   -
440   -}
441   -.aside #choice-illustration li{
442   - border: 1px #cdcdcd double;
443   - border-radius: 5px;
444   - position: relative;
445   - padding: 5px 10px;
446   - margin-bottom: 20px;
447   -}
448   -
449   -.aside #choice-illustration li .title{
450   - /*background: url("../images/bg1.png") repeat #cdcdcd;*/
451   - padding: 3px 10px;
452   - font-size: 13px;
453   - color: #ff0f00;
454   - font-weight: 600;
455   -}
456   -
  436 +/*Design Choice Illustration*/
457 437 .aside #choice-illustration li .content {
458   - /*padding: 10px 10px;*/
  438 + padding: 10px 10px;
459 439 }
460 440  
461 441 .aside #choice-illustration li .content select{
462 442  
... ... @@ -470,14 +450,10 @@
470 450 }
471 451  
472 452 .aside #choice-illustration li .content .illustration-list .illstration-item{
473   - height: 61px;
  453 + height: 65px;
474 454 overflow: hidden;
475 455 float: left;
476   - margin-left: 10px;
477   - margin-top: 10px;
478   - background: #e2e2e2;
479   - border: #d7d7d7 solid 1px;
480   - padding: 2px;
  456 + margin-left: 5px;
481 457 }
482 458  
483 459 .aside #choice-illustration li .content .illustration-list .illstration-item:hover {
... ... @@ -485,7 +461,7 @@
485 461 }
486 462  
487 463 .aside #choice-illustration li .content .illustration-list .illstration-item img {
488   - width: 53px;
  464 + width: 62px;
489 465 cursor: pointer;
490 466 }
491 467  
app/views/design_part/default.html
  1 +<li>
  2 + <div class="hover"></div>
  3 + <div class="title">
  4 + <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
  5 + 文字を追加
  6 + </div>
  7 + <div class="content clearfix">
  8 + <div class="col-xs-2 text-center">
  9 + <i class="fa fa-jpy" aria-hidden="true"></i>
  10 + </div>
  11 + <div class="col-xs-10 des padding-left-0">
  12 + 書体を選んでお好きな文字を入力できます
  13 + </div>
  14 + </div>
  15 +</li>
  16 +<li>
  17 + <div class="hover"></div>
  18 + <div class="title">
  19 + <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
  20 + イラストやイメージを追加
  21 + </div>
  22 + <div class="content clearfix">
  23 + <div class="col-xs-2 text-center">
  24 + <i class="fa fa-btc" aria-hidden="true"></i>
  25 + </div>
  26 + <div class="col-xs-10 des padding-left-0">
  27 + 自由にお使いいただけるデザイン画像をご用意しました
  28 + </div>
  29 + </div>
  30 +</li>
  31 +<li>
  32 + <div class="hover"></div>
  33 + <div class="title">
  34 + <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
  35 + 自分の画像・写真を追加
  36 + </div>
  37 + <div class="content clearfix">
  38 + <div class="col-xs-2 text-center">
  39 + <i class="fa fa-jpy" aria-hidden="true"></i>
  40 + </div>
  41 + <div class="col-xs-10 des padding-left-0">
  42 + ご自分で用意した画像をアップロードして使えます
  43 + </div>
  44 + </div>
  45 +</li>
  46 +<li>
  47 + <div class="hover"></div>
  48 + <div class="title">
  49 + <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
  50 + おすすめデザインを使う
  51 + </div>
  52 + <div class="content clearfix">
  53 + <div class="col-xs-2 text-center">
  54 + <i class="fa fa-jpy" aria-hidden="true"></i>
  55 + </div>
  56 + <div class="col-xs-10 des padding-left-0">
  57 + おすすめデザインデータをご自由にカスタマイズしてお使いください
  58 + </div>
  59 + </div>
  60 +</li>
app/views/design_part/illustration.html
  1 +<li>
  2 + <div class="title">
  3 + <!--<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>-->
  4 + イラスト・イメージ選択
  5 + </div>
  6 + <div class="content clearfix">
  7 + <select id="illustration-select-category" ui-select2="illustrationSelectConfig" ng-model="currentIllustration" ng-change="changeIllustrationCategory(currentIllustration)" data-placeholder="Choose category" style="width: 100%">
  8 + <option ng-repeat="(key,cate) in IllustrationList" value="{{key}}">{{cate.name}}</option>
  9 + </select>
  10 + <div class="illustration-list">
  11 + <div class="illstration-item" ng-repeat="item in currentIllustrationCate.list" ng-click="insertSvg(item)">
  12 + <img ng-src="{{item.path}}"/>
  13 + </div>
  14 + <div class="clearfix"></div>
  15 + </div>
  16 + </div>
  17 +</li>
  18 +<li>
  19 + <div class="title">
  20 + <!--<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>-->
  21 + カラー変更
  22 + <div class="pull-right">元の色に戻す</div>
  23 + </div>
  24 + <div class="content clearfix">
  25 + <div class="color-patterns">
  26 + <div class="color-pattern-item" ng-repeat="color in listColorPatterns track by $index" ng-click="changeColorPattern(color)" ng-style="{'background-color': color}">
  27 + </div>
  28 + <div class="clearfix"></div>
  29 + </div>
  30 + </div>
  31 +</li>
  32 +<li>
  33 + <div class="title">
  34 + <!--<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>-->
  35 + 重ね順変更
  36 + </div>
  37 + <div class="content clearfix">
  38 +
  39 + </div>
  40 +</li>
app/views/design_part/text.html
... ... @@ -4,7 +4,7 @@
4 4 Text
5 5 </div>
6 6 <div class="content clearfix">
7   - <input type="text" class="form-control" ng-keyup="inputText(design_text)" ng-model="design_text">
  7 + <input type="text" class="form-control" id="input-design-text" ng-focus="focusInputText()" ng-keyup="inputText(design_text)" ng-model="design_text">
8 8 </div>
9 9 </li>
app/views/tshirt-design.html
... ... @@ -34,116 +34,14 @@
34 34 </header>
35 35 <section class="tshirt-design-container clearfix">
36 36 <div class="aside col-xs-4">
37   - <ul id="choice-design-option" ng-show="isShowLeftPanel=='default'">
38   - <li>
39   - <div class="hover"></div>
40   - <div class="title">
41   - <i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
42   - 文字を追加
43   - </div>
44   - <div class="content clearfix">
45   - <div class="col-xs-2 text-center">
46   - <i class="fa fa-jpy" aria-hidden="true"></i>
47   - </div>
48   - <div class="col-xs-10 des padding-left-0">
49   - 書体を選んでお好きな文字を入力できます
50   - </div>
51   - </div>
52   - </li>
53