Commit 2c9f6d69e05fb6aeff4141167bb97e9348524510

Authored by Amrita Vishnoi
2 parents ba1513b2 96fe7610

Merge branch 'TBhighlight5Merge' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -3928,7 +3928,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3928,7 +3928,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3928 'width': 0, 3928 'width': 0,
3929 'height': 0, 3929 'height': 0,
3930 'z-index': 1000 3930 'z-index': 1000
3931 - //'background': 'transparent',  
3932 }); 3931 });
3933 $selection.appendTo($container); 3932 $selection.appendTo($container);
3934 } 3933 }
@@ -3969,8 +3968,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3969,8 +3968,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3969 function mouseUpListener(e) { 3968 function mouseUpListener(e) {
3970 3969
3971 $scope.isTBDrawnOnBodyRegion = false; 3970 $scope.isTBDrawnOnBodyRegion = false;
3972 - //alert('mouse up');  
3973 - console.log('MOUSE UP'); 3971 +
3974 $(".com").remove(); 3972 $(".com").remove();
3975 $('#dot').remove(); 3973 $('#dot').remove();
3976 $('#bord').remove(); 3974 $('#bord').remove();
@@ -3982,12 +3980,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3982,12 +3980,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3982 var currentMousePosition = $scope.getMousePos(e); 3980 var currentMousePosition = $scope.getMousePos(e);
3983 3981
3984 3982
3985 - var canvasDiv = document.getElementById('canvasDiv');  
3986 - var verticalScrollPosition = canvasDiv.scrollTop;  
3987 - var horizontlScrollPosition = canvasDiv.scrollLeft; 3983 + var canavsDivScrollPos = $scope.getCanavsDivScrollPosition();
3988 3984
3989 - var TransparencyEndX = currentMousePosition.x + horizontlScrollPosition  
3990 - var TransparencyBoxEndY = currentMousePosition.y + verticalScrollPosition 3985 + var TransparencyEndX = currentMousePosition.x + canavsDivScrollPos.horizontlScrollPosition;
  3986 + var TransparencyBoxEndY = currentMousePosition.y + canavsDivScrollPos.verticalScrollPosition;
3991 3987
3992 3988
3993 $scope.isTboxDrwan = true; 3989 $scope.isTboxDrwan = true;
@@ -3996,7 +3992,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -3996,7 +3992,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3996 $scope.TransparencyEndX = TransparencyEndX; 3992 $scope.TransparencyEndX = TransparencyEndX;
3997 $scope.TransparencyBoxEndY = TransparencyBoxEndY; 3993 $scope.TransparencyBoxEndY = TransparencyBoxEndY;
3998 3994
3999 - $scope.layerNumberBeforeTrans = parseInt($('#txtlayerNumber').val()); 3995 + $scope.layerNumberBeforeTBDraw = parseInt($('#txtlayerNumber').val());
4000 3996
4001 //draw temp box to store the canvas data with original transparecy 3997 //draw temp box to store the canvas data with original transparecy
4002 if (document.getElementById('tempCanvas') != null) { 3998 if (document.getElementById('tempCanvas') != null) {
@@ -4023,18 +4019,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4023,18 +4019,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4023 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; 4019 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
4024 4020
4025 $scope.IncludedBodyRegions = []; 4021 $scope.IncludedBodyRegions = [];
4026 - ////debugger; 4022 + $scope.transparencyDrawnRegions = [];
  4023 +
4027 $.each(BodyRegionDictionary, function (index, value) { 4024 $.each(BodyRegionDictionary, function (index, value) {
4028 - // alert(' $.each(BodyRegionDictionary1')  
4029 - var transparencyBoxHeight = parseInt(TransparencyBoxEndY) - parseInt($scope.TransparencyBoxStartY);  
4030 - var transparencyBoxWidth = parseInt(TransparencyEndX) - parseInt($scope.TransparencyBoxStartX);  
4031 - var transparencyBoxBottom = parseInt($scope.TransparencyBoxStartY) + parseInt(transparencyBoxHeight);  
4032 - var transparencyBoxRight = parseInt($scope.TransparencyBoxStartX) + parseInt(transparencyBoxWidth);  
4033 - // alert(' $.each(BodyRegionDictionary2. transparencyBoxHeight: ' + transparencyBoxHeight + ',transparencyBoxBottom: ' + transparencyBoxBottom+', transparencyBoxRight: '+transparencyBoxRight)  
4034 - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);  
4035 - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); 4025 +
4036 4026
  4027 + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width);
4037 4028
  4029 + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight;
  4030 + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth;
  4031 + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom;
  4032 + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight;
  4033 + var bodyRegionRight = tBoxDimesions.bodyRegionRight;
  4034 + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom;
4038 4035
4039 var transparencyCanvas = document.createElement('canvas'); 4036 var transparencyCanvas = document.createElement('canvas');
4040 var tBox = document.getElementById('transparencyCanvas'); 4037 var tBox = document.getElementById('transparencyCanvas');
@@ -4050,7 +4047,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4050,7 +4047,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4050 transparencyCanvas.style.border = "black 1px solid"; 4047 transparencyCanvas.style.border = "black 1px solid";
4051 transparencyCanvas.style.backgroundColor = "transparent"; 4048 transparencyCanvas.style.backgroundColor = "transparent";
4052 transparencyCanvas.style.zIndex = 200; 4049 transparencyCanvas.style.zIndex = 200;
4053 - // transparencyCanvas.style.visibility = 'hidden';  
4054 document.getElementById('canvasDiv').appendChild(transparencyCanvas); 4050 document.getElementById('canvasDiv').appendChild(transparencyCanvas);
4055 $scope.transparencyChangeCounter = 0; 4051 $scope.transparencyChangeCounter = 0;
4056 4052
@@ -4087,14 +4083,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4087,14 +4083,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4087 //for modesty 4083 //for modesty
4088 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { 4084 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
4089 $.each($scope.modestyImageInfo, function (index, value) { 4085 $.each($scope.modestyImageInfo, function (index, value) {
4090 - // alert(' $.each(BodyRegionDictionary1')  
4091 - var transparencyBoxHeight = parseInt(TransparencyBoxEndY) - parseInt($scope.TransparencyBoxStartY);  
4092 - var transparencyBoxWidth = parseInt(TransparencyEndX) - parseInt($scope.TransparencyBoxStartX);  
4093 - var transparencyBoxBottom = parseInt($scope.TransparencyBoxStartY) + parseInt(transparencyBoxHeight);  
4094 - var transparencyBoxRight = parseInt($scope.TransparencyBoxStartX) + parseInt(transparencyBoxWidth);  
4095 - // alert(' $.each(BodyRegionDictionary2. transparencyBoxHeight: ' + transparencyBoxHeight + ',transparencyBoxBottom: ' + transparencyBoxBottom+', transparencyBoxRight: '+transparencyBoxRight)  
4096 - var bodyRegionRight = parseInt(value.x) + parseInt(value.Width);  
4097 - var bodyRegionBottom = parseInt(value.y) + parseInt(value.Height); 4086 +
  4087 + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width);
  4088 +
  4089 + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight;
  4090 + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth;
  4091 + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom;
  4092 + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight;
  4093 + var bodyRegionRight = tBoxDimesions.bodyRegionRight;
  4094 + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom;
4098 4095
4099 if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { 4096 if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) {
4100 4097
@@ -4133,12 +4130,37 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4133,12 +4130,37 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4133 $('#btnIdentity').addClass('btn-primary'); 4130 $('#btnIdentity').addClass('btn-primary');
4134 } 4131 }
4135 4132
4136 - $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {  
4137 - // debugger; 4133 + $scope.getCanavsDivScrollPosition = function () {
4138 4134
4139 - // else { 4135 + var canvasDiv = document.getElementById('canvasDiv');
  4136 + return{
  4137 + verticalScrollPosition : canvasDiv.scrollTop,
  4138 + horizontlScrollPosition : canvasDiv.scrollLeft
  4139 + }
  4140 +
  4141 + }
  4142 +
  4143 + $scope.getTBoxDimesions = function (TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, X, Y, Height, Width) {
  4144 +
  4145 + var tBoxHeight = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
  4146 + var tBoxWidth = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
  4147 + var tBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tBoxHeight);
  4148 + var tBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tBoxWidth);
  4149 +
  4150 + return{
  4151 +
  4152 + transparencyBoxHeight: tBoxHeight,
  4153 + transparencyBoxWidth: tBoxWidth,
  4154 + transparencyBoxBottom: tBoxBottom,
  4155 + transparencyBoxRight: tBoxRight,
  4156 + bodyRegionRight : parseInt(X) + parseInt(Width),
  4157 + bodyRegionBottom : parseInt(Y) + parseInt(Height)
  4158 + }
  4159 + }
  4160 +
  4161 + $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {
  4162 +
4140 4163
4141 - var scope1 = angular.element(document.getElementById("DAView")).scope();  
4142 var transparencyCanvas = document.getElementById('transparencyCanvas'); 4164 var transparencyCanvas = document.getElementById('transparencyCanvas');
4143 4165
4144 TransparencyBoxStartX = parseInt((transparencyCanvas.style.left).replace('px', '')); 4166 TransparencyBoxStartX = parseInt((transparencyCanvas.style.left).replace('px', ''));
@@ -4147,140 +4169,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4147,140 +4169,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4147 TransparencyBoxEndY = parseInt(transparencyCanvas.height) + parseInt(TransparencyBoxStartY); 4169 TransparencyBoxEndY = parseInt(transparencyCanvas.height) + parseInt(TransparencyBoxStartY);
4148 4170
4149 4171
4150 - var XforCopyImage = 0;  
4151 - var YforCopyImage = 0;  
4152 - var WidthforCopyImage = 0;  
4153 - var HeightforCopyImage = 0;  
4154 - var XforTransImage = 0;  
4155 - var WidthforTransImage = 0;  
4156 - var HeightforTransImage = 0;  
4157 - var YforTransImage = 0;  
4158 - var PreviousBodyRegionHeight = 0;  
4159 - var PreviousBodyRegionY;  
4160 - var PreviousBodyRegionWidth;  
4161 - var PreviousBodyRegionX;  
4162 - var previousBodyRegionId;  
4163 - var transparencyTempCanvas;  
4164 -  
4165 -  
4166 -  
4167 - //X ends outside and start outside of bodyregion  
4168 - if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) {  
4169 - XforCopyImage = 0;  
4170 - WidthforCopyImage = Width;  
4171 - WidthforTransImage = Width;  
4172 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4173 - XforTransImage = 0;  
4174 - }  
4175 - else  
4176 - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));  
4177 - // alert('1')  
4178 - }  
4179 - else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) {  
4180 -  
4181 - XforCopyImage = 0;  
4182 -  
4183 - WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(X);  
4184 -  
4185 - WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X);  
4186 -  
4187 - // alert(' scope.WidthforCopyImage: ' + scope.WidthforCopyImage)  
4188 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4189 - XforTransImage = 0;  
4190 - }  
4191 - else  
4192 - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));  
4193 -  
4194 - // alert('2')  
4195 - }  
4196 - else if (TransparencyBoxStartX > X && TransparencyEndX > parseInt(X) + parseInt(Width)) {  
4197 - // alert('TransparencyEndX: ' + TransparencyEndX + ', X: ' + X + ', Width: ' + Width + 'scope.TransparencyBoxStartX: ' + scope.TransparencyBoxStartX)  
4198 -  
4199 - XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);  
4200 - WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);  
4201 - WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);  
4202 -  
4203 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4204 -  
4205 - XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);  
4206 - }  
4207 - else  
4208 - XforTransImage = 0;  
4209 - // alert('3')  
4210 - }  
4211 - else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) {  
4212 - // alert('startX inside & endX inside')  
4213 - XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ;  
4214 - WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);  
4215 - WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);  
4216 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4217 -  
4218 - XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);  
4219 - }  
4220 - else  
4221 - XforTransImage = 0;  
4222 - // alert('4. TransparencyBoxStartX: ' + TransparencyBoxStartX + ',X: ' + parseInt(X) + ',TransparencyEndX: ' + TransparencyEndX + ',XforCopyImage: ' + XforCopyImage)  
4223 - }  
4224 -  
4225 - //calculate Y and height for tempTranparency box from where to cut the image  
4226 -  
4227 -  
4228 - if (TransparencyBoxStartY < Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {  
4229 -  
4230 - // alert('start Y outside and end Y outside');  
4231 -  
4232 - YforCopyImage = 0;  
4233 - HeightforCopyImage = Height;  
4234 -  
4235 - HeightforTransImage = Height;  
4236 - //alert('Y ' + Y)  
4237 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4238 - YforTransImage = 0;  
4239 - }  
4240 - else  
4241 - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);  
4242 - // alert('5')  
4243 - }  
4244 - else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {  
4245 -  
4246 - YforCopyImage = 0;  
4247 - HeightforCopyImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)//(parseInt(Height) + parseInt(Y)) - (parseInt(TransparencyBoxEndY) - parseInt(scope.TransparencyBoxStartY));  
4248 -  
4249 - HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY));  
4250 -  
4251 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4252 - YforTransImage = 0;  
4253 - }  
4254 - else  
4255 - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);  
4256 -  
4257 - }  
4258 - else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {  
4259 -  
4260 - YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);  
4261 - HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);  
4262 - HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);  
4263 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4264 - YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);  
4265 -  
4266 - }  
4267 - else  
4268 - YforTransImage = 0;  
4269 -  
4270 - }  
4271 - else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) {  
4272 -  
4273 - YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);  
4274 - HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);  
4275 - HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);  
4276 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4277 - YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);  
4278 -  
4279 - }  
4280 - else  
4281 - YforTransImage = 0;  
4282 - } 4172 + var TBImageDimensions = $scope.calculateDimensionsForTBImage(Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, bodyRegionId);
4283 4173
  4174 + var XforCopyImage = TBImageDimensions.XforCopyImageTB;
  4175 + var YforCopyImage = TBImageDimensions.YforCopyImageTB;
  4176 + var WidthforCopyImage = TBImageDimensions.WidthforCopyImageTB;
  4177 + var HeightforCopyImage = TBImageDimensions.HeightforCopyImageTB;
  4178 + var XforTransImage = TBImageDimensions.XforTransImageTB;
  4179 + var WidthforTransImage = TBImageDimensions.WidthforTransImageTB;
  4180 + var HeightforTransImage = TBImageDimensions.HeightforTransImageTB;
  4181 + var YforTransImage = TBImageDimensions.YforTransImageTB;
4284 4182
4285 //0. get current layer number 4183 //0. get current layer number
4286 if ($scope.isResized) { 4184 if ($scope.isResized) {
@@ -4288,14 +4186,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4288,14 +4186,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4288 } 4186 }
4289 else if (isLayerChanged) { 4187 else if (isLayerChanged) {
4290 4188
4291 -  
4292 } 4189 }
4293 else { 4190 else {
4294 -  
4295 - 4191 +
4296 var tranparencyLayer; 4192 var tranparencyLayer;
4297 4193
4298 - var currentLayer = $scope.layerNumberBeforeTrans; 4194 + var currentLayer = $scope.layerNumberBeforeTBDraw;
4299 4195
4300 if (currentLayer == $rootScope.totalLayers) { 4196 if (currentLayer == $rootScope.totalLayers) {
4301 4197
@@ -4315,11 +4211,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4315,11 +4211,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4315 4211
4316 $('#txtlayerNumber').val($scope.layerNumber); 4212 $('#txtlayerNumber').val($scope.layerNumber);
4317 4213
4318 - //dedebugger; 4214 +
4319 var tranparencyImgSrc; 4215 var tranparencyImgSrc;
4320 var tranparencyMaskImgSrc; 4216 var tranparencyMaskImgSrc;
4321 - //for modesty image  
4322 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg')))// == "2" || bodyRegionId == "3")) { 4217 +
  4218 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg')))
4323 { 4219 {
4324 var modestyBodyRegionData = new jinqJs() 4220 var modestyBodyRegionData = new jinqJs()
4325 .from($scope.modestyImageInfo) 4221 .from($scope.modestyImageInfo)
@@ -4327,52 +4223,42 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4327,52 +4223,42 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4327 .select(); 4223 .select();
4328 tranparencyImgSrc = modestyBodyRegionData[0].SRC; 4224 tranparencyImgSrc = modestyBodyRegionData[0].SRC;
4329 } 4225 }
4330 -  
4331 - //modesty end  
4332 -  
4333 - //1. get the image source  
4334 -  
4335 else { 4226 else {
4336 tranparencyImgSrc = $scope.GetImageSource(bodyRegionId); 4227 tranparencyImgSrc = $scope.GetImageSource(bodyRegionId);
4337 tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); 4228 tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
4338 } 4229 }
4339 - // var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);  
4340 - // debugger; 4230 +
  4231 + //remove old canvases
4341 var oldCanvas; 4232 var oldCanvas;
4342 -  
4343 - if (IsMirror == 'Yes') {  
4344 - oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId)  
4345 - }  
4346 - else {  
4347 -  
4348 - oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId)  
4349 -  
4350 - }  
4351 -  
4352 - if (oldCanvas != null) {  
4353 - document.getElementById('canvasDiv').removeChild(oldCanvas);  
4354 - }  
4355 -  
4356 - //remove tempmask canvas  
4357 var oldtempTransCanvasMask; 4233 var oldtempTransCanvasMask;
4358 var oldtempTransCanvasMaskMR; 4234 var oldtempTransCanvasMaskMR;
  4235 +
4359 if (IsMirror == 'Yes') { 4236 if (IsMirror == 'Yes') {
  4237 + oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId);
4360 oldtempTransCanvasMaskMR = document.getElementById('transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'); 4238 oldtempTransCanvasMaskMR = document.getElementById('transparencyTempCanvasMask_MR' + bodyRegionId + '_mci');
4361 oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); 4239 oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
4362 4240
4363 if (oldtempTransCanvasMaskMR != null) { 4241 if (oldtempTransCanvasMaskMR != null) {
4364 document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMaskMR); 4242 document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMaskMR);
4365 } 4243 }
  4244 +
4366 } 4245 }
4367 else { 4246 else {
  4247 +
  4248 + oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId)
4368 oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); 4249 oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
4369 4250
4370 } 4251 }
  4252 +
  4253 + if (oldCanvas != null) {
  4254 + document.getElementById('canvasDiv').removeChild(oldCanvas);
  4255 + }
4371 if (oldtempTransCanvasMask != null) { 4256 if (oldtempTransCanvasMask != null) {
4372 document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask); 4257 document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask);
4373 } 4258 }
4374 -  
4375 - transparencyTempCanvas = document.createElement('canvas'); 4259 +
  4260 +
  4261 + var transparencyTempCanvas = document.createElement('canvas');
4376 var transparencyTempcanavsMask = document.createElement('canvas'); 4262 var transparencyTempcanavsMask = document.createElement('canvas');
4377 //if mirror then draw mask image for non mirrored body region for annotation 4263 //if mirror then draw mask image for non mirrored body region for annotation
4378 if (IsMirror == 'Yes') { 4264 if (IsMirror == 'Yes') {
@@ -4382,8 +4268,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4382,8 +4268,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4382 else { 4268 else {
4383 if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { 4269 if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
4384 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId; 4270 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId;
4385 - // transparencyTempCanvas.style.visibility = 'visible';  
4386 - //transparencyTempCanvas.style.zIndex = '1000' 4271 +
4387 } 4272 }
4388 else { 4273 else {
4389 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId; 4274 transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId;
@@ -4396,14 +4281,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4396,14 +4281,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4396 transparencyTempCanvas.style.position = "absolute"; 4281 transparencyTempCanvas.style.position = "absolute";
4397 transparencyTempCanvas.style.left = X + 'px' // x + "px"; 4282 transparencyTempCanvas.style.left = X + 'px' // x + "px";
4398 transparencyTempCanvas.style.top = Y + "px"//y + "px"; 4283 transparencyTempCanvas.style.top = Y + "px"//y + "px";
4399 - //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4400 - // transparencyTempCanvas.style.visibility = 'visible';  
4401 - //}  
4402 - //else { 4284 +
4403 transparencyTempCanvas.style.visibility = 'hidden'; 4285 transparencyTempCanvas.style.visibility = 'hidden';
4404 - // }  
4405 - //transparencyTempCanvas.style.visibility = 'visible';  
4406 - // transparencyCanvas.style.zIndex = 4000; 4286 +
4407 document.getElementById('canvasDiv').appendChild(transparencyTempCanvas); 4287 document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
4408 4288
4409 //create temp mask canvas 4289 //create temp mask canvas
@@ -4415,8 +4295,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4415,8 +4295,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4415 transparencyTempcanavsMask.style.left = X + 'px' // x + "px"; 4295 transparencyTempcanavsMask.style.left = X + 'px' // x + "px";
4416 transparencyTempcanavsMask.style.top = Y + "px"//y + "px"; 4296 transparencyTempcanavsMask.style.top = Y + "px"//y + "px";
4417 transparencyTempcanavsMask.style.visibility = 'hidden'; 4297 transparencyTempcanavsMask.style.visibility = 'hidden';
4418 - //transparencyTempCanvas.style.visibility = 'visible';  
4419 - // transparencyCanvas.style.border = "black 1px solid"; 4298 +
4420 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask); 4299 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
4421 } 4300 }
4422 4301
@@ -4432,7 +4311,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4432,7 +4311,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4432 if (document.getElementById(modestyTransTempCanvasId) == null || document.getElementById(modestyTransTempCanvasId) == undefined) { 4311 if (document.getElementById(modestyTransTempCanvasId) == null || document.getElementById(modestyTransTempCanvasId) == undefined) {
4433 var tempCanvasModesty = document.createElement('canvas'); 4312 var tempCanvasModesty = document.createElement('canvas');
4434 tempCanvasModesty.id = modestyTransTempCanvasId; 4313 tempCanvasModesty.id = modestyTransTempCanvasId;
4435 - // $scope.tempCanvas = transparencyCanvas.id;  
4436 tempCanvasModesty.height = Height; 4314 tempCanvasModesty.height = Height;
4437 tempCanvasModesty.width = Width; 4315 tempCanvasModesty.width = Width;
4438 tempCanvasModesty.style.position = "absolute"; 4316 tempCanvasModesty.style.position = "absolute";
@@ -4450,18 +4328,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4450,18 +4328,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4450 if (document.getElementById(modestyTransCanvasId) == null || document.getElementById(modestyTransCanvasId) == undefined) { 4328 if (document.getElementById(modestyTransCanvasId) == null || document.getElementById(modestyTransCanvasId) == undefined) {
4451 var canvasModesty = document.createElement('canvas'); 4329 var canvasModesty = document.createElement('canvas');
4452 canvasModesty.id = modestyTransCanvasId; 4330 canvasModesty.id = modestyTransCanvasId;
4453 - // $scope.tempCanvas = transparencyCanvas.id;  
4454 canvasModesty.height = Height; 4331 canvasModesty.height = Height;
4455 canvasModesty.width = Width; 4332 canvasModesty.width = Width;
4456 canvasModesty.style.position = "absolute"; 4333 canvasModesty.style.position = "absolute";
4457 canvasModesty.style.left = X + 'px'; 4334 canvasModesty.style.left = X + 'px';
4458 canvasModesty.style.top = Y + 'px'; 4335 canvasModesty.style.top = Y + 'px';
4459 - //canvasModesty.style.backgroundColor = "transparent";  
4460 canvasModesty.style.visibility = 'visible'; 4336 canvasModesty.style.visibility = 'visible';
4461 canvasModesty.style.zIndex = '2000'; 4337 canvasModesty.style.zIndex = '2000';
4462 canvasModesty.addEventListener('click', OnClickModestyTransCanvas); 4338 canvasModesty.addEventListener('click', OnClickModestyTransCanvas);
4463 4339
4464 - // tempcanvasModestyCanvasModesty.style.border = "black 1px solid";  
4465 document.getElementById('canvasDiv').appendChild(canvasModesty); 4340 document.getElementById('canvasDiv').appendChild(canvasModesty);
4466 } 4341 }
4467 } 4342 }
@@ -4469,8 +4344,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4469,8 +4344,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4469 if (tranparencyImgSrc != undefined) { 4344 if (tranparencyImgSrc != undefined) {
4470 var tempImg = new Image(); 4345 var tempImg = new Image();
4471 4346
  4347 + var tempCanvasID;
  4348 +
  4349 + if (IsMirror == 'Yes') {
  4350 + tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
  4351 + }
  4352 + else {
  4353 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4354 + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;//bodyRegionId;
  4355 + }
  4356 + else
  4357 + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;
  4358 + }
4472 4359
4473 tempImg.onload = function () { 4360 tempImg.onload = function () {
  4361 +
4474 var tempCtx = transparencyTempCanvas.getContext('2d'); 4362 var tempCtx = transparencyTempCanvas.getContext('2d');
4475 4363
4476 if (IsMirror == 'Yes') { 4364 if (IsMirror == 'Yes') {
@@ -4479,126 +4367,53 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4479,126 +4367,53 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4479 tempCtx.translate(Width, 0); 4367 tempCtx.translate(Width, 0);
4480 tempCtx.scale(-1, 1); 4368 tempCtx.scale(-1, 1);
4481 tempCtx.drawImage(tempImg, 0, 0); 4369 tempCtx.drawImage(tempImg, 0, 0);
4482 - }  
4483 - else {  
4484 - tempCtx.drawImage(tempImg, 0, 0);  
4485 -  
4486 - }  
4487 - // debugger;  
4488 - var tempCanvasID;  
4489 -  
4490 - if (IsMirror == 'Yes') {  
4491 - tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;  
4492 - }  
4493 - else {  
4494 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4495 - tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;//bodyRegionId;  
4496 - }  
4497 - else  
4498 - tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;  
4499 - }  
4500 -  
4501 -  
4502 - //check if transparency is activated  
4503 -  
4504 -  
4505 - var transNumber = $scope.transNumber;//txtTransparencyChange.value;  
4506 - // debugger;  
4507 - //this changes the transparency when transparency is already activated and user resizes or chage the layer  
4508 -  
4509 - var imageD = tempCtx.getImageData(0, 0, Width, Height);  
4510 -  
4511 -  
4512 - var tempCtx = document.getElementById(tempCanvasID).getContext('2d');  
4513 -  
4514 - //keep the original image on temp canavs to use it in changing transparency  
4515 -  
4516 -  
4517 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4518 - var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;  
4519 - if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) {  
4520 - var contxModesty = document.getElementById(modestyTempCanvasId).getContext('2d');  
4521 - var tbTempCanvas = document.getElementById(tempCanvasID)  
4522 - contxModesty.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);  
4523 4370
  4371 + if ($rootScope.isHighLight == true) {
  4372 + // var tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;
  4373 + $scope.highlightTempTransparencyCanvas(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage,
  4374 + XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId);
4524 } 4375 }
4525 } 4376 }
4526 else { 4377 else {
4527 4378
4528 - if (document.getElementById('tempCanvas') != null && document.getElementById('tempCanvas') != undefined) {  
4529 - var contx = document.getElementById('tempCanvas').getContext('2d');  
4530 - var tbTempCanvas = document.getElementById(tempCanvasID)  
4531 - contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);  
4532 -  
4533 - }  
4534 - } 4379 + tempCtx.drawImage(tempImg, 0, 0);
4535 4380
4536 - // get the image data values 4381 + if ($rootScope.isHighLight == true) {
  4382 + $scope.highlightTempTransparencyCanvas(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage,
  4383 + YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId);
4537 4384
4538 - var imageData = imageD.data;  
4539 - var length = imageData.length; 4385 + }
4540 4386
4541 - //change background of image from transparent to white 4387 + }
  4388 +
4542 4389
4543 - // set every fourth value to 50  
4544 - for (var i = 3; i < length; i += 4) {  
4545 - //NIKITA  
4546 - if ($scope.voId == "9" || $scope.voId == "11") { 4390 +
  4391 + if ($rootScope.isHighLight != true) {
  4392 +
4547 4393
4548 - if (imageData[i] == 0) { 4394 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4395 + var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;
  4396 + if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) {
  4397 + var contxModestyTemp = document.getElementById(modestyTempCanvasId).getContext('2d');
  4398 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4399 + contxModestyTemp.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
4549 4400
4550 } 4401 }
4551 - else {  
4552 - imageData[i] = ((255) * (parseInt(transNumber))) / 100;  
4553 - }  
4554 } 4402 }
4555 else { 4403 else {
4556 - if (imageData[i] == 0) {  
4557 -  
4558 - }  
4559 - else {  
4560 - imageData[i] = ((255) * (parseInt(transNumber))) / 100;  
4561 - }  
4562 - }  
4563 - }  
4564 4404
  4405 + if (document.getElementById('tempCanvas') != null && document.getElementById('tempCanvas') != undefined) {
  4406 + var contx = document.getElementById('tempCanvas').getContext('2d');
  4407 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4408 + contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
4565 4409
4566 - tempCtx.putImageData(imageD, 0, 0);  
4567 -  
4568 - var ctx;  
4569 - if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4570 - ctx = document.getElementById(modestyTransCanvasId).getContext('2d');  
4571 - }  
4572 - else  
4573 - ctx = transparencyCanvas.getContext('2d'); 4410 + }
  4411 + }
4574 4412
  4413 + $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId);
4575 4414
4576 - var TrtempCanvasID  
4577 - if (IsMirror == 'Yes') {  
4578 - TrtempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId;  
4579 - }  
4580 - else {  
4581 - //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {  
4582 - // TrtempCanvasID = 'modestyTransparencyTempCanvas_' + bodyRegionId;  
4583 - //}  
4584 - //else  
4585 - TrtempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;  
4586 } 4415 }
4587 -  
4588 - var tmpCanvasContext = document.getElementById(TrtempCanvasID);//.getContext('2d');  
4589 -  
4590 - ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage)  
4591 -  
4592 -  
4593 - XforCopyImage = 0;  
4594 - YforCopyImage = 0;  
4595 - WidthforCopyImage = 0;  
4596 - HeightforCopyImage = 0;  
4597 - XforTransImage = 0;  
4598 - WidthforTransImage = 0;  
4599 - HeightforTransImage = 0;  
4600 - YforTransImage = 0;  
4601 - PreviousBodyRegionHeight = 0; 4416 +
4602 4417
4603 } 4418 }
4604 tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; 4419 tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc;
@@ -4606,7 +4421,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4606,7 +4421,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4606 4421
4607 } 4422 }
4608 4423
4609 -  
4610 //mask image code 4424 //mask image code
4611 //draw mask for annotation 4425 //draw mask for annotation
4612 var tempMaskImg = new Image(); 4426 var tempMaskImg = new Image();
@@ -4631,14 +4445,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4631,14 +4445,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4631 4445
4632 } 4446 }
4633 4447
4634 -  
4635 - PreviousBodyRegionHeight = HeightforTransImage;  
4636 - PreviousBodyRegionY = YforTransImage;  
4637 - PreviousBodyRegionWidth = WidthforTransImage;  
4638 - PreviousBodyRegionX = XforTransImage;  
4639 - previousBodyRegionId = bodyRegionId;  
4640 -  
4641 -  
4642 //set modesty image visiblility true/false as per layer 4448 //set modesty image visiblility true/false as per layer
4643 4449
4644 4450
@@ -4676,6 +4482,263 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4676,6 +4482,263 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4676 4482
4677 } 4483 }
4678 4484
  4485 +
  4486 + $scope.calculateDimensionsForTBImage = function (Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, bodyRegionId) {
  4487 +
  4488 + var XforCopyImage = 0;
  4489 + var YforCopyImage = 0;
  4490 + var WidthforCopyImage = 0;
  4491 + var HeightforCopyImage = 0;
  4492 + var XforTransImage = 0;
  4493 + var WidthforTransImage = 0;
  4494 + var HeightforTransImage = 0;
  4495 + var YforTransImage = 0;
  4496 +
  4497 +
  4498 + //X ends outside and start outside of bodyregion
  4499 + if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) {
  4500 + XforCopyImage = 0;
  4501 + WidthforCopyImage = Width;
  4502 + WidthforTransImage = Width;
  4503 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4504 + XforTransImage = 0;
  4505 + }
  4506 + else
  4507 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4508 + }
  4509 + else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
  4510 +
  4511 + XforCopyImage = 0;
  4512 +
  4513 + WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(X);
  4514 +
  4515 + WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X);
  4516 +
  4517 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4518 + XforTransImage = 0;
  4519 + }
  4520 + else
  4521 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4522 +
  4523 + }
  4524 + else if (TransparencyBoxStartX > X && TransparencyEndX > parseInt(X) + parseInt(Width)) {
  4525 +
  4526 + XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  4527 + WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
  4528 + WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX);
  4529 +
  4530 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4531 +
  4532 + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  4533 + }
  4534 + else
  4535 + XforTransImage = 0;
  4536 + }
  4537 + else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
  4538 + XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ;
  4539 + WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
  4540 + WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX);
  4541 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4542 +
  4543 + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
  4544 + }
  4545 + else
  4546 + XforTransImage = 0;
  4547 + }
  4548 +
  4549 + //calculate Y and height for tempTranparency box from where to cut the image
  4550 +
  4551 +
  4552 + if (TransparencyBoxStartY < Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
  4553 +
  4554 + YforCopyImage = 0;
  4555 + HeightforCopyImage = Height;
  4556 +
  4557 + HeightforTransImage = Height;
  4558 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4559 + YforTransImage = 0;
  4560 + }
  4561 + else
  4562 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
  4563 + }
  4564 + else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {
  4565 +
  4566 + YforCopyImage = 0;
  4567 + HeightforCopyImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)//(parseInt(Height) + parseInt(Y)) - (parseInt(TransparencyBoxEndY) - parseInt(scope.TransparencyBoxStartY));
  4568 +
  4569 + HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY));
  4570 +
  4571 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4572 + YforTransImage = 0;
  4573 + }
  4574 + else
  4575 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
  4576 +
  4577 + }
  4578 + else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
  4579 +
  4580 + YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  4581 + HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
  4582 + HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY);
  4583 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4584 + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  4585 +
  4586 + }
  4587 + else
  4588 + YforTransImage = 0;
  4589 +
  4590 + }
  4591 + else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) {
  4592 +
  4593 + YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  4594 + HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
  4595 + HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY);
  4596 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4597 + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y);
  4598 +
  4599 + }
  4600 + else
  4601 + YforTransImage = 0;
  4602 + }
  4603 +
  4604 + return {
  4605 +
  4606 +
  4607 + XforCopyImageTB : XforCopyImage,
  4608 + YforCopyImageTB: YforCopyImage,
  4609 + WidthforCopyImageTB: WidthforCopyImage,
  4610 + HeightforCopyImageTB: HeightforCopyImage,
  4611 + XforTransImageTB: XforTransImage,
  4612 + WidthforTransImageTB: WidthforTransImage,
  4613 + HeightforTransImageTB: HeightforTransImage,
  4614 + YforTransImageTB: YforTransImage
  4615 +
  4616 + }
  4617 + }
  4618 +
  4619 + $scope.highlightTempTransparencyCanvas = function (tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId) {
  4620 +
  4621 + var tempTransCanvas = document.getElementById(tempCanvasID);
  4622 + var tempCanvasContext = tempTransCanvas.getContext('2d');
  4623 +
  4624 + var dataURL = tempTransCanvas.toDataURL();
  4625 +
  4626 + var img = new Image();
  4627 + img.src = dataURL;
  4628 +
  4629 + img.onload = function () {
  4630 +
  4631 + var DAData = new BitmapData(parseInt(tempTransCanvas.width), parseInt(tempTransCanvas.height));
  4632 + DAData.draw(img);
  4633 +
  4634 + var colorMode = $scope.applyGrayMatrix(img, tempCanvasContext);
  4635 +
  4636 + if (colorMode != undefined || colorMode != null) {
  4637 +
  4638 + var zeroPoint = new Point();
  4639 +
  4640 + DAData.applyFilter(DAData, DAData.rect, zeroPoint, colorMode);
  4641 +
  4642 +
  4643 + tempCanvasContext.putImageData(DAData.data, 0, 0);
  4644 +
  4645 + //keep the original image on temp canavs to use it in changing transparency
  4646 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4647 + var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId;
  4648 + if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) {
  4649 + var contxModestyTemp = document.getElementById(modestyTempCanvasId).getContext('2d');
  4650 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4651 + contxModestyTemp.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4652 +
  4653 + }
  4654 + }
  4655 + else {
  4656 + if (document.getElementById('tempCanvas') != null) {
  4657 +
  4658 + var contx = document.getElementById('tempCanvas').getContext('2d');
  4659 + var tbTempCanvas = document.getElementById(tempCanvasID)
  4660 + contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage);
  4661 +
  4662 + }
  4663 + }
  4664 +
  4665 + $scope.DrawOnTBWithSelectedTransparency(tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId);
  4666 + }
  4667 + }
  4668 + }
  4669 +
  4670 +
  4671 + $scope.DrawOnTBWithSelectedTransparency = function (tempCanvasID, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage, Height, Width, bodyRegionId) {
  4672 +
  4673 + var transNumber = $scope.transNumber;//txtTransparencyChange.value;
  4674 + //this changes the transparency when transparency is already activated and user resizes or chage the layer
  4675 +
  4676 + var tempCtx = document.getElementById(tempCanvasID).getContext('2d');
  4677 +
  4678 + var imageD = tempCtx.getImageData(0, 0, Width, Height);
  4679 + var imageData = imageD.data;
  4680 + var length = imageData.length;
  4681 +
  4682 +
  4683 + // set every fourth value to the desired number of transparency
  4684 + for (var i = 3; i < length; i += 4) {
  4685 + if ($scope.voId == "9" || $scope.voId == "11") {
  4686 +
  4687 + if (imageData[i] == 0) {
  4688 +
  4689 + }
  4690 + else {
  4691 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4692 + }
  4693 + }
  4694 + else {
  4695 + imageData[i] = ((255) * (parseInt(transNumber))) / 100;
  4696 + }
  4697 + }
  4698 +
  4699 +
  4700 + tempCtx.putImageData(imageD, 0, 0);
  4701 +
  4702 +
  4703 + $scope.widthOfImage = WidthforTransImage;
  4704 + $scope.heightOfImage = HeightforTransImage;
  4705 + $scope.xOfImage = XforTransImage;
  4706 + $scope.yOfImage = YforTransImage;
  4707 +
  4708 + var ctx = transparencyCanvas.getContext('2d');
  4709 +
  4710 +
  4711 + var tmpCanvasContext = document.getElementById(tempCanvasID);//.getContext('2d');
  4712 +
  4713 +
  4714 +
  4715 + var ctx;
  4716 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
  4717 + var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId
  4718 + ctx = document.getElementById(modestyTransCanvasId).getContext('2d');
  4719 + }
  4720 + else
  4721 + ctx = transparencyCanvas.getContext('2d');
  4722 +
  4723 + // var ctx = transparencyCanvas.getContext('2d');
  4724 + ctx.drawImage(tmpCanvasContext, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage)
  4725 +
  4726 + $scope.transparencyDrawnRegions.push(bodyRegionId);
  4727 +
  4728 +
  4729 + $rootScope.isLoading = false;
  4730 + $('#spinner').css('visibility', 'hidden');
  4731 +
  4732 + if ($scope.transparencyDrawnRegions.length == $scope.IncludedBodyRegions.length) {
  4733 +
  4734 + transparencyCanvas.style.visibility = 'visible';
  4735 + $('.rectangle').remove();
  4736 +
  4737 +
  4738 + }
  4739 + }
  4740 +
  4741 +
4679 $scope.changeTransparency = function () { 4742 $scope.changeTransparency = function () {
4680 //this changes the transparency when user click on transparency scale(we have already set the original 4743 //this changes the transparency when user click on transparency scale(we have already set the original
4681 //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated) 4744 //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated)
@@ -4973,6 +5036,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4973,6 +5036,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4973 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; 5036 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
4974 5037
4975 $scope.IncludedBodyRegions = []; 5038 $scope.IncludedBodyRegions = [];
  5039 + $scope.transparencyDrawnRegions = [];
4976 // $scope.layerNo = parseInt(document.getElementById('')) 5040 // $scope.layerNo = parseInt(document.getElementById(''))
4977 var counter = 0; 5041 var counter = 0;
4978 $.each(BodyRegionDictionary, function (index, value) { 5042 $.each(BodyRegionDictionary, function (index, value) {
@@ -5482,7 +5546,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -5482,7 +5546,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
5482 ctx.putImageData(originalTransparencyData, 0, 0); 5546 ctx.putImageData(originalTransparencyData, 0, 0);
5483 5547
5484 5548
5485 - 5549 + $scope.transparencyDrawnRegions = [];
5486 //for modesty 5550 //for modesty
5487 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { 5551 if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) {
5488 $.each($scope.modestyImageInfo, function (index, value) { 5552 $.each($scope.modestyImageInfo, function (index, value) {