Commit 7b9b01fd6d240335a53a625480a5a10bc9ba2083
1 parent
267f8bdd
Annotation issue is fixed in TB.
Now Modesty is implemented and also the annotations are correct on each place.
Showing
1 changed file
with
101 additions
and
20 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -4176,12 +4176,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4176,12 +4176,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4176 | oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId) | 4176 | oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId) |
4177 | } | 4177 | } |
4178 | else { | 4178 | else { |
4179 | - //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { | ||
4180 | - // oldCanvas = document.getElementById('modestyTransparencyTempCanvas_' + bodyRegionId); | ||
4181 | - //} | ||
4182 | - //else { | 4179 | + |
4183 | oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId) | 4180 | oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId) |
4184 | - //} | 4181 | + |
4185 | } | 4182 | } |
4186 | 4183 | ||
4187 | if (oldCanvas != null) { | 4184 | if (oldCanvas != null) { |
@@ -4190,8 +4187,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4190,8 +4187,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4190 | 4187 | ||
4191 | //remove tempmask canvas | 4188 | //remove tempmask canvas |
4192 | var oldtempTransCanvasMask; | 4189 | var oldtempTransCanvasMask; |
4190 | + var oldtempTransCanvasMaskMR; | ||
4193 | if (IsMirror == 'Yes') { | 4191 | if (IsMirror == 'Yes') { |
4194 | - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci'); | 4192 | + oldtempTransCanvasMaskMR = document.getElementById('transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'); |
4193 | + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); | ||
4194 | + | ||
4195 | + if (oldtempTransCanvasMaskMR != null) { | ||
4196 | + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMaskMR); | ||
4197 | + } | ||
4195 | } | 4198 | } |
4196 | else { | 4199 | else { |
4197 | oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); | 4200 | oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); |
@@ -4287,7 +4290,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4287,7 +4290,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4287 | canvasModesty.style.top = Y + 'px'; | 4290 | canvasModesty.style.top = Y + 'px'; |
4288 | //canvasModesty.style.backgroundColor = "transparent"; | 4291 | //canvasModesty.style.backgroundColor = "transparent"; |
4289 | canvasModesty.style.visibility = 'visible'; | 4292 | canvasModesty.style.visibility = 'visible'; |
4290 | - canvasModesty.style.zIndex = '2000' | 4293 | + canvasModesty.style.zIndex = '2000'; |
4294 | + canvasModesty.addEventListener('click', OnClickModestyTransCanvas); | ||
4295 | + | ||
4291 | // tempcanvasModestyCanvasModesty.style.border = "black 1px solid"; | 4296 | // tempcanvasModestyCanvasModesty.style.border = "black 1px solid"; |
4292 | document.getElementById('canvasDiv').appendChild(canvasModesty); | 4297 | document.getElementById('canvasDiv').appendChild(canvasModesty); |
4293 | } | 4298 | } |
@@ -4797,10 +4802,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4797,10 +4802,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4797 | 4802 | ||
4798 | var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; | 4803 | var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; |
4799 | var maskCanvas = document.getElementById(maskCanvasId); | 4804 | var maskCanvas = document.getElementById(maskCanvasId); |
4800 | - | ||
4801 | - //if (oldMirrorMask != null) { | ||
4802 | - // document.getElementById('canvasDiv').removeChild(oldMirrorMask); | ||
4803 | - //} | 4805 | + |
4804 | if (maskCanvas != null) { | 4806 | if (maskCanvas != null) { |
4805 | x = maskCanvas.style.left; | 4807 | x = maskCanvas.style.left; |
4806 | y = maskCanvas.style.top; | 4808 | y = maskCanvas.style.top; |
@@ -4913,6 +4915,87 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4913,6 +4915,87 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4913 | 4915 | ||
4914 | } | 4916 | } |
4915 | 4917 | ||
4918 | + function OnClickModestyTransCanvas(evt) { | ||
4919 | + | ||
4920 | + var mousePos = $scope.getMousePos(evt); | ||
4921 | + var canvasDiv = document.getElementById('canvasDiv'); | ||
4922 | + var verticalScrollPosition = canvasDiv.scrollTop; | ||
4923 | + var horizontlScrollPosition = canvasDiv.scrollLeft; | ||
4924 | + | ||
4925 | + var actulalX = mousePos.x + horizontlScrollPosition; | ||
4926 | + var actualY = mousePos.y + verticalScrollPosition; | ||
4927 | + | ||
4928 | + var canavsX = evt.currentTarget.offsetLeft; | ||
4929 | + var canvasY = evt.currentTarget.offsetTop; | ||
4930 | + | ||
4931 | + var canvasId = evt.currentTarget.id; | ||
4932 | + var canavsContext = document.getElementById(canvasId).getContext('2d'); | ||
4933 | + var RGBColor = $scope.GetRGBColor(canavsContext, actulalX, actualY, canavsX, canvasY); | ||
4934 | + | ||
4935 | + var annotationText; | ||
4936 | + | ||
4937 | + //Modesty ON | ||
4938 | + if (canvasId.match('modestyImg') && RGBColor != '000000') { | ||
4939 | + RGBColor = DA[0].figLeafTermId; | ||
4940 | + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor); | ||
4941 | + $scope.annotationTextArrayT1 = []; | ||
4942 | + $scope.annotationTextArrayT2 = []; | ||
4943 | + $scope.annotationTextArrayT1.push(annotationText); | ||
4944 | + $scope.annotationTextArrayT2.push(annotationText); | ||
4945 | + } | ||
4946 | + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to | ||
4947 | + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er | ||
4948 | + // | ||
4949 | + else if (canvasId.match('modestyImg') && RGBColor == '000000') { | ||
4950 | + | ||
4951 | + var bodyRegionId = canvasId.slice(-1); | ||
4952 | + | ||
4953 | + var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; | ||
4954 | + var maskCanvas = document.getElementById(maskCanvasId); | ||
4955 | + var maskCanvasContext = maskCanvas.getContext("2d"); | ||
4956 | + //RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); | ||
4957 | + //annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); | ||
4958 | + | ||
4959 | + //transparecncy canvas | ||
4960 | + var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; | ||
4961 | + var maskCanvastrans = document.getElementById(maskCanvasTransId); | ||
4962 | + var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); | ||
4963 | + | ||
4964 | + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); | ||
4965 | + | ||
4966 | + var pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); | ||
4967 | + | ||
4968 | + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope); | ||
4969 | + | ||
4970 | + | ||
4971 | + // var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; | ||
4972 | + // var maskCanvas = document.getElementById(maskCanvasId); | ||
4973 | + // var maskCanvasContext = maskCanvas.getContext("2d"); | ||
4974 | + // RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); | ||
4975 | + // annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); | ||
4976 | + | ||
4977 | + | ||
4978 | + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) | ||
4979 | + | ||
4980 | + $scope.annotationTextArrayT1 = []; | ||
4981 | + $scope.annotationTextArrayT2 = []; | ||
4982 | + $scope.annotationTextArrayT1.push(annotations.annotationT1); | ||
4983 | + $scope.annotationTextArrayT2.push(annotations.annotationT2); | ||
4984 | + | ||
4985 | + } | ||
4986 | + | ||
4987 | + if ($('#speechBubble').length > 0) | ||
4988 | + $('#speechBubble').remove(); | ||
4989 | + | ||
4990 | + | ||
4991 | + if ($('#speechBubbleTrns').length > 0) { | ||
4992 | + $('#speechBubbleTrns').remove(); | ||
4993 | + } | ||
4994 | + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); | ||
4995 | + | ||
4996 | + | ||
4997 | + } | ||
4998 | + | ||
4916 | function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) | 4999 | function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) |
4917 | { | 5000 | { |
4918 | var canvasDiv = document.getElementById('canvasDiv'); | 5001 | var canvasDiv = document.getElementById('canvasDiv'); |
@@ -4958,17 +5041,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4958,17 +5041,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4958 | $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); | 5041 | $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); |
4959 | } | 5042 | } |
4960 | else | 5043 | else |
4961 | - { | 5044 | + { |
4962 | $scope.annotationTextArrayT1 = []; | 5045 | $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); | ||
4968 | - | 5046 | + $scope.annotationTextArrayT2 = []; |
5047 | + $scope.annotationTextArrayT1.push(annotations.annotationT1); | ||
5048 | + $scope.annotationTextArrayT2.push(annotations.annotationT2); | ||
4969 | 5049 | ||
4970 | - } | ||
4971 | -} | 5050 | + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); |
5051 | + } | ||
5052 | + } | ||
4972 | 5053 | ||
4973 | 5054 | ||
4974 | function clearTransCanvas() { | 5055 | function clearTransCanvas() { |