Commit ac7ca4a60a3750cca715674ae59d41be0b749f4f
1 parent
afc65cdc72
Exists in
master
and in
1 other branch
fix
Showing 1 changed file with 21 additions and 28 deletions Side-by-side Diff
app/scripts/controllers/tshirtdesign.js
... | ... | @@ -513,38 +513,31 @@ |
513 | 513 | //Design text |
514 | 514 | $scope.inputText = function(e) { |
515 | 515 | currentObj = canvas.getActiveObject(); |
516 | - if(typeof currentObj == 'undefined' || currentObj == null) { | |
517 | - var _iText = new fabric.IText('', { | |
518 | - left: 150, | |
519 | - top: 200, | |
520 | - fontFamily: typeof $scope.itemFont != 'undefined' ? $scope.listFontFamily[$scope.itemFont].slug : $scope.listFontFamily[0].slug, | |
521 | - fontWeight: 'normal', | |
522 | - textAlign: 'center', | |
523 | - fontSize: 28, | |
524 | - fill: 'black', | |
525 | - editable: false | |
526 | - }); | |
527 | - } else { | |
528 | - if(currentObj.type != 'i-text') { | |
529 | - var _iText = new fabric.IText('', { | |
530 | - left: 150, | |
531 | - top: 200, | |
532 | - fontFamily: typeof $scope.itemFont != 'undefined' ? $scope.listFontFamily[$scope.itemFont].slug : $scope.listFontFamily[0].slug, | |
533 | - fontWeight: 'normal', | |
534 | - textAlign: 'center', | |
535 | - fontSize: 28, | |
536 | - fill: 'black', | |
537 | - editable: false | |
538 | - }); | |
539 | - } else{ | |
540 | - var _iText = currentObj; | |
541 | - } | |
516 | + var _iText = new fabric.IText('', { | |
517 | + left: 150, | |
518 | + top: 200, | |
519 | + fontFamily: typeof $scope.itemFont != 'undefined' ? $scope.listFontFamily[$scope.itemFont].slug : $scope.listFontFamily[0].slug, | |
520 | + fontWeight: 'normal', | |
521 | + textAlign: 'center', | |
522 | + fontSize: 28, | |
523 | + fill: 'black', | |
524 | + editable: false | |
525 | + }); | |
526 | + if(typeof currentObj != 'undefined' && currentObj != null) { | |
527 | + _iText.set({ | |
528 | + left: currentObj.left, | |
529 | + top: currentObj.top, | |
530 | + fontFamily: currentObj.fontFamily, | |
531 | + fontSize: currentObj.fontSize, | |
532 | + fill: currentObj.fill | |
533 | + }) | |
542 | 534 | } |
543 | 535 | |
544 | - _iText.set('text', e); | |
545 | - if(e.length > 1 && canvas.getActiveObject()) | |
536 | + | |
537 | + if(canvas.getActiveObject()) | |
546 | 538 | canvas.getActiveObject().remove(); |
547 | 539 | |
540 | + _iText.set('text', e); | |
548 | 541 | canvas.add(_iText); |
549 | 542 | canvas.setActiveObject(_iText); |
550 | 543 | canvas.renderAll(); |