diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 1c6332d..0f4b03a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -2944,10 +2944,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.iniiaTextAreaValues = []; $rootScope.initTextAreaValues = []; $rootScope.textWidth = []; - $rootScope.textWidth1 = []; + $rootScope.duplicatetextWidth = []; $rootScope.resieTextArray = []; - $rootScope.resieTextArray1 = []; - // $rootScope.textWidth1 = []; + $rootScope.duplicateResizeTextArray = []; $rootScope.aaaa = 0; $rootScope.aaaa1 = 0; ///----- @@ -3495,19 +3494,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#duptextspan").append(text[i]); $("#textspan").append(text[i]); contentWidthArray = []; - if ($rootScope.textWidth1.length > 0) { - + if ($rootScope.duplicatetextWidth.length > 0) { $rootScope.aaaa1 = $("#textspan").width(); - // alert("Second Time" + $rootScope.aaaa1); $rootScope.aaaa1 = $rootScope.aaaa1 - $rootScope.aaaa; $rootScope.aaaa = $rootScope.aaaa + $rootScope.aaaa1; - // alert("Second Time" + $rootScope.aaaa); - - $rootScope.textWidth1.push({ "id": "", "width": $rootScope.aaaa1, "character": text[i] }); + $rootScope.duplicatetextWidth.push({ "id": "", "width": $rootScope.aaaa1, "character": text[i] }); } else { - $rootScope.textWidth1.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); + $rootScope.duplicatetextWidth.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); } contentWidthArray.push(Math.ceil($("#textspan").width())); } @@ -3521,8 +3516,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.aaaa = 0; $rootScope.aaaa1 = 0; $rootScope.aaaa = $("#textspan").width(); - // alert("New Line" + $rootScope.aaaa); - $rootScope.textWidth1.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); + $rootScope.duplicatetextWidth.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); contentWidthArray.push(Math.ceil($("#textspan").width())); } @@ -3531,12 +3525,12 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#duptextspan").text(text[i]); $("#textspan").text(text[i]); contentWidthArray = []; - $rootScope.textWidth1.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); + $rootScope.duplicatetextWidth.push({ "id": "", "width": $("#textspan").width(), "character": text[i] }); $rootScope.aaaa = $("#textspan").width(); contentWidthArray.push(Math.ceil($("#textspan").width())); } } - console.log($rootScope.textWidth1); + console.log($rootScope.duplicatetextWidth); _modifiedText = $("#duptextspan").text(); console.log(_modifiedText); } @@ -3545,12 +3539,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#canvas").removeLayer($rootScope.layerNameArr).drawLayers(); $("#canvas").removeLayer($rootScope.rectTextArr).drawLayers(); - $rootScope.resetTextRectSave = $rootScope.ObjectIndexSave++; $rootScope.resetTextSave = $rootScope.ObjectIndexSave++; // generating new text area - // $('#canvas') + // Draw rect as wide as the text $('#canvas').drawRect({ name: 'TextAreaAfterEditRect_' + $rootScope.resetTextSave, @@ -3573,9 +3566,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.postFixLayerNumberAftrEdit = TextAreaLayerNameAftrSplit[1]; $rootScope.initTextAreaValues.push({ "name": layer.name, "width": layer.width, "height": layer.height }); - for (var i = 0; i <= $rootScope.textWidth1.length - 1; i++) { - if ($rootScope.textWidth1[i].id == "") { - $rootScope.textWidth1[i].id = layer.name; + for (var i = 0; i <= $rootScope.duplicatetextWidth.length - 1; i++) { + if ($rootScope.duplicatetextWidth[i].id == "") { + $rootScope.duplicatetextWidth[i].id = layer.name; } } @@ -3797,31 +3790,27 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic x: layer.x, y: layer.y }); - - - - $("#textspan").empty(); $("#duptextspan").empty(); var textWidthCounter = 0; var textAftrResize; - for (var i = 0; i <= $rootScope.resieTextArray1.length - 1; i++) { - if ($rootScope.resieTextArray1[i].layerName == CangedTextAreaName) { - if (/(\r\n)/gm.test($rootScope.resieTextArray1[i].Rect_Text) || /\s/.test($rootScope.resieTextArray1[i].Rect_Text)) { - textAftrResize = ($rootScope.resieTextArray1[i].Rect_Text).replace(/(\r\n)/gm, ""); - for (var i = 0; i <= $rootScope.textWidth1.length - 1; i++) { - if ($rootScope.textWidth1[i].id == layer.name) { - textWidthCounter = textWidthCounter + $rootScope.textWidth1[i].width; + for (var i = 0; i <= $rootScope.duplicateResizeTextArray.length - 1; i++) { + if ($rootScope.duplicateResizeTextArray[i].layerName == CangedTextAreaName) { + if (/(\r\n)/gm.test($rootScope.duplicateResizeTextArray[i].Rect_Text) || /\s/.test($rootScope.duplicateResizeTextArray[i].Rect_Text)) { + textAftrResize = ($rootScope.duplicateResizeTextArray[i].Rect_Text).replace(/(\r\n)/gm, ""); + for (var i = 0; i <= $rootScope.duplicatetextWidth.length - 1; i++) { + if ($rootScope.duplicatetextWidth[i].id == layer.name) { + textWidthCounter = textWidthCounter + $rootScope.duplicatetextWidth[i].width; if (textWidthCounter < layer.width) { - $("#duptextspan").append($rootScope.textWidth1[i].character); - $("#textspan").append($rootScope.textWidth1[i].character); + $("#duptextspan").append($rootScope.duplicatetextWidth[i].character); + $("#textspan").append($rootScope.duplicatetextWidth[i].character); } else { $("#duptextspan").append("\r\n"); $("#textspan").append("\r\n"); - $("#duptextspan").append($rootScope.textWidth1[i].character); + $("#duptextspan").append($rootScope.duplicatetextWidth[i].character); $("#textspan").text(''); - $("#textspan").append($rootScope.textWidth1[i].character); + $("#textspan").append($rootScope.duplicatetextWidth[i].character); textWidthCounter = 0; } } @@ -3834,11 +3823,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } } - - - - - } } @@ -3887,7 +3871,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic // console.log(layer.x + " " + layer.y); $rootScope.editTextXAxisAftrResize = layer.x; $rootScope.editTextYAxisAftrResize = layer.y; - $rootScope.resieTextArray1.push({ layerName: layer.name, Rect_Text: layer.text }); + $rootScope.duplicateResizeTextArray.push({ layerName: layer.name, Rect_Text: layer.text }); } });