Commit 2b8b72c83a04238d52dcc9ad18047d5b6ea6ae3a

Authored by unknown
1 parent 2decd299

Commit Changes

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -2941,7 +2941,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -2941,7 +2941,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2941 break; 2941 break;
2942 } 2942 }
2943 } 2943 }
2944 - 2944 + $rootScope.iniiaTextAreaValues = [];
  2945 + $rootScope.initTextAreaValues = [];
2945 ///----- 2946 ///-----
2946 $rootScope.saveText = function () { 2947 $rootScope.saveText = function () {
2947 2948
@@ -2976,12 +2977,59 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -2976,12 +2977,59 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
2976 $rootScope.underlineText = $("#text_area").css("text-decoration"); 2977 $rootScope.underlineText = $("#text_area").css("text-decoration");
2977 $rootScope.textArea = $("#text_area").val(); 2978 $rootScope.textArea = $("#text_area").val();
2978 2979
  2980 +
  2981 + // code for horizonatl text going out
  2982 + if (/\s/.test($rootScope.textArea)) {
  2983 +
  2984 + }
  2985 + else
  2986 + {
  2987 + var contentWidthArray = [];
  2988 + var contentWidth = Math.abs($rootScope.rectDimension[$rootScope.rectDimension.length - 1].width);
  2989 + $("#atTextDiv").css({ "width": contentWidth, "font-size": $rootScope.fontSizes});
  2990 + var text = $rootScope.textArea;
  2991 + $("#textspan").empty();
  2992 + $("#duptextspan").empty();
  2993 + for (var i = 0; i <= text.length - 1; i++) {
  2994 + if (contentWidthArray.length > 0) {
  2995 + if (parseInt(contentWidthArray[0]) < $("#atTextDiv").width()) {
  2996 + $("#duptextspan").append(text[i]);
  2997 + $("#textspan").append(text[i]);
  2998 + contentWidthArray = [];
  2999 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3000 + }
  3001 + else {
  3002 + contentWidthArray = [];
  3003 + $("#duptextspan").append("\r\n");
  3004 + $("#textspan").append("\r\n");
  3005 + $("#duptextspan").append(text[i]);
  3006 + $("#textspan").text('');
  3007 + $("#textspan").append(text[i]);
  3008 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3009 +
  3010 + }
  3011 + }
  3012 + else {
  3013 + $("#duptextspan").text(text[i]);
  3014 + $("#textspan").text(text[i]);
  3015 + contentWidthArray = [];
  3016 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3017 + }
  3018 + }
  3019 + $rootScope.textArea = $("#duptextspan").text();
  3020 + console.log($rootScope.textArea);
  3021 + }
  3022 + // code for horizonatl text going out
  3023 +
  3024 +
  3025 +
  3026 +
2979 // deleting previous text area 3027 // deleting previous text area
2980 $("#canvas").removeLayer($rootScope.TextID).drawLayers(); 3028 $("#canvas").removeLayer($rootScope.TextID).drawLayers();
2981 $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers(); 3029 $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers();
2982 // Text After Saving in Rectangle 3030 // Text After Saving in Rectangle
2983 $rootScope.resetTextRect = $rootScope.ObjectIndex++; 3031 $rootScope.resetTextRect = $rootScope.ObjectIndex++;
2984 - 3032 +
2985 $('#canvas').drawRect({ 3033 $('#canvas').drawRect({
2986 name: 'TextArea1_' + $rootScope.resetTextRect, 3034 name: 'TextArea1_' + $rootScope.resetTextRect,
2987 layer: true, 3035 layer: true,
@@ -3001,6 +3049,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3001,6 +3049,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3001 var TextAreaLayerName = layer.name; 3049 var TextAreaLayerName = layer.name;
3002 var TextAreaLayerNameAftrSplit = TextAreaLayerName.split("_"); 3050 var TextAreaLayerNameAftrSplit = TextAreaLayerName.split("_");
3003 $rootScope.postFixLayerNumber = TextAreaLayerNameAftrSplit[1]; 3051 $rootScope.postFixLayerNumber = TextAreaLayerNameAftrSplit[1];
  3052 + $rootScope.iniiaTextAreaValues.push({ "name": layer.name, "width": layer.width, "height": layer.height });
3004 if ($location.path() == "/module-item-view") { 3053 if ($location.path() == "/module-item-view") {
3005 $rootScope.initialTextAreaName = layer.name; 3054 $rootScope.initialTextAreaName = layer.name;
3006 $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height }); 3055 $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height });
@@ -3058,7 +3107,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3058,7 +3107,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3058 3107
3059 var _rectLayerOnSave = layer.name; 3108 var _rectLayerOnSave = layer.name;
3060 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); 3109 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
3061 - var TextAreaRectName = "TextAreaNew_"; 3110 + var TextAreaRectName = "TextAreaNew_";
3062 var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); 3111 var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]);
3063 3112
3064 $rootScope.layerNameArr = layer.name; 3113 $rootScope.layerNameArr = layer.name;
@@ -3071,6 +3120,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3071,6 +3120,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3071 if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { 3120 if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) {
3072 3121
3073 var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; 3122 var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text;
  3123 + // this line of code replace the line breaks and convert into a single line.
  3124 + textArrVal = textArrVal.replace(/(\r\n)/gm, "");
  3125 +
3074 $("#text_area").val(textArrVal); 3126 $("#text_area").val(textArrVal);
3075 var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; 3127 var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle;
3076 var fontWeightProp = fontStyleProp.split(" "); 3128 var fontWeightProp = fontStyleProp.split(" ");
@@ -3245,13 +3297,27 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3245,13 +3297,27 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3245 console.log(layer.x + " " + layer.y); 3297 console.log(layer.x + " " + layer.y);
3246 console.log($rootScope.textXAxisAftrResize + " " + $rootScope.textYAxisAftrResize); 3298 console.log($rootScope.textXAxisAftrResize + " " + $rootScope.textYAxisAftrResize);
3247 $rootScope.isTextAReaRectangleClicked = false; 3299 $rootScope.isTextAReaRectangleClicked = false;
3248 - //if ((layer.x > $rootScope.textXAxisAftrResize) && (layer.y > $rootScope.textYAxisAftrResize) || (layer.x == $rootScope.textXAxisAftrResize) && (layer.y > $rootScope.textYAxisAftrResize) || (layer.x > $rootScope.textXAxisAftrResize) && (layer.y == $rootScope.textYAxisAftrResize)) {  
3249 - var CangedTextAreaName = 'TextAreaNew_' + $rootScope.postFixLayerNumber;  
3250 - $('#canvas').setLayer(CangedTextAreaName, {  
3251 - x: layer.x,  
3252 - y: layer.y  
3253 - });  
3254 - //} 3300 + for (var i = 0; i <= $rootScope.iniiaTextAreaValues.length-1; i++) {
  3301 +
  3302 + if ($rootScope.iniiaTextAreaValues[i].name == layer.name) {
  3303 +
  3304 + if (($rootScope.iniiaTextAreaValues[i].width == layer.width) || ($rootScope.iniiaTextAreaValues[i].height == layer.height))
  3305 + {
  3306 + }
  3307 + else
  3308 + {
  3309 + var textAreaName = layer.name;
  3310 + var textAreaNameAftrSplit = textAreaName.split("_");
  3311 + var CangedTextAreaName = 'TextAreaNew_' + textAreaNameAftrSplit[1];
  3312 + $('#canvas').setLayer(CangedTextAreaName, {
  3313 + x: layer.x,
  3314 + y: layer.y
  3315 + });
  3316 + }
  3317 + }
  3318 +
  3319 + }
  3320 +
3255 $rootScope.textXAxisAftrResize = layer.x; 3321 $rootScope.textXAxisAftrResize = layer.x;
3256 $rootScope.textYAxisAftrResize = layer.y; 3322 $rootScope.textYAxisAftrResize = layer.y;
3257 3323
@@ -3294,7 +3360,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3294,7 +3360,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3294 3360
3295 //$rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' }); 3361 //$rootScope.TextPropertyArray.push({ Text1: '', Align: '', FontColor: '', FontSize: '', FontStyle: '', FontFamily: '' });
3296 $rootScope.TextPropertyArray.push({ layerName: layer.name, Rect_Text: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText }); 3362 $rootScope.TextPropertyArray.push({ layerName: layer.name, Rect_Text: layer.text, Align: layer.align, FontColor: layer.fillStyle, FontSize: layer.fontSize, FontStyle: layer.fontStyle, FontFamily: layer.fontFamily, TextDecoration: $rootScope.underlineText });
  3363 + },
  3364 + dblclick: function (layer) {
  3365 +
3297 } 3366 }
  3367 +
3298 }); 3368 });
3299 $("#text_area").val(''); 3369 $("#text_area").val('');
3300 $("#text_area").css({ " font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); 3370 $("#text_area").css({ " font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" });
@@ -3350,7 +3420,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3350,7 +3420,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3350 3420
3351 // deleting previous textarea 3421 // deleting previous textarea
3352 3422
  3423 +
  3424 + // code for horizonatl text going out
  3425 + if (/\s/.test(_modifiedText)) {
  3426 +
  3427 + }
  3428 + else {
  3429 + var contentWidthArray = [];
  3430 + var contentWidth = Math.abs($rootScope.rectDimension[$rootScope.rectDimension.length - 1].width);
  3431 + $("#atTextDiv").css({ "width": contentWidth, "font-size": _modifiedFontSize });
  3432 + var text = _modifiedText;
  3433 + $("#textspan").empty();
  3434 + $("#duptextspan").empty();
  3435 + for (var i = 0; i <= text.length - 1; i++) {
  3436 + if (contentWidthArray.length > 0) {
  3437 + if (parseInt(contentWidthArray[0]) < $("#atTextDiv").width()) {
  3438 + $("#duptextspan").append(text[i]);
  3439 + $("#textspan").append(text[i]);
  3440 + contentWidthArray = [];
  3441 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3442 + }
  3443 + else {
  3444 + contentWidthArray = [];
  3445 + $("#duptextspan").append("\r\n");
  3446 + $("#textspan").append("\r\n");
  3447 + $("#duptextspan").append(text[i]);
  3448 + $("#textspan").text('');
  3449 + $("#textspan").append(text[i]);
  3450 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3451 +
  3452 + }
  3453 + }
  3454 + else {
  3455 + $("#duptextspan").text(text[i]);
  3456 + $("#textspan").text(text[i]);
  3457 + contentWidthArray = [];
  3458 + contentWidthArray.push(Math.ceil($("#textspan").width()));
  3459 + }
  3460 + }
  3461 + _modifiedText = $("#duptextspan").text();
  3462 + console.log(_modifiedText);
  3463 + }
  3464 + // code for horizonatl text going out
3353 3465
  3466 +
3354 $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers(); 3467 $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers();
3355 $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers(); 3468 $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers();
3356 3469
@@ -3379,6 +3492,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3379,6 +3492,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3379 var TextAreaLayerName = layer.name; 3492 var TextAreaLayerName = layer.name;
3380 var TextAreaLayerNameAftrSplit = TextAreaLayerName.split("_"); 3493 var TextAreaLayerNameAftrSplit = TextAreaLayerName.split("_");
3381 $rootScope.postFixLayerNumberAftrEdit = TextAreaLayerNameAftrSplit[1]; 3494 $rootScope.postFixLayerNumberAftrEdit = TextAreaLayerNameAftrSplit[1];
  3495 + $rootScope.initTextAreaValues.push({ "name": layer.name, "width": layer.width, "height": layer.height });
3382 if ($location.path() == "/module-item-view") { 3496 if ($location.path() == "/module-item-view") {
3383 $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height }); 3497 $rootScope.jcanvasObjectArray.push({ "name": layer.name, "x": layer.x, "y": layer.y, "width": layer.width, "height": layer.height });
3384 } 3498 }
@@ -3442,6 +3556,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3442,6 +3556,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3442 $rootScope.rectTextArr = RectNameAfterEditResult; 3556 $rootScope.rectTextArr = RectNameAfterEditResult;
3443 3557
3444 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); 3558 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
  3559 + // this line of code replace the line breaks and convert into a single line.
  3560 + _modifiedText = _modifiedText.replace(/(\r\n)/gm, "");
3445 $("#text_area").val(_modifiedText); 3561 $("#text_area").val(_modifiedText);
3446 $("#text_area").css("font-size", _modifiedFontSize); 3562 $("#text_area").css("font-size", _modifiedFontSize);
3447 $("#text_area").css("font-weight", _modifiedFontWeight); 3563 $("#text_area").css("font-weight", _modifiedFontWeight);
@@ -3555,7 +3671,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3555,7 +3671,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3555 fillStyle: '#fff', 3671 fillStyle: '#fff',
3556 strokeStyle: '#c33', 3672 strokeStyle: '#c33',
3557 strokeWidth: 2, 3673 strokeWidth: 2,
3558 - width: 10, height: 10, 3674 + width: 5, height: 5,
3559 cornerRadius: 3, 3675 cornerRadius: 3,
3560 click: function () { 3676 click: function () {
3561 $rootScope.isTextAReaRectangleClickedAftrEdit = true; 3677 $rootScope.isTextAReaRectangleClickedAftrEdit = true;
@@ -3571,20 +3687,34 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -3571,20 +3687,34 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
3571 } 3687 }
3572 }, 3688 },
3573 change: function (layer) { 3689 change: function (layer) {
3574 - 3690 +
3575 if ($rootScope.isTextAReaRectangleClickedAftrEdit == true) { 3691 if ($rootScope.isTextAReaRectangleClickedAftrEdit == true) {
3576 if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { 3692 if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) {
3577 console.log(layer.x + " " + layer.y); 3693 console.log(layer.x + " " + layer.y);
3578 console.log($rootScope.textXAxisAftrResize + " " + $rootScope.textYAxisAftrResize); 3694 console.log($rootScope.textXAxisAftrResize + " " + $rootScope.textYAxisAftrResize);
3579 $rootScope.isTextAReaRectangleClickedAftrEdit = false; 3695 $rootScope.isTextAReaRectangleClickedAftrEdit = false;
3580 - //if ((layer.x > $rootScope.textXAxisAftrResize) && (layer.y > $rootScope.textYAxisAftrResize) || (layer.x == $rootScope.textXAxisAftrResize) && (layer.y > $rootScope.textYAxisAftrResize) || (layer.x > $rootScope.textXAxisAftrResize) && (layer.y == $rootScope.textYAxisAftrResize)) {  
3581 - var CangedTextAreaName = 'TextAreaAfterEdit_' + $rootScope.postFixLayerNumberAftrEdit;  
3582 - $('#canvas').setLayer(CangedTextAreaName, {  
3583 - x: layer.x,  
3584 - y: layer.y  
3585 - });  
3586 -  
3587 - //} 3696 +
  3697 + for (var i = 0; i <= $rootScope.initTextAreaValues.length - 1; i++) {
  3698 +
  3699 + if ($rootScope.initTextAreaValues[i].name == layer.name) {
  3700 +
  3701 + if (($rootScope.initTextAreaValues[i].width == layer.width) || ($rootScope.initTextAreaValues[i].height == layer.height)) {
  3702 +
  3703 + }
  3704 + else {
  3705 + var textAreaName = layer.name;
  3706 + var textAreaNameAftrSplit = textAreaName.split("_");
  3707 + var CangedTextAreaName = 'TextAreaAfterEdit_' + textAreaNameAftrSplit[1];
  3708 + $('#canvas').setLayer(CangedTextAreaName, {
  3709 + x: layer.x,
  3710 + y: layer.y
  3711 + });
  3712 + }
  3713 + }
  3714 +
  3715 + }
  3716 +
  3717 +
3588 $rootScope.editTextXAxisAftrResize = layer.x; 3718 $rootScope.editTextXAxisAftrResize = layer.x;
3589 $rootScope.editTextYAxisAftrResize = layer.y; 3719 $rootScope.editTextYAxisAftrResize = layer.y;
3590 if ($location.path() == "/module-item-view") { 3720 if ($location.path() == "/module-item-view") {
400-SOURCECODE/AIAHTML5.Web/index.html
@@ -778,7 +778,15 @@ @@ -778,7 +778,15 @@
778 </div> 778 </div>
779 </div> 779 </div>
780 <textarea class="form-control" id="text_area" rows="3" style="font-family: 'Verdana, sans-serif';font-size:14px; font-weight: normal; font-style: normal; color: #000; text-align: left; text-decoration: none;"></textarea> 780 <textarea class="form-control" id="text_area" rows="3" style="font-family: 'Verdana, sans-serif';font-size:14px; font-weight: normal; font-style: normal; color: #000; text-align: left; text-decoration: none;"></textarea>
781 - </div> 781 +
  782 + <!--code for horizonatl text going out-->
  783 + <div id="atTextDiv" style="float:left;">
  784 + <span id="duptextspan" style="float: left; display: none;"></span>
  785 + <span id="textspan" style="display:none;"></span>
  786 + </div>
  787 + <!--code for horizonatl text going out-->
  788 +
  789 + </div>
782 <div class="modal-footer"> 790 <div class="modal-footer">
783 <!--<button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>--> 791 <!--<button type="button" class="btn btn-default" ng-click="closeModal()" data-dismiss="modal">Close</button>-->
784 <button type="button" class="btn btn-default" ng-click="closeModal()" id="closeEditText" data-dismiss="modal">Close</button> 792 <button type="button" class="btn btn-default" ng-click="closeModal()" id="closeEditText" data-dismiss="modal">Close</button>