From 5ff311337e6184d76695f75e673514d4b8e39575 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 18 Apr 2017 13:09:01 +0530 Subject: [PATCH] Annotation Globalization Issue --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------- 1 file changed, 87 insertions(+), 71 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 9c2048a..bc586c3 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -3479,6 +3479,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.createSpeechBubbleBasedOnTransparencyWithCtrl = function (pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation) { + var sppechBubbleHTML_annotation = "
"; if ($scope.longest_annotationT1.length > $scope.longest_annotationT2.length) { if (Exists_annotation == 0) { @@ -3904,7 +3905,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function mouseUpListener(e) { - + $scope.isTBDrawnOnBodyRegion = false; $(".com").remove(); @@ -5215,7 +5216,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function TransparencyCanvasClickListener(evt) { - //alert('tb clicked') + // alert('tb clicked'); // debugger; var pixelData; var pixelDataTrans; @@ -5391,7 +5392,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } //$scope.annotationTextArrayT1.push(annotations.annotationT1); // $scope.annotationTextArrayT2.push(annotations.annotationT2); - + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); } else @@ -5408,7 +5409,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } //$scope.annotationTextArrayT1.push(annotations.annotationT1); // $scope.annotationTextArrayT2.push(annotations.annotationT2); - + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); } @@ -5418,7 +5419,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } function OnClickModestyTransCanvas(evt) { - + var tCanvasLeft = $(".ui-wrapper").css("left"); + var tCanvasLeftAftrSplit = tCanvasLeft.split("p"); + var tCanvasTop = $(".ui-wrapper").css("top"); + var tCanvasTopAftrSplit = tCanvasTop.split("p"); + var tCanvasWidth = $(".ui-wrapper").css("width"); + var tCanvasWidthAftrSplit = tCanvasWidth.split("p"); + var tCanvasHeight = $(".ui-wrapper").css("height"); + var tCanvasHeightAftrSplit = tCanvasHeight.split("p"); + // alert("modesty"); + var tCanvasTotalWidth = parseInt(tCanvasLeftAftrSplit[0]) + parseInt(tCanvasWidthAftrSplit[0]); + var tCanvasTotalHeight = parseInt(tCanvasTopAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); var mousePos = $scope.getMousePos(evt); var canvasDiv = document.getElementById('canvasDiv'); var verticalScrollPosition = canvasDiv.scrollTop; @@ -5430,94 +5441,95 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var canavsX = evt.currentTarget.offsetLeft; var canvasY = evt.currentTarget.offsetTop; - var canvasId = evt.currentTarget.id; - var canavsContext = document.getElementById(canvasId).getContext('2d'); - var RGBColor = $scope.GetRGBColor(canavsContext, actulalX, actualY, canavsX, canvasY); + if ((tCanvasLeftAftrSplit[0] <= actulalX && (actulalX <= tCanvasTotalWidth)) && (tCanvasTopAftrSplit[0] <= actualY && actualY <= tCanvasTotalHeight)) { + var canvasId = evt.currentTarget.id; + var canavsContext = document.getElementById(canvasId).getContext('2d'); + var RGBColor = $scope.GetRGBColor(canavsContext, actulalX, actualY, canavsX, canvasY); - var annotationText; - - //Modesty ON - if (canvasId.match('modestyImg') && RGBColor != '000000') { - RGBColor = DA[0].figLeafTermId; - annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor); - $scope.annotationTextArrayT1 = []; - $scope.annotationTextArrayT2 = []; - $scope.annotationTextArrayT1.push(annotationText); - $scope.annotationTextArrayT2.push(annotationText); - } - //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to - //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er - // - else if (canvasId.match('modestyImg') && RGBColor == '000000') { + var annotationText; - var bodyRegionId = canvasId.slice(-1); + //Modesty ON + if (canvasId.match('modestyImg') && RGBColor != '000000') { + RGBColor = DA[0].figLeafTermId; + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor); + $scope.annotationTextArrayT1 = []; + $scope.annotationTextArrayT2 = []; + $scope.annotationTextArrayT1.push(annotationText); + $scope.annotationTextArrayT2.push(annotationText); + } + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er + // + else if (canvasId.match('modestyImg') && RGBColor == '000000') { - var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); - //RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); - //annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); + var bodyRegionId = canvasId.slice(-1); - //transparecncy canvas - var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; - var maskCanvastrans = document.getElementById(maskCanvasTransId); - var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); + var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + //RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); + //annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); - var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); + //transparecncy canvas + var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; + var maskCanvastrans = document.getElementById(maskCanvasTransId); + var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); - var pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); - var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope); + var pixelDataTrans = maskCanvasContexttrans.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope); - // var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; - // var maskCanvas = document.getElementById(maskCanvasId); - // var maskCanvasContext = maskCanvas.getContext("2d"); - // RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); - // annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); + // var maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci'; + // var maskCanvas = document.getElementById(maskCanvasId); + // var maskCanvasContext = maskCanvas.getContext("2d"); + // RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, xcanavsX, canvasY); + // annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - $scope.annotationTextArrayT1 = []; - $scope.annotationTextArrayT2 = []; - for (var i = 0; i <= annotations.annotationT1.length - 1; i++) { - $scope.annotationTextArrayT1.push(annotations.annotationT1[i]); - } - for (var i = 0; i <= annotations.annotationT2.length - 1; i++) { - $scope.annotationTextArrayT2.push(annotations.annotationT1[i]); - } - //$scope.annotationTextArrayT1.push(annotations.annotationT1); - // $scope.annotationTextArrayT2.push(annotations.annotationT2); + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - } + $scope.annotationTextArrayT1 = []; + $scope.annotationTextArrayT2 = []; + for (var i = 0; i <= annotations.annotationT1.length - 1; i++) { + $scope.annotationTextArrayT1.push(annotations.annotationT1[i]); - if ($('#speechBubble').length > 0) - $('#speechBubble').remove(); + } + for (var i = 0; i <= annotations.annotationT2.length - 1; i++) { + $scope.annotationTextArrayT2.push(annotations.annotationT2[i]); + } + //$scope.annotationTextArrayT1.push(annotations.annotationT1); + // $scope.annotationTextArrayT2.push(annotations.annotationT2); + } - if ($('#speechBubbleTrns').length > 0) { - $('#speechBubbleTrns').remove(); - } + if ($('#speechBubble').length > 0) + $('#speechBubble').remove(); - var tCanvasTopPos = $(".ui-wrapper").css("top"); - var tCanvasTopPosAftrSplit = tCanvasTopPos.split("p"); - var tCanvasHeight = $(".ui-wrapper").css("height"); - var tCanvasHeightAftrSplit = tCanvasHeight.split("p"); - var tCanvasAttr = parseInt(tCanvasTopPosAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); - if ((evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top) >= parseInt(tCanvasTopPosAftrSplit[0]) && (evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top) <= tCanvasAttr) { + if ($('#speechBubbleTrns').length > 0) { + $('#speechBubbleTrns').remove(); + } - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); + var tCanvasTopPos = $(".ui-wrapper").css("top"); + var tCanvasTopPosAftrSplit = tCanvasTopPos.split("p"); + var tCanvasHeight = $(".ui-wrapper").css("height"); + var tCanvasHeightAftrSplit = tCanvasHeight.split("p"); + var tCanvasAttr = parseInt(tCanvasTopPosAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); + // if ((evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top) >= parseInt(tCanvasTopPosAftrSplit[0]) && (evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top) <= tCanvasAttr) { + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); + //} + //else { + // $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(evt); + //} } - else { - + else + { $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(evt); - } - - } function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) { @@ -5983,6 +5995,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } $scope.enableZoom = function () { + $("#OnIdentify").removeClass("annotationtoolbartab"); + $("#DrawMode").removeClass("annotationtoolbartab"); + $('.btnCursor').removeClass('activebtncolor'); $(".annotationTollbar").css("display", "none"); $("#annotationButton").removeClass("active"); $("#btnExtract").removeClass("disabled"); @@ -5991,13 +6006,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.isNormalMode = false; $rootScope.isGenderChnage = false; $rootScope.isViewChange = false; + //if listanager is visisble then close it $rootScope.CloseListManager(); $rootScope.isHighlightBodyByBodySystem = false; - + $('#sppeachBubble').css('display', 'none'); $("#dot").css("display", "none"); -- libgit2 0.21.4