Commit 2fdee721fcd2e8c44d59f1ee0ca0adc87372ab71

Authored by unknown
1 parent ac503277

Annotation: User should be able to see what he/she drawing

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -63,7 +63,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -63,7 +63,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
63 $rootScope.rectDimension = []; 63 $rootScope.rectDimension = [];
64 64
65 65
66 -  
67 $rootScope.$on("$locationChangeSuccess", function () { 66 $rootScope.$on("$locationChangeSuccess", function () {
68 67
69 if (($location.url() == "/da-body-view") || ($location.url() == "/clinical-illustrations-detail") || ($location.url() == "/clinical-animations-detail")) { 68 if (($location.url() == "/da-body-view") || ($location.url() == "/clinical-illustrations-detail") || ($location.url() == "/clinical-animations-detail")) {
@@ -611,9 +610,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -611,9 +610,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
611 strokeStyle: shapestyleborderColor, 610 strokeStyle: shapestyleborderColor,
612 opacity: shapestyleOpacity, 611 opacity: shapestyleOpacity,
613 strokeWidth: shapestyleborderWidth, 612 strokeWidth: shapestyleborderWidth,
614 - x: offsetX1, y: offsetY1,  
615 - width: x - offsetX1,  
616 - height: y - offsetY1, 613 + x: offsetX1 + 40, y: offsetY1 + 40,
  614 + width: (x - offsetX1),
  615 + height:(y - offsetY1),
617 616
618 resizeFromCenter: false, 617 resizeFromCenter: false,
619 618
@@ -678,7 +677,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -678,7 +677,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
678 } 677 }
679 678
680 $rootScope.CircleFn = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { 679 $rootScope.CircleFn = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) {
681 - 680 + // console.log("up"+ offsetX1 + " " + offsetY1 + " " + (x - offsetX1) + " " + (y - offsetY1));
682 $(canvasId).addLayer({ 681 $(canvasId).addLayer({
683 layer: true, 682 layer: true,
684 name: 'Circle_' + CircleNumber, 683 name: 'Circle_' + CircleNumber,
@@ -688,15 +687,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -688,15 +687,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
688 strokeStyle: shapestyleborderColor, 687 strokeStyle: shapestyleborderColor,
689 strokeWidth: shapestyleborderWidth, 688 strokeWidth: shapestyleborderWidth,
690 fillStyle: shapestyleFillColor, 689 fillStyle: shapestyleFillColor,
691 - x: offsetX1, y: offsetY1,  
692 - width: (x - offsetX1) * 2, height: (y - offsetY1) * 2, 690 + x: (offsetX1 + 40), y: (offsetY1 + 40),
  691 + width: (x - offsetX1), height: (y - offsetY1),
693 // Place a handle at each side and each corner 692 // Place a handle at each side and each corner
694 handlePlacement: 'both', 693 handlePlacement: 'both',
695 -  
696 -  
697 -  
698 click: function (layer) { 694 click: function (layer) {
699 -  
700 $rootScope.canvasLayerNameCollection = []; 695 $rootScope.canvasLayerNameCollection = [];
701 $rootScope.canvasLayerNameCollection.push(layer.name); 696 $rootScope.canvasLayerNameCollection.push(layer.name);
702 $(canvasId).setLayer(layer.name, { 697 $(canvasId).setLayer(layer.name, {
@@ -935,7 +930,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -935,7 +930,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
935 $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { 930 $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) {
936 931
937 932
938 - debugger; 933 + // debugger;
939 934
940 $('#canvas').drawText({ 935 $('#canvas').drawText({
941 layer: true, 936 layer: true,
@@ -967,9 +962,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -967,9 +962,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
967 strokeStyle: $rootScope.shapestyleborderColor, 962 strokeStyle: $rootScope.shapestyleborderColor,
968 strokeWidth: $rootScope.shapestyleborderWidth, 963 strokeWidth: $rootScope.shapestyleborderWidth,
969 fillStyle: $rootScope.shapestyleFillColor, 964 fillStyle: $rootScope.shapestyleFillColor,
970 - x: $rootScope.offsetX1, y: $rootScope.offsetY1,  
971 - width: $rootScope.x - $rootScope.offsetX1,  
972 - height: $rootScope.y - $rootScope.offsetY1, 965 + x: $rootScope.offsetX1 + 40, y: $rootScope.offsetY1 + 40,
  966 + width: ($rootScope.x - $rootScope.offsetX1),
  967 + height:($rootScope.y - $rootScope.offsetY1),
973 add: function (layer) { 968 add: function (layer) {
974 969
975 $rootScope.TextAreaRectID = layer.name; 970 $rootScope.TextAreaRectID = layer.name;
@@ -1119,15 +1114,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -1119,15 +1114,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
1119 // var y = event.clientY; 1114 // var y = event.clientY;
1120 $rootScope.offsetX1 = 0; 1115 $rootScope.offsetX1 = 0;
1121 $rootScope.offsetY1 = 0; 1116 $rootScope.offsetY1 = 0;
  1117 + var canvasDiv = document.getElementById('canvasDiv');
  1118 + var verticalScrollPosition = canvasDiv.scrollTop;
  1119 + var horizontlScrollPosition = canvasDiv.scrollLeft;
1122 $rootScope.offsetX1 = event.offsetX; 1120 $rootScope.offsetX1 = event.offsetX;
1123 $rootScope.offsetY1 = event.offsetY; 1121 $rootScope.offsetY1 = event.offsetY;
1124 -  
1125 ctx.clearRect(0, 0, 2277, 3248); 1122 ctx.clearRect(0, 0, 2277, 3248);
1126 $rootScope.clicked = true; 1123 $rootScope.clicked = true;
1127 -  
1128 // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); 1124 // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1);
  1125 + canvasElement.addEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false);
1129 } 1126 }
1130 -  
1131 $rootScope.rectNumber = 0; 1127 $rootScope.rectNumber = 0;
1132 $rootScope.LineNumber = 0; 1128 $rootScope.LineNumber = 0;
1133 $rootScope.CircleNumber = 0; 1129 $rootScope.CircleNumber = 0;
@@ -1144,70 +1140,59 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -1144,70 +1140,59 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
1144 var arrayRect = {}; 1140 var arrayRect = {};
1145 1141
1146 var storeLine = ''; 1142 var storeLine = '';
1147 - //$rootScope.canvasLayerNameCollection1 = []; 1143 +
1148 $rootScope.OnPaintCanvasMouseUp = function (event) { 1144 $rootScope.OnPaintCanvasMouseUp = function (event) {
1149 - 1145 +
1150 if (!$rootScope.clicked) { 1146 if (!$rootScope.clicked) {
1151 return; 1147 return;
1152 } 1148 }
  1149 + var AnnotationCanvas = document.getElementById('canvas');
  1150 + AnnotationCanvas.removeEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false);
  1151 + $(".line").remove();
  1152 + $(".arrow").remove();
  1153 + $(".pin").remove();
  1154 + $(".circle").remove();
  1155 + $(".rectangle").remove();
  1156 + $(".textarea").remove();
1153 $rootScope.clicked = false; 1157 $rootScope.clicked = false;
1154 $rootScope.x = 0; 1158 $rootScope.x = 0;
1155 $rootScope.y = 0; 1159 $rootScope.y = 0;
1156 - $rootScope.x = parseInt(event.clientX - ($("#canvas").offset().left));  
1157 - $rootScope.y = parseInt(event.clientY - ($("#canvas").offset().top));  
1158 - 1160 + var canvasDiv = document.getElementById('canvasDiv');
  1161 + var verticalScrollPosition = canvasDiv.scrollTop;
  1162 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1163 + $rootScope.x = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left;
  1164 + $rootScope.y = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top;
1159 var canvasElement = document.getElementById("canvas"); 1165 var canvasElement = document.getElementById("canvas");
1160 var ctx = canvasElement.getContext("2d"); 1166 var ctx = canvasElement.getContext("2d");
1161 -  
1162 var canvasPaintElement = document.getElementById("canvasPaint"); 1167 var canvasPaintElement = document.getElementById("canvasPaint");
1163 var PaintCanvasctx = canvasPaintElement.getContext("2d"); 1168 var PaintCanvasctx = canvasPaintElement.getContext("2d");
1164 -  
1165 -  
1166 switch ($rootScope.shapeType) { 1169 switch ($rootScope.shapeType) {
1167 -  
1168 case "cursor": 1170 case "cursor":
1169 - // ctx.clearRect(0, 0, 2277, 3248);  
1170 ctx.beginPath(); 1171 ctx.beginPath();
1171 PaintCanvasctx.beginPath(); 1172 PaintCanvasctx.beginPath();
1172 -  
1173 -  
1174 break; 1173 break;
1175 -  
1176 case "Line": 1174 case "Line":
1177 - //$rootScope.canvasLayerNameCollection = [];  
1178 $rootScope.LineNumber = $rootScope.ObjectIndex++; 1175 $rootScope.LineNumber = $rootScope.ObjectIndex++;
1179 -  
1180 $rootScope.LineFn('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) 1176 $rootScope.LineFn('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y)
1181 -  
1182 break; 1177 break;
1183 -  
1184 case "Rectangle": 1178 case "Rectangle":
1185 $rootScope.rectNumber = $rootScope.ObjectIndex++; 1179 $rootScope.rectNumber = $rootScope.ObjectIndex++;
1186 $rootScope.RectangleFn('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); 1180 $rootScope.RectangleFn('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y);
1187 -  
1188 break; 1181 break;
1189 -  
1190 case "Circle": 1182 case "Circle":
1191 - // alert($rootScope.shapestyleborderWidth);  
1192 $rootScope.CircleNumber = $rootScope.ObjectIndex++; 1183 $rootScope.CircleNumber = $rootScope.ObjectIndex++;
1193 -  
1194 $rootScope.CircleFn('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); 1184 $rootScope.CircleFn('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y);
1195 break; 1185 break;
1196 case "Arrow": 1186 case "Arrow":
1197 $rootScope.ArrowNumber = $rootScope.ObjectIndex++; 1187 $rootScope.ArrowNumber = $rootScope.ObjectIndex++;
1198 -  
1199 $rootScope.ArrowFn('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); 1188 $rootScope.ArrowFn('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y);
1200 -  
1201 - // $scope.resetRect += 1;  
1202 break; 1189 break;
1203 case "Pin": 1190 case "Pin":
1204 $rootScope.PinNumber = $rootScope.PinObjectIndex++; 1191 $rootScope.PinNumber = $rootScope.PinObjectIndex++;
1205 $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++; 1192 $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++;
1206 $rootScope.PinFn('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); 1193 $rootScope.PinFn('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber);
1207 -  
1208 break; 1194 break;
1209 case "TextArea": 1195 case "TextArea":
1210 -  
1211 $rootScope.IsTextAlreadySave = false; 1196 $rootScope.IsTextAlreadySave = false;
1212 $("#text_area").val(''); 1197 $("#text_area").val('');
1213 // Draw text 1198 // Draw text
@@ -1215,9 +1200,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -1215,9 +1200,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
1215 $rootScope.TextNumber = $rootScope.ObjectIndex++; 1200 $rootScope.TextNumber = $rootScope.ObjectIndex++;
1216 $rootScope.TextAreaFn('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); 1201 $rootScope.TextAreaFn('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y);
1217 break; 1202 break;
1218 -  
1219 case "DrawPolygon": 1203 case "DrawPolygon":
1220 -  
1221 break; 1204 break;
1222 1205
1223 } 1206 }
@@ -1225,15 +1208,82 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", @@ -1225,15 +1208,82 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location",
1225 1208
1226 } 1209 }
1227 1210
  1211 + $rootScope.OnPaintCanvasMouseMove = function (event) {
  1212 + var canvasDiv = document.getElementById('canvasDiv');
  1213 + var verticalScrollPosition = canvasDiv.scrollTop;
  1214 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  1215 + $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left;
  1216 + $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top;
1228 1217
  1218 + switch ($rootScope.shapeType) {
  1219 + case "Line":
  1220 + $(".line").remove();
  1221 + // console.log($rootScope.MouseMoveXAxis - $rootScope.offsetX1);
  1222 + $("#canvasDiv").append("<div class='line' style='border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;'></div>");
  1223 + $rootScope.Annotationangle();
  1224 + break;
  1225 + case "Arrow":
  1226 + $(".arrow").remove();
  1227 + $("#canvasDiv").append("<div class='arrow' style='border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div style='border-bottom: 9px solid transparent;border-right: 12px dashed #ccc;border-top: 7px solid transparent;height: 0;left: -6px;position: absolute;top: -8px;width: 0;'></div></div>");
  1228 + $rootScope.Annotationangle();
  1229 + break;
  1230 + case "Pin":
  1231 + $(".pin").remove();
  1232 + $("#canvasDiv").append("<div class='pin' style='border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + "px;'><div style='background-color:#fff;left: -8px;position: absolute;top: -6px;width: 10;height:12px;width:12px;border:2px dashed #808080;border-radius:50%;'></div></div>");
  1233 + $rootScope.Annotationangle();
  1234 + break;
  1235 + case "Circle":
  1236 + $(".circle").remove();
  1237 + // console.log($rootScope.offsetX1 + " " + $rootScope.offsetY1 + " " + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + " " + Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1));
  1238 + $("#canvasDiv").append("<div class='circle' style='border-radius:50%;border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + (Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1)) + "px;height:" + (Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1)) + "px;'></div>");
  1239 + break;
  1240 + case "Rectangle":
  1241 + $(".rectangle").remove();
  1242 + // console.log($rootScope.offsetX1 + " " + $rootScope.offsetY1 + " " + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + " " + Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1));
  1243 + $("#canvasDiv").append("<div class='rectangle' style='border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + (Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1)) + "px;height:" + (Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1)) + "px;'></div>");
  1244 + break;
  1245 + case "TextArea":
  1246 + $(".textarea").remove();
  1247 + // console.log($rootScope.offsetX1 + " " + $rootScope.offsetY1 + " " + Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1) + " " + Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1));
  1248 + $("#canvasDiv").append("<div class='textarea' style='border:1px dashed #AEAEAE;position:absolute;left:" + $rootScope.offsetX1 + "px;top:" + $rootScope.offsetY1 + "px;width:" + (Math.abs($rootScope.MouseMoveXAxis - $rootScope.offsetX1)) + "px;height:" + (Math.abs($rootScope.MouseMoveYAxis - $rootScope.offsetY1)) + "px;'></div>");
  1249 + break;
  1250 + }
  1251 + }
1229 1252
  1253 + $rootScope.Annotationangle = function (event) {
  1254 + var dy = $rootScope.MouseMoveYAxis - $rootScope.offsetY1;
  1255 + var dx = $rootScope.MouseMoveXAxis - $rootScope.offsetX1;
  1256 + var theta = 0;
  1257 + if (dx < 0) {
  1258 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1259 + theta = theta + 180;
1230 1260
  1261 + }
  1262 + else if (dy < 0) {
  1263 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1264 + theta = theta + 360;
1231 1265
  1266 + }
  1267 + else {
  1268 + theta = Math.atan(dy / dx) * (180 / Math.PI);
  1269 + }
  1270 + var dottedLineWidth = Math.sqrt(($rootScope.offsetX1 - $rootScope.MouseMoveXAxis) * ($rootScope.offsetX1 - $rootScope.MouseMoveXAxis) + ($rootScope.offsetY1 - $rootScope.MouseMoveYAxis) * ($rootScope.offsetY1 - $rootScope.MouseMoveYAxis));
  1271 + switch ($rootScope.shapeType) {
  1272 + case "Line":
  1273 + $('.line').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' });
  1274 + break;
  1275 + case "Arrow":
  1276 + $('.arrow').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' });
  1277 + break;
  1278 + case "Pin":
  1279 + $('.pin').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' });
  1280 + break;
  1281 + }
  1282 + }
1232 1283
1233 ///----- 1284 ///-----
1234 -  
1235 $rootScope.saveText = function () { 1285 $rootScope.saveText = function () {
1236 - debugger; 1286 +
1237 document.getElementById('modelbackground').style.display = "none"; 1287 document.getElementById('modelbackground').style.display = "none";
1238 // this part will work first time when save button will be clicked 1288 // this part will work first time when save button will be clicked
1239 if ($rootScope.IsTextAlreadySave == false) { 1289 if ($rootScope.IsTextAlreadySave == false) {
@@ -1248,15 +1298,8 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;, @@ -1248,15 +1298,8 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
1248 $rootScope.textArea = $("#text_area").val(); 1298 $rootScope.textArea = $("#text_area").val();
1249 1299
1250 // deleting previous text area 1300 // deleting previous text area
1251 -  
1252 -  
1253 $("#canvas").removeLayer($rootScope.TextID).drawLayers(); 1301 $("#canvas").removeLayer($rootScope.TextID).drawLayers();
1254 $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers(); 1302 $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers();
1255 -  
1256 -  
1257 - // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers();  
1258 - // $("#canvas").removeLayer("TextRect_" + $rootScope.TextNumber).drawLayers();  
1259 -  
1260 // Text After Saving in Rectangle 1303 // Text After Saving in Rectangle
1261 $rootScope.resetTextRect = $rootScope.ObjectIndex++; 1304 $rootScope.resetTextRect = $rootScope.ObjectIndex++;
1262 $('#canvas').drawText({ 1305 $('#canvas').drawText({
@@ -1323,31 +1366,12 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;, @@ -1323,31 +1366,12 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
1323 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); 1366 var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_");
1324 var TextAreaRectName = "TextAreaNew_"; 1367 var TextAreaRectName = "TextAreaNew_";
1325 var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); 1368 var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]);
1326 - // alert(TextAreaRectNameConcatenated);  
1327 - //if (_rectLayerOnSaveSplit[1]%2 == 0)  
1328 - //{  
1329 - // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1] - 1;  
1330 -  
1331 - //}  
1332 - //else  
1333 - //{  
1334 -  
1335 - // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1];  
1336 - //}  
1337 1369
1338 $rootScope.layerNameArr = layer.name; 1370 $rootScope.layerNameArr = layer.name;
1339 $rootScope.rectTextArr = TextAreaRectNameConcatenated; 1371 $rootScope.rectTextArr = TextAreaRectNameConcatenated;
1340 1372
1341 1373
1342 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); 1374 $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y });
1343 - // var _rectLayerOnSaveSplitInt;  
1344 -  
1345 -  
1346 - // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]);  
1347 -  
1348 - //alert(_rectLayerOnSaveSplitInt);  
1349 - // alert($rootScope.TextPropertyArray.length);  
1350 -  
1351 1375
1352 for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { 1376 for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) {
1353 if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { 1377 if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) {
@@ -1767,9 +1791,6 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;, @@ -1767,9 +1791,6 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
1767 1791
1768 } 1792 }
1769 else if ($rootScope.shapeTypeText == "textAreaRect") { 1793 else if ($rootScope.shapeTypeText == "textAreaRect") {
1770 -  
1771 -  
1772 -  
1773 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers(); 1794 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers();
1774 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers(); 1795 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers();
1775 $rootScope.shapeTypeText = ""; 1796 $rootScope.shapeTypeText = "";
@@ -1777,7 +1798,6 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;, @@ -1777,7 +1798,6 @@ AIA.controller(&quot;HomeController&quot;, [&quot;$rootScope&quot;, &quot;Modules&quot;, &quot;$log&quot;, &quot;$location&quot;,
1777 } 1798 }
1778 else { 1799 else {
1779 1800
1780 - // alert($rootScope.canvasLayerNameCollection);  
1781 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers(); 1801 $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers();
1782 } 1802 }
1783 1803