Commit 414afdff19b866b161c9d76bd2b90ad52f46aaa3

Authored by Amrita Vishnoi
2 parents e8674218 7b9b01fd

Merge branch 'AnnotationIssueInTB' into Develop

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -777,8 +777,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
777 777 if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) {
778 778  
779 779 $("#canvasDiv").append('<canvas id="canvasPaint" width="2277" height="3248" class="canvas-annotationStyle1"></canvas><canvas id="canvas" width="2277" height="3248" class="canvas-annotationStyle"></canvas>');
780   - $scope.BindCanvasDrawingListners();
781   - // $rootScope.FreeStylePaint();
  780 + $scope.BindCanvasDrawingListners();
  781 + // $rootScope.FreeStylePaint();
782 782  
783 783 }
784 784  
... ... @@ -1400,7 +1400,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1400 1400 }
1401 1401 }
1402 1402  
1403   - // $rootScope.previousHighlightList.push(RGBColor);
  1403 + // $rootScope.previousHighlightList.push(RGBColor);
1404 1404  
1405 1405 $scope.highLightBodyBasedOnIcolor(RGBColor);
1406 1406 }
... ... @@ -1412,7 +1412,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1412 1412 //}
1413 1413  
1414 1414 //extarct clicked body part is extarct button is already enabled.
1415   - // debugger;
  1415 + // debugger;
1416 1416 if ($rootScope.isExtract == true) {
1417 1417 $scope.enableExtract(false);
1418 1418 }
... ... @@ -1535,7 +1535,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1535 1535  
1536 1536 // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length)
1537 1537  
1538   - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  1538 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
1539 1539  
1540 1540 if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
1541 1541 $scope.isEligibleForHighlight = true;
... ... @@ -1773,7 +1773,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1773 1773 }
1774 1774 }
1775 1775  
1776   - // $rootScope.previousHighlightList.push(RGBColor);
  1776 + // $rootScope.previousHighlightList.push(RGBColor);
1777 1777  
1778 1778  
1779 1779 if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { }
... ... @@ -1788,7 +1788,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1788 1788 // $rootScope.previousHighlightList.push(RGBColor);
1789 1789 //}
1790 1790  
1791   - // debugger;
  1791 + // debugger;
1792 1792 //extarct clisked body part is extarct button is already enabled.
1793 1793 if ($rootScope.isExtract == true) {
1794 1794 $scope.enableExtract(false);
... ... @@ -2254,7 +2254,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2254 2254 $scope.aligneCanvasWithTerm()
2255 2255 }
2256 2256  
2257   - // $timeout(function () { $scope.DisableProgressBar() }, 1000);
  2257 + // $timeout(function () { $scope.DisableProgressBar() }, 1000);
2258 2258  
2259 2259  
2260 2260  
... ... @@ -2489,17 +2489,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2489 2489 }
2490 2490 else {
2491 2491 var canvasDiv = document.getElementById('canvasDiv');
2492   - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
2493   - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
  2492 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
  2493 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
2494 2494  
2495   - $rootScope.isLoading = false;
  2495 + $rootScope.isLoading = false;
2496 2496  
2497   - $('#spinner').css('visibility', 'hidden');
  2497 + $('#spinner').css('visibility', 'hidden');
2498 2498 //$('#canvasDiv').scrollLeft(newX);
2499   - //$('#canvasDiv').scrollTop(newY);
  2499 + //$('#canvasDiv').scrollTop(newY);
2500 2500 }
2501 2501  
2502   - // $rootScope.isHighlightBodyByBodySystem = false;
  2502 + // $rootScope.isHighlightBodyByBodySystem = false;
2503 2503  
2504 2504  
2505 2505 }
... ... @@ -2695,46 +2695,46 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2695 2695  
2696 2696 var tCanvas = document.getElementById('transparencyCanvas');
2697 2697  
2698   - var tCanvasContext = tCanvas.getContext('2d');
  2698 + var tCanvasContext = tCanvas.getContext('2d');
2699 2699  
2700   - var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
  2700 + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
2701 2701  
2702   - var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
  2702 + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
2703 2703  
2704 2704  
2705   - // var tCanvas = document.getElementById('transparencyCanvas');
2706   - if (tCanvas != null) {
2707   - clearTransCanvas();
2708   - }
2709   - var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
2710   - var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
2711   - var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
2712   - var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
2713   - var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight);
2714   - var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth);
  2705 + // var tCanvas = document.getElementById('transparencyCanvas');
  2706 + if (tCanvas != null) {
  2707 + clearTransCanvas();
  2708 + }
  2709 + var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
  2710 + var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
  2711 + var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
  2712 + var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
  2713 + var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight);
  2714 + var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth);
2715 2715  
2716   - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  2716 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
2717 2717  
2718   - $.each(BodyRegionDictionary, function (index, value) {
2719   - //debugger;
2720   - // alert(' $.each(BodyRegionDictionary1')
  2718 + $.each(BodyRegionDictionary, function (index, value) {
  2719 + //debugger;
  2720 + // alert(' $.each(BodyRegionDictionary1')
2721 2721  
2722   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
2723   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  2722 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  2723 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
2724 2724  
2725 2725  
2726   - // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
2727   - if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
2728   - //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
2729   - // debugger;
2730   - $scope.layerNumber = parseInt(txtlayerNumber.value);
  2726 + // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
  2727 + if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  2728 + //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
  2729 + // debugger;
  2730 + $scope.layerNumber = parseInt(txtlayerNumber.value);
2731 2731  
2732 2732  
2733   - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false);
2734   - }
  2733 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false);
  2734 + }
2735 2735  
2736 2736  
2737   - })
  2737 + })
2738 2738  
2739 2739 }
2740 2740  
... ... @@ -2792,10 +2792,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2792 2792 if ($("#txtlayerNumber").val() == '') {
2793 2793 var layerInputVal = 0;
2794 2794  
2795   - var layerInputValInc = parseInt(layerInputVal);
2796   - $scope.layerNumber = parseInt(layerInputValInc);
2797   - $("#txtlayerNumber").val($scope.layerNumber);
2798   - // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
  2795 + var layerInputValInc = parseInt(layerInputVal);
  2796 + $scope.layerNumber = parseInt(layerInputValInc);
  2797 + $("#txtlayerNumber").val($scope.layerNumber);
  2798 + // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
2799 2799  
2800 2800 }
2801 2801 else {
... ... @@ -2818,7 +2818,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2818 2818 var layerInputValDec = parseInt(layerInputVal);
2819 2819 $scope.layerNumber = parseInt(layerInputValDec);
2820 2820 $("#txtlayerNumber").val($scope.layerNumber);
2821   - // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
  2821 + // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
2822 2822  
2823 2823 }
2824 2824 else
... ... @@ -3105,10 +3105,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3105 3105  
3106 3106 //$("#bord").css("display", "none");
3107 3107 //$("#dot").css("display", "none");
3108   - $('#sppeachBubble').remove();
  3108 + $('#sppeachBubble').remove();
3109 3109  
3110   - $("#bord").remove();
3111   - $("#dot").remove();
  3110 + $("#bord").remove();
  3111 + $("#dot").remove();
3112 3112  
3113 3113 });
3114 3114  
... ... @@ -3535,7 +3535,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3535 3535 drag: function (evt) {
3536 3536  
3537 3537 //$("#dot_annotation").css("display", "none");
3538   - $("#dot_annotation").remove();
  3538 + $("#dot_annotation").remove();
3539 3539  
3540 3540 var verticalScrollPosition = canvasDiv.scrollTop;
3541 3541 var horizontlScrollPosition = canvasDiv.scrollLeft;
... ... @@ -4039,7 +4039,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4039 4039 XforTransImage = 0;
4040 4040 }
4041 4041 else
4042   - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4042 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4043 4043 // alert('1')
4044 4044 }
4045 4045 else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
... ... @@ -4055,7 +4055,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4055 4055 XforTransImage = 0;
4056 4056 }
4057 4057 else
4058   - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4058 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4059 4059  
4060 4060 // alert('2')
4061 4061 }
... ... @@ -4071,7 +4071,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4071 4071 XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
4072 4072 }
4073 4073 else
4074   - XforTransImage = 0;
  4074 + XforTransImage = 0;
4075 4075 // alert('3')
4076 4076 }
4077 4077 else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
... ... @@ -4104,7 +4104,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4104 4104 YforTransImage = 0;
4105 4105 }
4106 4106 else
4107   - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
  4107 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
4108 4108 // alert('5')
4109 4109 }
4110 4110 else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {
... ... @@ -4118,7 +4118,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4118 4118 YforTransImage = 0;
4119 4119 }
4120 4120 else
4121   - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
  4121 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
4122 4122  
4123 4123 }
4124 4124 else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
... ... @@ -4210,12 +4210,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4210 4210 oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId)
4211 4211 }
4212 4212 else {
4213   - //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) {
4214   - // oldCanvas = document.getElementById('modestyTransparencyTempCanvas_' + bodyRegionId);
4215   - //}
4216   - //else {
  4213 +
4217 4214 oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId)
4218   - //}
  4215 +
4219 4216 }
4220 4217  
4221 4218 if (oldCanvas != null) {
... ... @@ -4224,8 +4221,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4224 4221  
4225 4222 //remove tempmask canvas
4226 4223 var oldtempTransCanvasMask;
  4224 + var oldtempTransCanvasMaskMR;
4227 4225 if (IsMirror == 'Yes') {
4228   - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci');
  4226 + oldtempTransCanvasMaskMR = document.getElementById('transparencyTempCanvasMask_MR' + bodyRegionId + '_mci');
  4227 + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
  4228 +
  4229 + if (oldtempTransCanvasMaskMR != null) {
  4230 + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMaskMR);
  4231 + }
4229 4232 }
4230 4233 else {
4231 4234 oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci');
... ... @@ -4321,7 +4324,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4321 4324 canvasModesty.style.top = Y + 'px';
4322 4325 //canvasModesty.style.backgroundColor = "transparent";
4323 4326 canvasModesty.style.visibility = 'visible';
4324   - canvasModesty.style.zIndex = '2000'
  4327 + canvasModesty.style.zIndex = '2000';
  4328 + canvasModesty.addEventListener('click', OnClickModestyTransCanvas);
  4329 +
4325 4330 // tempcanvasModestyCanvasModesty.style.border = "black 1px solid";
4326 4331 document.getElementById('canvasDiv').appendChild(canvasModesty);
4327 4332 }
... ... @@ -4776,49 +4781,49 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4776 4781 var isMirror;
4777 4782 var width;
4778 4783 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
4779   - if ($rootScope.viewOrientationId == 5) {
  4784 + if ($rootScope.viewOrientationId == 5) {
4780 4785  
4781   - var clickedBodyRegionData = new jinqJs()
4782   - .from(BodyRegionDictionary)
4783   - .where('bodyRegionId == 6')
4784   - .select();
  4786 + var clickedBodyRegionData = new jinqJs()
  4787 + .from(BodyRegionDictionary)
  4788 + .where('bodyRegionId == 6')
  4789 + .select();
4785 4790  
4786 4791  
4787   - // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
4788   - x = clickedBodyRegionData[0].X;
4789   - y = clickedBodyRegionData[0].Y;
4790   - width = clickedBodyRegionData[0].Width;
4791   - var height = clickedBodyRegionData[0].Height;
4792   - isMirror = clickedBodyRegionData[0].IsMirror;
4793   - var bodyRegionRight = parseInt(x) + parseInt(width);
4794   - var bodyRegionBottom = parseInt(y) + parseInt(height);
4795   - if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) {
  4792 + // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
  4793 + x = clickedBodyRegionData[0].X;
  4794 + y = clickedBodyRegionData[0].Y;
  4795 + width = clickedBodyRegionData[0].Width;
  4796 + var height = clickedBodyRegionData[0].Height;
  4797 + isMirror = clickedBodyRegionData[0].IsMirror;
  4798 + var bodyRegionRight = parseInt(x) + parseInt(width);
  4799 + var bodyRegionBottom = parseInt(y) + parseInt(height);
  4800 + if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) {
4796 4801  
4797   - clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
4798   - x = clickedBodyRegionData[0].X;
4799   - y = clickedBodyRegionData[0].Y;
4800   - width = clickedBodyRegionData[0].Width;
4801   - var height = clickedBodyRegionData[0].Height;
4802   - isMirror = clickedBodyRegionData[0].IsMirror;
4803   - }
  4802 + clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
  4803 + x = clickedBodyRegionData[0].X;
  4804 + y = clickedBodyRegionData[0].Y;
  4805 + width = clickedBodyRegionData[0].Width;
  4806 + var height = clickedBodyRegionData[0].Height;
  4807 + isMirror = clickedBodyRegionData[0].IsMirror;
  4808 + }
4804 4809  
4805   - }
4806   - else {
4807   - $.each(BodyRegionDictionary, function (index, value) {
  4810 + }
  4811 + else {
  4812 + $.each(BodyRegionDictionary, function (index, value) {
4808 4813  
4809   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
4810   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
4811   - if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) {
  4814 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  4815 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  4816 + if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) {
4812 4817  
4813   - clickedBodyRegion = value.bodyRegionId;
4814   - x = value.X;
4815   - y = value.Y;
4816   - width = value.Width;
4817   - isMirror = value.IsMirror;
4818   - return false;
4819   - }
4820   - })
4821   - }
  4818 + clickedBodyRegion = value.bodyRegionId;
  4819 + x = value.X;
  4820 + y = value.Y;
  4821 + width = value.Width;
  4822 + isMirror = value.IsMirror;
  4823 + return false;
  4824 + }
  4825 + })
  4826 + }
4822 4827  
4823 4828  
4824 4829 if (isMirror == "Yes") {
... ... @@ -4829,30 +4834,37 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4829 4834 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4830 4835 var clickedCanavs = document.getElementById(clickedCanvasMaskId);
4831 4836  
4832   - //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation
4833   - var clickedBodyRegionData = new jinqJs()
4834   - .from(BodyRegionDictionary)
4835   - .where('bodyRegionId == ' + clickedBodyRegion)
4836   - .select();
4837   - if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) {
  4837 + var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4838 + var maskCanvas = document.getElementById(maskCanvasId);
  4839 +
  4840 + if (maskCanvas != null) {
  4841 + x = maskCanvas.style.left;
  4842 + y = maskCanvas.style.top;
4838 4843  
4839   - var nomMirroredBodyRegion = new jinqJs()
4840   - .from(clickedBodyRegionData)
4841   - .where('IsMirror == No')
4842   - .select();
  4844 + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4845 + var maskCanvastrans = document.getElementById(maskCanvasTransId);
  4846 + var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
4843 4847  
4844 4848  
4845   - //debugger;
4846   - var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4847   - var maskCanvas = document.getElementById(maskCanvasId);
4848   - //if (oldMirrorMask != null) {
4849   - // document.getElementById('canvasDiv').removeChild(oldMirrorMask);
4850   - //}
4851   - if (maskCanvas != null) {
4852   - x = maskCanvas.style.left;
4853   - y = maskCanvas.style.top;
4854   - }
4855   - if (maskCanvas == null) {
  4849 + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt)
  4850 +
  4851 +
  4852 + }
  4853 +
  4854 + //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation
  4855 +
  4856 + else if (maskCanvas == null) {
  4857 + var clickedBodyRegionData = new jinqJs()
  4858 + .from(BodyRegionDictionary)
  4859 + .where('bodyRegionId == ' + clickedBodyRegion)
  4860 + .select();
  4861 + if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) {
  4862 +
  4863 + var nomMirroredBodyRegion = new jinqJs()
  4864 + .from(clickedBodyRegionData)
  4865 + .where('IsMirror == No')
  4866 + .select();
  4867 +
4856 4868 var transparencyTempcanavsMask = document.createElement('canvas');
4857 4869 transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4858 4870 transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;
... ... @@ -4865,8 +4877,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4865 4877 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
4866 4878  
4867 4879 var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
4868   - var tempMaskImg = new Image();
4869 4880 var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4881 +
  4882 + var tempMaskImg = new Image();
  4883 + tempMaskImg.src = tranparencyMaskImgSrc;
  4884 +
4870 4885 tempMaskImg.onload = function () {
4871 4886 var transparencyTempcanavsMask = document.getElementById(maskCanvasId);
4872 4887 var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
... ... @@ -4875,70 +4890,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4875 4890 //get x,y of non mirrored canvas for this body region
4876 4891 x = transparencyTempcanavsMask.style.left;
4877 4892 y = transparencyTempcanavsMask.style.top;
4878   - }
4879   - tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;
4880   - }
4881   - var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4882   - var maskCanvastrans = document.getElementById(maskCanvasTransId);
4883   - var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
4884   -
4885   -
4886   -
4887 4893  
4888   - var canvasDiv = document.getElementById('canvasDiv');
4889   - var verticalScrollPosition = canvasDiv.scrollTop;
4890   - var horizontlScrollPosition = canvasDiv.scrollLeft;
  4894 + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, tempmaskCtx, clickedBodyRegion, x, y, evt)
4891 4895  
4892   - var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
4893   -
4894   - var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
4895   -
4896   - var actulalX = mirrorXOnNormalImage
4897   - var actualY = mousePos.y + verticalScrollPosition
4898   -
4899   -
4900   -
4901   - var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4902   - var maskCanvas = document.getElementById(clickedCanvasMaskId);
4903   - var maskCanvasContext = maskCanvas.getContext("2d");
4904   - var imgX = Math.round(actulalX - parseInt(x));//.replace('px', '')));
4905   - var imgY = Math.round(actualY - parseInt(y));//.replace('px', '')));
4906   - pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
4907   -
4908   -
4909   - //trans layer image data
4910   - pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
4911   - // console.log('at the time' + pixelData.data[0])
4912   - // debugger;
4913   - var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
4914   - if ($('#speechBubble').length > 0)
4915   - $('#speechBubble').remove();
4916   -
4917   -
4918   - if ($('#speechBubbleTrns').length > 0) {
4919   - $('#speechBubbleTrns').remove();
4920   -
4921   - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4922   -
4923   - $scope.annotationTextArrayT1 = [];
4924   - $scope.annotationTextArrayT2 = [];
4925   - $scope.annotationTextArrayT1.push(annotations.annotationT1);
4926   - $scope.annotationTextArrayT2.push(annotations.annotationT2);
4927   -
4928   - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4929 4896 }
4930   - else
4931   - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4932   -
4933   - $scope.annotationTextArrayT1 = [];
4934   - $scope.annotationTextArrayT2 = [];
4935   - $scope.annotationTextArrayT1.push(annotations.annotationT1);
4936   - $scope.annotationTextArrayT2.push(annotations.annotationT2);
4937   -
4938   - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4939   -
4940   -
  4897 + }
4941 4898 }
  4899 +
4942 4900  
4943 4901 }
4944 4902 else {
... ... @@ -4975,21 +4933,160 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4975 4933 }
4976 4934 else
4977 4935 // $scope.createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4936 + {
4978 4937  
  4938 + $scope.annotationTextArrayT1 = [];
  4939 + $scope.annotationTextArrayT2 = [];
  4940 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4941 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4942 +
  4943 +
  4944 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4945 + }
  4946 +
  4947 + }
  4948 +
  4949 +
  4950 + }
  4951 +
  4952 + function OnClickModestyTransCanvas(evt) {
  4953 +
  4954 + var mousePos = $scope.getMousePos(evt);
  4955 + var canvasDiv = document.getElementById('canvasDiv');
  4956 + var verticalScrollPosition = canvasDiv.scrollTop;
  4957 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  4958 +
  4959 + var actulalX = mousePos.x + horizontlScrollPosition;
  4960 + var actualY = mousePos.y + verticalScrollPosition;
  4961 +
  4962 + var canavsX = evt.currentTarget.offsetLeft;
  4963 + var canvasY = evt.currentTarget.offsetTop;
  4964 +
  4965 + var canvasId = evt.currentTarget.id;
  4966 + var canavsContext = document.getElementById(canvasId).getContext('2d');
  4967 + var RGBColor = $scope.GetRGBColor(canavsContext, actulalX, actualY, canavsX, canvasY);
  4968 +
  4969 + var annotationText;
  4970 +
  4971 + //Modesty ON
  4972 + if (canvasId.match('modestyImg') && RGBColor != '000000') {
  4973 + RGBColor = DA[0].figLeafTermId;
  4974 + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor);
  4975 + $scope.annotationTextArrayT1 = [];
  4976 + $scope.annotationTextArrayT2 = [];
  4977 + $scope.annotationTextArrayT1.push(annotationText);
  4978 + $scope.annotationTextArrayT2.push(annotationText);
  4979 + }
  4980 + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to
  4981 + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er
  4982 + //
  4983 + else if (canvasId.match('modestyImg') && RGBColor == '000000') {
  4984 +
  4985 + var bodyRegionId = canvasId.slice(-1);
  4986 +
  4987 + var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
  4988 + var maskCanvas = document.getElementById(maskCanvasId);
  4989 + var maskCanvasContext = maskCanvas.getContext("2d");
  4990 + //RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY);
  4991 + //annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  4992 +
  4993 + //transparecncy canvas
  4994 + var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci';
  4995 + var maskCanvastrans = document.getElementById(maskCanvasTransId);
  4996 + var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
  4997 +
  4998 + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1);
  4999 +
  5000 + var pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1);
  5001 +
  5002 + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  5003 +
  5004 +
  5005 + // var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
  5006 + // var maskCanvas = document.getElementById(maskCanvasId);
  5007 + // var maskCanvasContext = maskCanvas.getContext("2d");
  5008 + // RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY);
  5009 + // annotationText = $scope.GetAnnotationText(parseInt(RGBColor));
  5010 +
  5011 +
  5012 + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4979 5013  
4980 5014 $scope.annotationTextArrayT1 = [];
  5015 + $scope.annotationTextArrayT2 = [];
  5016 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  5017 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  5018 +
  5019 + }
  5020 +
  5021 + if ($('#speechBubble').length > 0)
  5022 + $('#speechBubble').remove();
  5023 +
  5024 +
  5025 + if ($('#speechBubbleTrns').length > 0) {
  5026 + $('#speechBubbleTrns').remove();
  5027 + }
  5028 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  5029 +
  5030 +
  5031 + }
  5032 +
  5033 + function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt)
  5034 + {
  5035 + var canvasDiv = document.getElementById('canvasDiv');
  5036 + var verticalScrollPosition = canvasDiv.scrollTop;
  5037 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  5038 +
  5039 + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
  5040 +
  5041 + var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
  5042 +
  5043 + var actulalX = mirrorXOnNormalImage
  5044 + var actualY = mousePos.y + verticalScrollPosition
  5045 +
  5046 +
  5047 +
  5048 + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
  5049 + var maskCanvas = document.getElementById(clickedCanvasMaskId);
  5050 + var maskCanvasContext = maskCanvas.getContext("2d");
  5051 + var imgX = Math.round(actulalX - parseInt((x).replace('px', '')));
  5052 + var imgY = Math.round(actualY - parseInt((y).replace('px', '')));
  5053 + var pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
  5054 +
  5055 +
  5056 + //trans layer image data
  5057 + var pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
  5058 + // console.log('at the time' + pixelData.data[0])
  5059 + // debugger;
  5060 + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  5061 + if ($('#speechBubble').length > 0)
  5062 + $('#speechBubble').remove();
  5063 +
  5064 +
  5065 + if ($('#speechBubbleTrns').length > 0) {
  5066 + $('#speechBubbleTrns').remove();
  5067 +
  5068 + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  5069 +
  5070 + $scope.annotationTextArrayT1 = [];
4981 5071 $scope.annotationTextArrayT2 = [];
4982 5072 $scope.annotationTextArrayT1.push(annotations.annotationT1);
4983 5073 $scope.annotationTextArrayT2.push(annotations.annotationT2);
4984 5074  
4985   -
4986 5075 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  5076 + }
  5077 + else
  5078 + {
  5079 + $scope.annotationTextArrayT1 = [];
  5080 + $scope.annotationTextArrayT2 = [];
  5081 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  5082 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
4987 5083  
4988   -
  5084 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4989 5085 }
4990   - //debugger;
4991   - }
4992   - function clearTransCanvas() {
  5086 + }
  5087 +
  5088 +
  5089 + function clearTransCanvas() {
4993 5090  
4994 5091 var tCanvas = document.getElementById('transparencyCanvas');
4995 5092 if (tCanvas != null) {
... ...