Commit 267f8bdd44448837df1f71e517c68fd9f77564ab

Authored by Nikita Kulshreshtha
1 parent ce06658e

Annotations are working now in both mirror and non mirrored images in TBox.

Need to implement annotations code on Modesty canva sin TB.
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -747,8 +747,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
747 747 if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) {
748 748  
749 749 $("#canvasDiv").append('<canvas id="canvasPaint" width="2277" height="3248" class="canvas-annotationStyle1"></canvas><canvas id="canvas" width="2277" height="3248" class="canvas-annotationStyle"></canvas>');
750   - $scope.BindCanvasDrawingListners();
751   - // $rootScope.FreeStylePaint();
  750 + $scope.BindCanvasDrawingListners();
  751 + // $rootScope.FreeStylePaint();
752 752  
753 753 }
754 754  
... ... @@ -1370,7 +1370,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1370 1370 }
1371 1371 }
1372 1372  
1373   - // $rootScope.previousHighlightList.push(RGBColor);
  1373 + // $rootScope.previousHighlightList.push(RGBColor);
1374 1374  
1375 1375 $scope.highLightBodyBasedOnIcolor(RGBColor);
1376 1376 }
... ... @@ -1382,7 +1382,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1382 1382 //}
1383 1383  
1384 1384 //extarct clicked body part is extarct button is already enabled.
1385   - // debugger;
  1385 + // debugger;
1386 1386 if ($rootScope.isExtract == true) {
1387 1387 $scope.enableExtract(false);
1388 1388 }
... ... @@ -1505,7 +1505,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1505 1505  
1506 1506 // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length)
1507 1507  
1508   - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  1508 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
1509 1509  
1510 1510 if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
1511 1511 $scope.isEligibleForHighlight = true;
... ... @@ -1743,7 +1743,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1743 1743 }
1744 1744 }
1745 1745  
1746   - // $rootScope.previousHighlightList.push(RGBColor);
  1746 + // $rootScope.previousHighlightList.push(RGBColor);
1747 1747  
1748 1748  
1749 1749 if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { }
... ... @@ -1758,7 +1758,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1758 1758 // $rootScope.previousHighlightList.push(RGBColor);
1759 1759 //}
1760 1760  
1761   - // debugger;
  1761 + // debugger;
1762 1762 //extarct clisked body part is extarct button is already enabled.
1763 1763 if ($rootScope.isExtract == true) {
1764 1764 $scope.enableExtract(false);
... ... @@ -2220,7 +2220,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2220 2220 $scope.aligneCanvasWithTerm()
2221 2221 }
2222 2222  
2223   - // $timeout(function () { $scope.DisableProgressBar() }, 1000);
  2223 + // $timeout(function () { $scope.DisableProgressBar() }, 1000);
2224 2224  
2225 2225  
2226 2226  
... ... @@ -2455,17 +2455,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2455 2455 }
2456 2456 else {
2457 2457 var canvasDiv = document.getElementById('canvasDiv');
2458   - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
2459   - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
  2458 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition);
  2459 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition);
2460 2460  
2461   - $rootScope.isLoading = false;
  2461 + $rootScope.isLoading = false;
2462 2462  
2463   - $('#spinner').css('visibility', 'hidden');
  2463 + $('#spinner').css('visibility', 'hidden');
2464 2464 //$('#canvasDiv').scrollLeft(newX);
2465   - //$('#canvasDiv').scrollTop(newY);
  2465 + //$('#canvasDiv').scrollTop(newY);
2466 2466 }
2467 2467  
2468   - // $rootScope.isHighlightBodyByBodySystem = false;
  2468 + // $rootScope.isHighlightBodyByBodySystem = false;
2469 2469  
2470 2470  
2471 2471 }
... ... @@ -2661,46 +2661,46 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2661 2661  
2662 2662 var tCanvas = document.getElementById('transparencyCanvas');
2663 2663  
2664   - var tCanvasContext = tCanvas.getContext('2d');
  2664 + var tCanvasContext = tCanvas.getContext('2d');
2665 2665  
2666   - var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
  2666 + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', ''));
2667 2667  
2668   - var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
  2668 + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', ''));
2669 2669  
2670 2670  
2671   - // var tCanvas = document.getElementById('transparencyCanvas');
2672   - if (tCanvas != null) {
2673   - clearTransCanvas();
2674   - }
2675   - var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
2676   - var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
2677   - var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
2678   - var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
2679   - var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight);
2680   - var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth);
  2671 + // var tCanvas = document.getElementById('transparencyCanvas');
  2672 + if (tCanvas != null) {
  2673 + clearTransCanvas();
  2674 + }
  2675 + var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', ''));
  2676 + var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', '')));
  2677 + var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', ''));
  2678 + var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', ''));
  2679 + var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight);
  2680 + var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth);
2681 2681  
2682   - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
  2682 + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
2683 2683  
2684   - $.each(BodyRegionDictionary, function (index, value) {
2685   - //debugger;
2686   - // alert(' $.each(BodyRegionDictionary1')
  2684 + $.each(BodyRegionDictionary, function (index, value) {
  2685 + //debugger;
  2686 + // alert(' $.each(BodyRegionDictionary1')
2687 2687  
2688   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
2689   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  2688 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  2689 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
2690 2690  
2691 2691  
2692   - // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
2693   - if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
2694   - //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
2695   - // debugger;
2696   - $scope.layerNumber = parseInt(txtlayerNumber.value);
  2692 + // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom)
  2693 + if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  2694 + //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value);
  2695 + // debugger;
  2696 + $scope.layerNumber = parseInt(txtlayerNumber.value);
2697 2697  
2698 2698  
2699   - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false);
2700   - }
  2699 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false);
  2700 + }
2701 2701  
2702 2702  
2703   - })
  2703 + })
2704 2704  
2705 2705 }
2706 2706  
... ... @@ -2758,10 +2758,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2758 2758 if ($("#txtlayerNumber").val() == '') {
2759 2759 var layerInputVal = 0;
2760 2760  
2761   - var layerInputValInc = parseInt(layerInputVal);
2762   - $scope.layerNumber = parseInt(layerInputValInc);
2763   - $("#txtlayerNumber").val($scope.layerNumber);
2764   - // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
  2761 + var layerInputValInc = parseInt(layerInputVal);
  2762 + $scope.layerNumber = parseInt(layerInputValInc);
  2763 + $("#txtlayerNumber").val($scope.layerNumber);
  2764 + // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
2765 2765  
2766 2766 }
2767 2767 else {
... ... @@ -2784,7 +2784,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2784 2784 var layerInputValDec = parseInt(layerInputVal);
2785 2785 $scope.layerNumber = parseInt(layerInputValDec);
2786 2786 $("#txtlayerNumber").val($scope.layerNumber);
2787   - // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
  2787 + // $rootScope.PreviouslayerNumbr = $scope.layerNumber;
2788 2788  
2789 2789 }
2790 2790 else
... ... @@ -3071,10 +3071,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3071 3071  
3072 3072 //$("#bord").css("display", "none");
3073 3073 //$("#dot").css("display", "none");
3074   - $('#sppeachBubble').remove();
  3074 + $('#sppeachBubble').remove();
3075 3075  
3076   - $("#bord").remove();
3077   - $("#dot").remove();
  3076 + $("#bord").remove();
  3077 + $("#dot").remove();
3078 3078  
3079 3079 });
3080 3080  
... ... @@ -3501,7 +3501,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
3501 3501 drag: function (evt) {
3502 3502  
3503 3503 //$("#dot_annotation").css("display", "none");
3504   - $("#dot_annotation").remove();
  3504 + $("#dot_annotation").remove();
3505 3505  
3506 3506 var verticalScrollPosition = canvasDiv.scrollTop;
3507 3507 var horizontlScrollPosition = canvasDiv.scrollLeft;
... ... @@ -4005,7 +4005,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4005 4005 XforTransImage = 0;
4006 4006 }
4007 4007 else
4008   - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4008 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4009 4009 // alert('1')
4010 4010 }
4011 4011 else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
... ... @@ -4021,7 +4021,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4021 4021 XforTransImage = 0;
4022 4022 }
4023 4023 else
4024   - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
  4024 + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX));
4025 4025  
4026 4026 // alert('2')
4027 4027 }
... ... @@ -4037,7 +4037,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4037 4037 XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X);
4038 4038 }
4039 4039 else
4040   - XforTransImage = 0;
  4040 + XforTransImage = 0;
4041 4041 // alert('3')
4042 4042 }
4043 4043 else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) {
... ... @@ -4070,7 +4070,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4070 4070 YforTransImage = 0;
4071 4071 }
4072 4072 else
4073   - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
  4073 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4);
4074 4074 // alert('5')
4075 4075 }
4076 4076 else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) {
... ... @@ -4084,7 +4084,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4084 4084 YforTransImage = 0;
4085 4085 }
4086 4086 else
4087   - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
  4087 + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4);
4088 4088  
4089 4089 }
4090 4090 else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) {
... ... @@ -4742,49 +4742,49 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4742 4742 var isMirror;
4743 4743 var width;
4744 4744 var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData;
4745   - if ($rootScope.viewOrientationId == 5) {
  4745 + if ($rootScope.viewOrientationId == 5) {
4746 4746  
4747   - var clickedBodyRegionData = new jinqJs()
4748   - .from(BodyRegionDictionary)
4749   - .where('bodyRegionId == 6')
4750   - .select();
  4747 + var clickedBodyRegionData = new jinqJs()
  4748 + .from(BodyRegionDictionary)
  4749 + .where('bodyRegionId == 6')
  4750 + .select();
4751 4751  
4752 4752  
4753   - // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
4754   - x = clickedBodyRegionData[0].X;
4755   - y = clickedBodyRegionData[0].Y;
4756   - width = clickedBodyRegionData[0].Width;
4757   - var height = clickedBodyRegionData[0].Height;
4758   - isMirror = clickedBodyRegionData[0].IsMirror;
4759   - var bodyRegionRight = parseInt(x) + parseInt(width);
4760   - var bodyRegionBottom = parseInt(y) + parseInt(height);
4761   - if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) {
  4753 + // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
  4754 + x = clickedBodyRegionData[0].X;
  4755 + y = clickedBodyRegionData[0].Y;
  4756 + width = clickedBodyRegionData[0].Width;
  4757 + var height = clickedBodyRegionData[0].Height;
  4758 + isMirror = clickedBodyRegionData[0].IsMirror;
  4759 + var bodyRegionRight = parseInt(x) + parseInt(width);
  4760 + var bodyRegionBottom = parseInt(y) + parseInt(height);
  4761 + if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) {
4762 4762  
4763   - clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
4764   - x = clickedBodyRegionData[0].X;
4765   - y = clickedBodyRegionData[0].Y;
4766   - width = clickedBodyRegionData[0].Width;
4767   - var height = clickedBodyRegionData[0].Height;
4768   - isMirror = clickedBodyRegionData[0].IsMirror;
4769   - }
  4763 + clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId;
  4764 + x = clickedBodyRegionData[0].X;
  4765 + y = clickedBodyRegionData[0].Y;
  4766 + width = clickedBodyRegionData[0].Width;
  4767 + var height = clickedBodyRegionData[0].Height;
  4768 + isMirror = clickedBodyRegionData[0].IsMirror;
  4769 + }
4770 4770  
4771   - }
4772   - else {
4773   - $.each(BodyRegionDictionary, function (index, value) {
  4771 + }
  4772 + else {
  4773 + $.each(BodyRegionDictionary, function (index, value) {
4774 4774  
4775   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
4776   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
4777   - if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) {
  4775 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  4776 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  4777 + if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) {
4778 4778  
4779   - clickedBodyRegion = value.bodyRegionId;
4780   - x = value.X;
4781   - y = value.Y;
4782   - width = value.Width;
4783   - isMirror = value.IsMirror;
4784   - return false;
4785   - }
4786   - })
4787   - }
  4779 + clickedBodyRegion = value.bodyRegionId;
  4780 + x = value.X;
  4781 + y = value.Y;
  4782 + width = value.Width;
  4783 + isMirror = value.IsMirror;
  4784 + return false;
  4785 + }
  4786 + })
  4787 + }
4788 4788  
4789 4789  
4790 4790 if (isMirror == "Yes") {
... ... @@ -4795,30 +4795,40 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4795 4795 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4796 4796 var clickedCanavs = document.getElementById(clickedCanvasMaskId);
4797 4797  
4798   - //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation
4799   - var clickedBodyRegionData = new jinqJs()
4800   - .from(BodyRegionDictionary)
4801   - .where('bodyRegionId == ' + clickedBodyRegion)
4802   - .select();
4803   - if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) {
  4798 + var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4799 + var maskCanvas = document.getElementById(maskCanvasId);
  4800 +
  4801 + //if (oldMirrorMask != null) {
  4802 + // document.getElementById('canvasDiv').removeChild(oldMirrorMask);
  4803 + //}
  4804 + if (maskCanvas != null) {
  4805 + x = maskCanvas.style.left;
  4806 + y = maskCanvas.style.top;
4804 4807  
4805   - var nomMirroredBodyRegion = new jinqJs()
4806   - .from(clickedBodyRegionData)
4807   - .where('IsMirror == No')
4808   - .select();
  4808 + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4809 + var maskCanvastrans = document.getElementById(maskCanvasTransId);
  4810 + var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
4809 4811  
4810 4812  
4811   - //debugger;
4812   - var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4813   - var maskCanvas = document.getElementById(maskCanvasId);
4814   - //if (oldMirrorMask != null) {
4815   - // document.getElementById('canvasDiv').removeChild(oldMirrorMask);
4816   - //}
4817   - if (maskCanvas != null) {
4818   - x = maskCanvas.style.left;
4819   - y = maskCanvas.style.top;
4820   - }
4821   - if (maskCanvas == null) {
  4813 + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt)
  4814 +
  4815 +
  4816 + }
  4817 +
  4818 + //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation
  4819 +
  4820 + else if (maskCanvas == null) {
  4821 + var clickedBodyRegionData = new jinqJs()
  4822 + .from(BodyRegionDictionary)
  4823 + .where('bodyRegionId == ' + clickedBodyRegion)
  4824 + .select();
  4825 + if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) {
  4826 +
  4827 + var nomMirroredBodyRegion = new jinqJs()
  4828 + .from(clickedBodyRegionData)
  4829 + .where('IsMirror == No')
  4830 + .select();
  4831 +
4822 4832 var transparencyTempcanavsMask = document.createElement('canvas');
4823 4833 transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4824 4834 transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;
... ... @@ -4831,8 +4841,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4831 4841 document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
4832 4842  
4833 4843 var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
4834   - var tempMaskImg = new Image();
4835 4844 var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4845 +
  4846 + var tempMaskImg = new Image();
  4847 + tempMaskImg.src = tranparencyMaskImgSrc;
  4848 +
4836 4849 tempMaskImg.onload = function () {
4837 4850 var transparencyTempcanavsMask = document.getElementById(maskCanvasId);
4838 4851 var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
... ... @@ -4841,70 +4854,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4841 4854 //get x,y of non mirrored canvas for this body region
4842 4855 x = transparencyTempcanavsMask.style.left;
4843 4856 y = transparencyTempcanavsMask.style.top;
4844   - }
4845   - tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;
4846   - }
4847   - var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4848   - var maskCanvastrans = document.getElementById(maskCanvasTransId);
4849   - var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
4850   -
4851   -
4852   -
4853   -
4854   - var canvasDiv = document.getElementById('canvasDiv');
4855   - var verticalScrollPosition = canvasDiv.scrollTop;
4856   - var horizontlScrollPosition = canvasDiv.scrollLeft;
4857 4857  
4858   - var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
  4858 + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, tempmaskCtx, clickedBodyRegion, x, y, evt)
4859 4859  
4860   - var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
4861   -
4862   - var actulalX = mirrorXOnNormalImage
4863   - var actualY = mousePos.y + verticalScrollPosition
4864   -
4865   -
4866   -
4867   - var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4868   - var maskCanvas = document.getElementById(clickedCanvasMaskId);
4869   - var maskCanvasContext = maskCanvas.getContext("2d");
4870   - var imgX = Math.round(actulalX - parseInt(x));//.replace('px', '')));
4871   - var imgY = Math.round(actualY - parseInt(y));//.replace('px', '')));
4872   - pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
4873   -
4874   -
4875   - //trans layer image data
4876   - pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
4877   - // console.log('at the time' + pixelData.data[0])
4878   - // debugger;
4879   - var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
4880   - if ($('#speechBubble').length > 0)
4881   - $('#speechBubble').remove();
4882   -
4883   -
4884   - if ($('#speechBubbleTrns').length > 0) {
4885   - $('#speechBubbleTrns').remove();
4886   -
4887   - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4888   -
4889   - $scope.annotationTextArrayT1 = [];
4890   - $scope.annotationTextArrayT2 = [];
4891   - $scope.annotationTextArrayT1.push(annotations.annotationT1);
4892   - $scope.annotationTextArrayT2.push(annotations.annotationT2);
4893   -
4894   - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4895 4860 }
4896   - else
4897   - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4898   -
4899   - $scope.annotationTextArrayT1 = [];
4900   - $scope.annotationTextArrayT2 = [];
4901   - $scope.annotationTextArrayT1.push(annotations.annotationT1);
4902   - $scope.annotationTextArrayT2.push(annotations.annotationT2);
4903   -
4904   - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4905   -
4906   -
  4861 + }
4907 4862 }
  4863 +
4908 4864  
4909 4865 }
4910 4866 else {
... ... @@ -4941,21 +4897,81 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4941 4897 }
4942 4898 else
4943 4899 // $scope.createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
4944   -
  4900 + {
4945 4901  
4946 4902 $scope.annotationTextArrayT1 = [];
  4903 + $scope.annotationTextArrayT2 = [];
  4904 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4905 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4906 +
  4907 +
  4908 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4909 + }
  4910 +
  4911 + }
  4912 +
  4913 +
  4914 + }
  4915 +
  4916 + function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt)
  4917 + {
  4918 + var canvasDiv = document.getElementById('canvasDiv');
  4919 + var verticalScrollPosition = canvasDiv.scrollTop;
  4920 + var horizontlScrollPosition = canvasDiv.scrollLeft;
  4921 +
  4922 + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135);
  4923 +
  4924 + var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);
  4925 +
  4926 + var actulalX = mirrorXOnNormalImage
  4927 + var actualY = mousePos.y + verticalScrollPosition
  4928 +
  4929 +
  4930 +
  4931 + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
  4932 + var maskCanvas = document.getElementById(clickedCanvasMaskId);
  4933 + var maskCanvasContext = maskCanvas.getContext("2d");
  4934 + var imgX = Math.round(actulalX - parseInt((x).replace('px', '')));
  4935 + var imgY = Math.round(actualY - parseInt((y).replace('px', '')));
  4936 + var pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
  4937 +
  4938 +
  4939 + //trans layer image data
  4940 + var pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
  4941 + // console.log('at the time' + pixelData.data[0])
  4942 + // debugger;
  4943 + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
  4944 + if ($('#speechBubble').length > 0)
  4945 + $('#speechBubble').remove();
  4946 +
  4947 +
  4948 + if ($('#speechBubbleTrns').length > 0) {
  4949 + $('#speechBubbleTrns').remove();
  4950 +
  4951 + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50)
  4952 +
  4953 + $scope.annotationTextArrayT1 = [];
4947 4954 $scope.annotationTextArrayT2 = [];
4948 4955 $scope.annotationTextArrayT1.push(annotations.annotationT1);
4949 4956 $scope.annotationTextArrayT2.push(annotations.annotationT2);
4950 4957  
4951   -
4952 4958 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
  4959 + }
  4960 + else
  4961 + {
  4962 + $scope.annotationTextArrayT1 = [];
  4963 + $scope.annotationTextArrayT2 = [];
  4964 + $scope.annotationTextArrayT1.push(annotations.annotationT1);
  4965 + $scope.annotationTextArrayT2.push(annotations.annotationT2);
  4966 +
  4967 + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4953 4968  
4954 4969  
4955   - }
4956   - //debugger;
4957 4970 }
4958   - function clearTransCanvas() {
  4971 +}
  4972 +
  4973 +
  4974 + function clearTransCanvas() {
4959 4975  
4960 4976 var tCanvas = document.getElementById('transparencyCanvas');
4961 4977 if (tCanvas != null) {
... ...