Commit ce06658e4c4c894591846e5efd6769e7190074f7

Authored by Nikita Kulshreshtha
1 parent 4bd51527

need to see the modesty in mirror transparency region

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -4809,33 +4809,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4809,33 +4809,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4809 4809
4810 4810
4811 //debugger; 4811 //debugger;
4812 - var oldMirrorMaskId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';  
4813 - var oldMirrorMask = document.getElementById(oldMirrorMaskId);  
4814 - if (oldMirrorMask != null) {  
4815 - document.getElementById('canvasDiv').removeChild(oldMirrorMask); 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) {
  4822 + var transparencyTempcanavsMask = document.createElement('canvas');
  4823 + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
  4824 + transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;
  4825 + transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width;
  4826 + transparencyTempcanavsMask.style.position = "absolute";
  4827 + transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px";
  4828 + transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";
  4829 + transparencyTempcanavsMask.style.visibility = 'hidden';
  4830 +
  4831 + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);
  4832 +
  4833 + var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);
  4834 + var tempMaskImg = new Image();
  4835 + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
  4836 + tempMaskImg.onload = function () {
  4837 + var transparencyTempcanavsMask = document.getElementById(maskCanvasId);
  4838 + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
  4839 + tempmaskCtx.drawImage(tempMaskImg, 0, 0);
  4840 +
  4841 + //get x,y of non mirrored canvas for this body region
  4842 + x = transparencyTempcanavsMask.style.left;
  4843 + y = transparencyTempcanavsMask.style.top;
  4844 + }
  4845 + tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;
4816 } 4846 }
4817 - var transparencyTempcanavsMask = document.createElement('canvas');  
4818 - transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';  
4819 - transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height;  
4820 - transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width;  
4821 - transparencyTempcanavsMask.style.position = "absolute";  
4822 - transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px";  
4823 - transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px";  
4824 - transparencyTempcanavsMask.style.visibility = 'hidden';  
4825 -  
4826 - document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask);  
4827 -  
4828 - var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion);  
4829 - var tempMaskImg = new Image();  
4830 - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);  
4831 - tempMaskImg.onload = function () {  
4832 - var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');  
4833 - tempmaskCtx.drawImage(tempMaskImg, 0, 0);  
4834 -  
4835 - //get x,y of non mirrored canvas for this body region  
4836 - x = transparencyTempcanavsMask.style.left;  
4837 - y = transparencyTempcanavsMask.style.top;  
4838 -  
4839 var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; 4847 var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci';
4840 var maskCanvastrans = document.getElementById(maskCanvasTransId); 4848 var maskCanvastrans = document.getElementById(maskCanvasTransId);
4841 var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); 4849 var maskCanvasContexttrans = maskCanvastrans.getContext("2d");
@@ -4859,8 +4867,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4859,8 +4867,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4859 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci'; 4867 var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci';
4860 var maskCanvas = document.getElementById(clickedCanvasMaskId); 4868 var maskCanvas = document.getElementById(clickedCanvasMaskId);
4861 var maskCanvasContext = maskCanvas.getContext("2d"); 4869 var maskCanvasContext = maskCanvas.getContext("2d");
4862 - var imgX = Math.round(actulalX - parseInt(x.replace('px', '')));  
4863 - var imgY = Math.round(actualY - parseInt(y.replace('px', ''))); 4870 + var imgX = Math.round(actulalX - parseInt(x));//.replace('px', '')));
  4871 + var imgY = Math.round(actualY - parseInt(y));//.replace('px', '')));
4864 pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1); 4872 pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1);
4865 4873
4866 4874
@@ -4894,9 +4902,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo @@ -4894,9 +4902,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4894 $scope.annotationTextArrayT2.push(annotations.annotationT2); 4902 $scope.annotationTextArrayT2.push(annotations.annotationT2);
4895 4903
4896 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); 4904 $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false);
4897 - }  
4898 - tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc;  
4899 - 4905 +
4900 4906
4901 } 4907 }
4902 4908