diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index cf77512..f81d04d 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -472,7 +472,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo url: 'app/views/da/da-view.html' }, title: localStorage.getItem("currentViewTitle"), - + position: { top: 70, left: 1, @@ -482,6 +482,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); + console.log('jsPanel loaded daImagePanel exist= ' + document.getElementById('daImagePanel')) //0.1 $rootScope.currentSlug = 'da-body-view'; @@ -496,41 +497,69 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //0.3 var daBodyviewElement = angular.element(document.getElementById("daBodyview")); - $timeout(function () { $compile(daBodyviewElement.contents())($scope) }, 250); + $timeout(function () { + $compile(daBodyviewElement.contents())($scope); + console.log('html is compiled' + document.getElementById('daView')) + if (document.getElementById('daView') != null) { - //0.4 added some stylesheets - $('#daBodyview').css("height", $(window).outerHeight()); + //0.4 added some stylesheets + $('#daBodyview').css("height", $(window).outerHeight()); - $('#daBodyview').css("width", $(window).outerWidth()); + $('#daBodyview').css("width", $(window).outerWidth()); - //1. load navigator man first - $scope.LoadBodyViewNavigatorImage(); + //1. load navigator man first + console.log('before LoadBodyViewNavigatorImage call') + $scope.LoadBodyViewNavigatorImage(); - //$scope.loadSearchDataForBodyView(); + //$scope.loadSearchDataForBodyView(); - $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); + $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); - $scope.layerNumber = 0; + $scope.layerNumber = 0; - //2. + //2. - console.log('currentBodyViewId just before sending: ' + currentBodyViewId); - $scope.loadBodyViewData(currentBodyViewId); + console.log('currentBodyViewId just before sending: ' + currentBodyViewId); + $scope.loadBodyViewData(currentBodyViewId); - //2. load bodyRegion data - $rootScope.isLoading = true; - $rootScope.voId = localStorage.getItem("currentBodyViewId"); + //2. load bodyRegion data + $rootScope.isLoading = true; + $rootScope.voId = localStorage.getItem("currentBodyViewId"); - $('#daBodyview').css("height", $(window).outerHeight()); + $('#daBodyview').css("height", $(window).outerHeight()); - $('#daBodyview').css("width", $(window).outerWidth()); + $('#daBodyview').css("width", $(window).outerWidth()); + } + }, 250); } - angular.element(document).ready(function () { - - }) + angular.element(document).ready(function (e) { + $("#daImagePanel").resize(function () { + $("#canvasDiv").scrollLeft($rootScope.CanvasDivLeftPosition); + $("#canvasDiv").scrollTop($rootScope.CanvasDivTopPosition); + }); + $(document).on("mouseover", "#termList option", function (e) { + $('#termList option[selected="selected"]').attr("selected", false); + $(this).attr("selected", true); + }); + + $(document).keypress(function (e) { + if ($('#termList option[selected="selected"]').attr("id") == "undefined") { + return false; + } + else { + var originator = e.keyCode || e.which; + // alert($('#termList option[selected="selected"]').attr("id")); + if ($('#termList option[selected="selected"]').attr("id")) { + if (e.keyCode == 13) { + onListManagerTermSelection($('#termList option[selected="selected"]').attr("id")); + } + } + } + }); + }) $scope.loadSearchDataForBodyView = function () { @@ -632,6 +661,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //Code for displaying NavigatorImage for BodyView $scope.LoadBodyViewNavigatorImage = function () { + console.log('insideLoadBodyViewNavigatorImage') var NavigatorManJsonPath = '~/../content/data/json/da/da_dat_orient_image.json'; $http({ method: 'GET', url: NavigatorManJsonPath }) @@ -698,7 +728,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.LoadDefaultLayerImage = function () { - + console.log('inside LoadDefaultLayerImage') $rootScope.isNormalMode = true; $scope.layerNumber = 0; @@ -742,13 +772,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); - + $scope.modestyImageInfo = []; // annotation toolbar canvas if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { $("#canvasDiv").append(''); - $scope.BindCanvasDrawingListners(); - // $rootScope.FreeStylePaint(); + $scope.BindCanvasDrawingListners(); + // $rootScope.FreeStylePaint(); } @@ -777,8 +807,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.BodyRegionCordinatesData = []; // create an empty array $('#daBodyview').css('width', '100%'); - $('#canvasDiv').css('height', $('#daImagePanel').outerHeight() - 104) - //$('#canvasDiv').css('width', $('#daImagePanel').outerWidth() - 100) + var canvasDIvHeight = parseInt($('#daImagePanel').outerHeight()) - 104; + $('#canvasDiv').css('height', canvasDIvHeight); $('#leftToolBar').css('height', $('#daImagePanel').outerHeight()) @@ -1370,7 +1400,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - // $rootScope.previousHighlightList.push(RGBColor); + // $rootScope.previousHighlightList.push(RGBColor); $scope.highLightBodyBasedOnIcolor(RGBColor); } @@ -1382,7 +1412,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} //extarct clicked body part is extarct button is already enabled. - // debugger; + // debugger; if ($rootScope.isExtract == true) { $scope.enableExtract(false); } @@ -1505,7 +1535,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // console.log('$rootScope.isListManagerSelected= ' + $rootScope.isListManagerSelected + ' length= ' + $scope.ColoredImageSRC.length) - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) { $scope.isEligibleForHighlight = true; @@ -1743,7 +1773,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } - // $rootScope.previousHighlightList.push(RGBColor); + // $rootScope.previousHighlightList.push(RGBColor); if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { } @@ -1758,7 +1788,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // $rootScope.previousHighlightList.push(RGBColor); //} - // debugger; + // debugger; //extarct clisked body part is extarct button is already enabled. if ($rootScope.isExtract == true) { $scope.enableExtract(false); @@ -1835,7 +1865,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (isMaskImage == 'N') { if (bodyRegionId == 'modestyImg3' || bodyRegionId == 'modestyImg2') { - //do nothing + $scope.modestyImageInfo.push( + + { + "bodyRegionId": bodyRegionId, "SRC": src, + "Height": h, + "Width": w, + "x": x, + "y": y, + "haveMirror": 'false' + } + + ); } else { @@ -1914,6 +1955,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo console.log('just after highLightBody call'); } + else { + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + } } else { $rootScope.isLoading = false; @@ -2209,7 +2254,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.aligneCanvasWithTerm() } - // $timeout(function () { $scope.DisableProgressBar() }, 1000); + // $timeout(function () { $scope.DisableProgressBar() }, 1000); @@ -2444,17 +2489,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else { var canvasDiv = document.getElementById('canvasDiv'); - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition); - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition); + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition); - $rootScope.isLoading = false; + $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + $('#spinner').css('visibility', 'hidden'); //$('#canvasDiv').scrollLeft(newX); - //$('#canvasDiv').scrollTop(newY); + //$('#canvasDiv').scrollTop(newY); } - // $rootScope.isHighlightBodyByBodySystem = false; + // $rootScope.isHighlightBodyByBodySystem = false; } @@ -2650,46 +2695,46 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var tCanvas = document.getElementById('transparencyCanvas'); - var tCanvasContext = tCanvas.getContext('2d'); + var tCanvasContext = tCanvas.getContext('2d'); - var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', '')); + var tCanvasHeight = parseInt((tCanvas.style.height).replace('px', '')); - var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', '')); + var tCanvasWidth = parseInt((tCanvas.style.width).replace('px', '')); - // var tCanvas = document.getElementById('transparencyCanvas'); - if (tCanvas != null) { - clearTransCanvas(); - } - var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', '')); - var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', ''))); - var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', '')); - var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', '')); - var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight); - var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth); + // var tCanvas = document.getElementById('transparencyCanvas'); + if (tCanvas != null) { + clearTransCanvas(); + } + var TransparencyBoxStartX = parseInt((tCanvas.style.left).replace('px', '')); + var TransparencyEndX = parseInt((tCanvas.style.left).replace('px', '')) + parseInt((tCanvas.style.width.replace('px', ''))); + var TransparencyBoxStartY = parseInt((tCanvas.style.top).replace('px', '')); + var TransparencyBoxEndY = parseInt((tCanvas.style.top).replace('px', '')) + parseInt((tCanvas.style.height).replace('px', '')); + var transparencyBoxBottom = parseInt(TransparencyBoxStartY) + parseInt(tCanvasHeight); + var transparencyBoxRight = parseInt(TransparencyBoxStartX) + parseInt(tCanvasWidth); - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - $.each(BodyRegionDictionary, function (index, value) { - //debugger; - // alert(' $.each(BodyRegionDictionary1') + $.each(BodyRegionDictionary, function (index, value) { + //debugger; + // alert(' $.each(BodyRegionDictionary1') - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); - // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom) - if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { - //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value); - // debugger; - $scope.layerNumber = parseInt(txtlayerNumber.value); + // alert(' $.each(BodyRegionDictionary3. bodyRegionRight: ' + bodyRegionRight + ', bodyRegionBottom: ' + bodyRegionBottom) + if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + //var transNumber = parseInt(document.getElementById("txtTransparencyChange").value); + // debugger; + $scope.layerNumber = parseInt(txtlayerNumber.value); - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false); - } + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, transparencyBoxRight, TransparencyBoxStartY, transparencyBoxBottom, $scope, true, false); + } - }) + }) } @@ -2747,10 +2792,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($("#txtlayerNumber").val() == '') { var layerInputVal = 0; - var layerInputValInc = parseInt(layerInputVal); - $scope.layerNumber = parseInt(layerInputValInc); - $("#txtlayerNumber").val($scope.layerNumber); - // $rootScope.PreviouslayerNumbr = $scope.layerNumber; + var layerInputValInc = parseInt(layerInputVal); + $scope.layerNumber = parseInt(layerInputValInc); + $("#txtlayerNumber").val($scope.layerNumber); + // $rootScope.PreviouslayerNumbr = $scope.layerNumber; } else { @@ -2773,7 +2818,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var layerInputValDec = parseInt(layerInputVal); $scope.layerNumber = parseInt(layerInputValDec); $("#txtlayerNumber").val($scope.layerNumber); - // $rootScope.PreviouslayerNumbr = $scope.layerNumber; + // $rootScope.PreviouslayerNumbr = $scope.layerNumber; } else @@ -3060,10 +3105,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$("#bord").css("display", "none"); //$("#dot").css("display", "none"); - $('#sppeachBubble').remove(); + $('#sppeachBubble').remove(); - $("#bord").remove(); - $("#dot").remove(); + $("#bord").remove(); + $("#dot").remove(); }); @@ -3490,7 +3535,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo drag: function (evt) { //$("#dot_annotation").css("display", "none"); - $("#dot_annotation").remove(); + $("#dot_annotation").remove(); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; @@ -3824,7 +3869,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (document.getElementById('tempCanvas') != null) { $('#tempCanvas').remove(); } - if (document.getElementById('tempCanvas') == null) { + if (document.getElementById('tempCanvas') == null || document.getElementById('tempCanvas') == undefined) { var tempCanvas = document.createElement('canvas'); tempCanvas.id = 'tempCanvas'; // $scope.tempCanvas = transparencyCanvas.id; @@ -3839,6 +3884,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo document.getElementById('canvasDiv').appendChild(tempCanvas); } + $scope.isTransparencyActivated = true; var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; @@ -3870,6 +3916,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; transparencyCanvas.style.border = "black 1px solid"; transparencyCanvas.style.backgroundColor = "transparent"; + transparencyCanvas.style.zIndex = 200; // transparencyCanvas.style.visibility = 'hidden'; document.getElementById('canvasDiv').appendChild(transparencyCanvas); $scope.transparencyChangeCounter = 0; @@ -3884,27 +3931,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $(".ui-wrapper").css("z-index", "600"); - // $('#transparencyScale').modal('show'); - - //canvasDiv.removeEventListener('mouseup', arguments.callee); - //canvasDiv.removeEventListener('mousedown', arguments.callee); - //canvasDiv.removeEventListener('mousemove', arguments.callee); } if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { - //if ($rootScope.voId != "9") { - // if ($rootScope.voId != "11") { - // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); - - // } - - //} - //else { - // if (value.bodyRegionId == "6") { - // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); - // } - //} if (($rootScope.voId == "9" || $rootScope.voId == "11")) { if (value.bodyRegionId == "6") { $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); @@ -3920,6 +3950,29 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } }) + //for modesty + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { + $.each($scope.modestyImageInfo, function (index, value) { + // alert(' $.each(BodyRegionDictionary1') + var transparencyBoxHeight = parseInt(TransparencyBoxEndY) - parseInt($scope.TransparencyBoxStartY); + var transparencyBoxWidth = parseInt(TransparencyEndX) - parseInt($scope.TransparencyBoxStartX); + var transparencyBoxBottom = parseInt($scope.TransparencyBoxStartY) + parseInt(transparencyBoxHeight); + var transparencyBoxRight = parseInt($scope.TransparencyBoxStartX) + parseInt(transparencyBoxWidth); + // alert(' $.each(BodyRegionDictionary2. transparencyBoxHeight: ' + transparencyBoxHeight + ',transparencyBoxBottom: ' + transparencyBoxBottom+', transparencyBoxRight: '+transparencyBoxRight) + var bodyRegionRight = parseInt(value.x) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.y) + parseInt(value.Height); + + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { + + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + + } + }) + } + + + // + // $('#transparencyScale').modal('show'); $('#transparencyScale').css('position', 'fixed') $('#transparencyScale').css('top', $scope.TBDrawStartY - 10) @@ -3929,8 +3982,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - document.getElementById('canvasDiv').removeEventListener("mousedown", mouseUpListener); - document.getElementById('canvasDiv').removeEventListener("mousemove", mouseUpListener); + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseDownListener); + document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener); document.getElementById('canvasDiv').removeEventListener("mouseup", mouseUpListener); // document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener); @@ -3948,6 +4001,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadTransparencyImage = function (bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) { // debugger; + + // else { + var scope1 = angular.element(document.getElementById("DAView")).scope(); var transparencyCanvas = document.getElementById('transparencyCanvas'); @@ -3973,12 +4029,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var transparencyTempCanvas; + //X ends outside and start outside of bodyregion if (TransparencyBoxStartX < X && TransparencyEndX > parseInt(X) + parseInt(Width)) { XforCopyImage = 0; WidthforCopyImage = Width; WidthforTransImage = Width; - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + XforTransImage = 0; + } + else + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); // alert('1') } else if (TransparencyBoxStartX < X && TransparencyEndX < parseInt(X) + parseInt(Width)) { @@ -3990,7 +4051,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo WidthforTransImage = parseInt(TransparencyEndX) - parseInt(X); // alert(' scope.WidthforCopyImage: ' + scope.WidthforCopyImage) - XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + XforTransImage = 0; + } + else + XforTransImage = parseInt(X) - (parseInt(TransparencyBoxStartX)); // alert('2') } @@ -4000,7 +4065,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X); WidthforCopyImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX); WidthforTransImage = parseInt(X) + parseInt(Width) - parseInt(TransparencyBoxStartX); - XforTransImage = 0; + + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X); + } + else + XforTransImage = 0; // alert('3') } else if (TransparencyBoxStartX > X && TransparencyEndX < parseInt(X) + parseInt(Width)) { @@ -4008,7 +4079,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo XforCopyImage = parseInt(TransparencyBoxStartX) - parseInt(X);//parseInt(X) + parseInt(Width) - parseInt(scope.TransparencyBoxStartX)// scope.TransparencyBoxStartX ; WidthforCopyImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX); WidthforTransImage = parseInt(TransparencyEndX) - parseInt(TransparencyBoxStartX); - XforTransImage = 0 + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + + XforTransImage = parseInt(TransparencyBoxStartX) - parseInt(X); + } + else + XforTransImage = 0; // alert('4. TransparencyBoxStartX: ' + TransparencyBoxStartX + ',X: ' + parseInt(X) + ',TransparencyEndX: ' + TransparencyEndX + ',XforCopyImage: ' + XforCopyImage) } @@ -4024,7 +4100,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo HeightforTransImage = Height; //alert('Y ' + Y) - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4); + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + YforTransImage = 0; + } + else + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY)//parseFloat(Y) - (24.4); // alert('5') } else if (TransparencyBoxStartY < Y && TransparencyBoxEndY < (parseInt(Y) + parseInt(Height))) { @@ -4034,7 +4114,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo HeightforTransImage = (parseInt(TransparencyBoxEndY)) - parseInt(Y)// - parseInt(scope.TransparencyBoxStartY)); - YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4); + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + YforTransImage = 0; + } + else + YforTransImage = parseFloat(Y) - parseInt(TransparencyBoxStartY);// - (24.4); } else if (TransparencyBoxStartY > Y && TransparencyBoxEndY > parseInt(Y) + parseInt(Height)) { @@ -4042,7 +4126,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y); HeightforCopyImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY); HeightforTransImage = parseInt(Y) + parseInt(Height) - parseInt(TransparencyBoxStartY); - YforTransImage = 0; + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y); + + } + else + YforTransImage = 0; } else if (TransparencyBoxStartY > Y && TransparencyBoxEndY < parseInt(Y) + parseInt(Height)) { @@ -4050,149 +4139,142 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo YforCopyImage = parseInt(TransparencyBoxStartY) - parseInt(Y); HeightforCopyImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY); HeightforTransImage = parseInt(TransparencyBoxEndY) - parseInt(TransparencyBoxStartY); - YforTransImage = 0; - } + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + YforTransImage = parseInt(TransparencyBoxStartY) - parseInt(Y); - - //this changes the transparency when user click on transparency scale(we have already set the original - //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated) - if (isTransparencyChanged == true) { - - // var txtTransparencyChange = document.getElementById("txtTransparencyChange"); - - var transNumber = $scope.transNumber; - - var ctx = document.getElementById('transparencyCanvas').getContext('2d'); - - var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); - - // get the image data values - var imageData = imageDa.data; - var length = imageData.length; - // set every fourth value to 50 - for (var i = 3; i < length; i += 4) { - //NIKITA - if ($scope.voId == "9" || $scope.voId == "11") { - - if (imageData[i] == 0) { - - } - else { - imageData[i] = ((255) * (parseInt(transNumber))) / 100; - } - } - else { - imageData[i] = ((255) * (parseInt(transNumber))) / 100; - } - - // imageData[i] = ((255) * (parseInt(transNumber))) / 100; } - // after the manipulation, reset the data - // imageDa.data = imageData; - // and put the imagedata back to the canvas - ctx.putImageData(imageDa, XforTransImage, YforTransImage); + else + YforTransImage = 0; + } + //0. get current layer number + if ($scope.isResized) { + //do nothing } - else { + else if (isLayerChanged) { - //0. get current layer number - if ($scope.isResized) { - //do nothing - } - else if (isLayerChanged) { - // alert('isMousUp on isLayerChanged'); + } + else { - //$scope.layerNumber = parseInt($('#txtlayerNumber').val()); - } - else { - //var currentLayer = parseInt($('#txtlayerNumber').val()); + var tranparencyLayer; - //var tranparencyLayer = currentLayer + 1; - //$scope.layerNumber = tranparencyLayer; + var currentLayer = $scope.layerNumberBeforeTrans; - var tranparencyLayer; + if (currentLayer == $rootScope.totalLayers) { - //var currentLayer = parseInt($('#txtlayerNumber').val()); - var currentLayer = $scope.layerNumberBeforeTrans; + tranparencyLayer = currentLayer; - if (currentLayer == $rootScope.totalLayers) { + } - tranparencyLayer = currentLayer; + else { - } + tranparencyLayer = currentLayer + 1; - else { + } - tranparencyLayer = currentLayer + 1; + $scope.layerNumber = tranparencyLayer; - } + } - $scope.layerNumber = tranparencyLayer; + $('#txtlayerNumber').val($scope.layerNumber); - } + //dedebugger; + var tranparencyImgSrc; + var tranparencyMaskImgSrc; + //for modesty image + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg')))// == "2" || bodyRegionId == "3")) { + { + var modestyBodyRegionData = new jinqJs() + .from($scope.modestyImageInfo) + .where('bodyRegionId == ' + bodyRegionId) + .select(); + tranparencyImgSrc = modestyBodyRegionData[0].SRC; + } - $('#txtlayerNumber').val($scope.layerNumber); + //modesty end - //dedebugger; //1. get the image source - var tranparencyImgSrc; + else { tranparencyImgSrc = $scope.GetImageSource(bodyRegionId); - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); - // debugger; - var oldCanvas; + tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); + } + // var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); + // debugger; + var oldCanvas; - if (IsMirror == 'Yes') { - oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId) - } - else { - oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId) + if (IsMirror == 'Yes') { + oldCanvas = document.getElementById('transparencyTempCanvas_MR_' + bodyRegionId) + } + else { + + oldCanvas = document.getElementById('transparencyTempCanvas_' + bodyRegionId) + + } - } + if (oldCanvas != null) { + document.getElementById('canvasDiv').removeChild(oldCanvas); + } - if (oldCanvas != null) { - document.getElementById('canvasDiv').removeChild(oldCanvas); - } + //remove tempmask canvas + var oldtempTransCanvasMask; + var oldtempTransCanvasMaskMR; + if (IsMirror == 'Yes') { + oldtempTransCanvasMaskMR = document.getElementById('transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'); + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); - //remove tempmask canvas - var oldtempTransCanvasMask; - if (IsMirror == 'Yes') { - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_MR_' + bodyRegionId + '_mci'); + if (oldtempTransCanvasMaskMR != null) { + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMaskMR); } - else { - oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); + } + else { + oldtempTransCanvasMask = document.getElementById('transparencyTempCanvasMask_' + bodyRegionId + '_mci'); - } - if (oldtempTransCanvasMask != null) { - document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask); - } + } + if (oldtempTransCanvasMask != null) { + document.getElementById('canvasDiv').removeChild(oldtempTransCanvasMask); + } - transparencyTempCanvas = document.createElement('canvas'); - var transparencyTempcanavsMask = document.createElement('canvas'); - //if mirror then draw mask image for non mirrored body region for annotation - if (IsMirror == 'Yes') { - transparencyTempCanvas.id = 'transparencyTempCanvas_MR_' + bodyRegionId; - transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'; + transparencyTempCanvas = document.createElement('canvas'); + var transparencyTempcanavsMask = document.createElement('canvas'); + //if mirror then draw mask image for non mirrored body region for annotation + if (IsMirror == 'Yes') { + transparencyTempCanvas.id = 'transparencyTempCanvas_MR_' + bodyRegionId; + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_MR' + bodyRegionId + '_mci'; + } + else { + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId; + // transparencyTempCanvas.style.visibility = 'visible'; + //transparencyTempCanvas.style.zIndex = '1000' } else { transparencyTempCanvas.id = 'transparencyTempCanvas_' + bodyRegionId; transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; - } - transparencyTempCanvas.height = Height; - transparencyTempCanvas.width = Width; - transparencyTempCanvas.style.position = "absolute"; - transparencyTempCanvas.style.left = X + 'px' // x + "px"; - transparencyTempCanvas.style.top = Y + "px"//y + "px"; - transparencyTempCanvas.style.visibility = 'hidden'; - //transparencyTempCanvas.style.visibility = 'visible'; - // transparencyCanvas.style.zIndex = 4000; - document.getElementById('canvasDiv').appendChild(transparencyTempCanvas); - //create temp mask canvas + } + transparencyTempCanvas.height = Height; + transparencyTempCanvas.width = Width; + transparencyTempCanvas.style.position = "absolute"; + transparencyTempCanvas.style.left = X + 'px' // x + "px"; + transparencyTempCanvas.style.top = Y + "px"//y + "px"; + //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + // transparencyTempCanvas.style.visibility = 'visible'; + //} + //else { + transparencyTempCanvas.style.visibility = 'hidden'; + // } + //transparencyTempCanvas.style.visibility = 'visible'; + // transparencyCanvas.style.zIndex = 4000; + document.getElementById('canvasDiv').appendChild(transparencyTempCanvas); + + //create temp mask canvas + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { } + else { transparencyTempcanavsMask.height = Height; transparencyTempcanavsMask.width = Width; transparencyTempcanavsMask.style.position = "absolute"; @@ -4202,14 +4284,59 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //transparencyTempCanvas.style.visibility = 'visible'; // transparencyCanvas.style.border = "black 1px solid"; document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask); + } + + //for modesty canvas + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + var modestyTransTempCanvasId = 'tempCanvasModesty_' + bodyRegionId; + var modestyTransCanvasId = 'modestyTransCanavs_' + bodyRegionId; + if (document.getElementById(modestyTransTempCanvasId) != null) { + document.getElementById(modestyTransTempCanvasId).parentNode.removeChild(document.getElementById(modestyTransTempCanvasId)); + } + + if (document.getElementById(modestyTransTempCanvasId) == null || document.getElementById(modestyTransTempCanvasId) == undefined) { + var tempCanvasModesty = document.createElement('canvas'); + tempCanvasModesty.id = modestyTransTempCanvasId; + // $scope.tempCanvas = transparencyCanvas.id; + tempCanvasModesty.height = Height; + tempCanvasModesty.width = Width; + tempCanvasModesty.style.position = "absolute"; + tempCanvasModesty.style.left = 10 + 'px'; + tempCanvasModesty.style.top = 10 + 'px'; + tempCanvasModesty.style.backgroundColor = "transparent"; + tempCanvasModesty.style.visibility = 'hidden'; + tempCanvasModesty.style.border = "black 1px solid"; + document.getElementById('canvasDiv').appendChild(tempCanvasModesty); + } + if (document.getElementById(modestyTransCanvasId) != null) { + document.getElementById(modestyTransCanvasId).parentNode.removeChild(document.getElementById(modestyTransCanvasId)); + } + + if (document.getElementById(modestyTransCanvasId) == null || document.getElementById(modestyTransCanvasId) == undefined) { + var canvasModesty = document.createElement('canvas'); + canvasModesty.id = modestyTransCanvasId; + // $scope.tempCanvas = transparencyCanvas.id; + canvasModesty.height = Height; + canvasModesty.width = Width; + canvasModesty.style.position = "absolute"; + canvasModesty.style.left = X + 'px'; + canvasModesty.style.top = Y + 'px'; + //canvasModesty.style.backgroundColor = "transparent"; + canvasModesty.style.visibility = 'visible'; + canvasModesty.style.zIndex = '2000'; + canvasModesty.addEventListener('click', OnClickModestyTransCanvas); + + // tempcanvasModestyCanvasModesty.style.border = "black 1px solid"; + document.getElementById('canvasDiv').appendChild(canvasModesty); + } + } + if (tranparencyImgSrc != undefined) { var tempImg = new Image(); - tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; tempImg.onload = function () { - // debugger; var tempCtx = transparencyTempCanvas.getContext('2d'); if (IsMirror == 'Yes') { @@ -4230,7 +4357,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo tempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId; } else { - tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId;//bodyRegionId; + } + else + tempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; } @@ -4248,11 +4379,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //keep the original image on temp canavs to use it in changing transparency - if (document.getElementById('tempCanvas') != null) { - var contx = document.getElementById('tempCanvas').getContext('2d'); - var tbTempCanvas = document.getElementById(tempCanvasID) - contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + + //if (document.getElementById(modestyTransTempCanvasId) != undefined || document.getElementById(modestyTransTempCanvasId) != null) { + // var contxModesty = document.getElementById(modestyTransTempCanvasId).getContext('2d'); + // var tbTempCanvas = document.getElementById(tempCanvasID) + // contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + + //} + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + var modestyTempCanvasId = 'tempCanvasModesty_' + bodyRegionId; + if (document.getElementById(modestyTempCanvasId) != undefined || document.getElementById(modestyTempCanvasId) != null) { + var contxModesty = document.getElementById(modestyTempCanvasId).getContext('2d'); + var tbTempCanvas = document.getElementById(tempCanvasID) + contxModesty.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + + } + } + else { + + if (document.getElementById('tempCanvas') != null && document.getElementById('tempCanvas') != undefined) { + var contx = document.getElementById('tempCanvas').getContext('2d'); + var tbTempCanvas = document.getElementById(tempCanvasID) + contx.drawImage(tbTempCanvas, XforCopyImage, YforCopyImage, WidthforCopyImage, HeightforCopyImage, XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + + } } // get the image data values @@ -4275,15 +4426,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } else { - imageData[i] = ((255) * (parseInt(transNumber))) / 100; + if (imageData[i] == 0) { + + } + else { + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } } } tempCtx.putImageData(imageD, 0, 0); - - var ctx = transparencyCanvas.getContext('2d'); + var ctx; + if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); + } + else + ctx = transparencyCanvas.getContext('2d'); var TrtempCanvasID @@ -4291,6 +4451,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo TrtempCanvasID = 'transparencyTempCanvas_MR_' + bodyRegionId; } else { + //if ($rootScope.isModestyOn == true && (bodyRegionId.match('modestyImg'))) { + // TrtempCanvasID = 'modestyTransparencyTempCanvas_' + bodyRegionId; + //} + //else TrtempCanvasID = 'transparencyTempCanvas_' + bodyRegionId; } @@ -4310,47 +4474,138 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo PreviousBodyRegionHeight = 0; } + tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; + } - //mask image code - //draw mask for annotation - var tempMaskImg = new Image(); - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); - tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIA/" + tranparencyMaskImgSrc; - tempMaskImg.onload = function () { - // debugger; - var tempmaskCtx = transparencyTempcanavsMask.getContext('2d'); - - if (IsMirror == 'Yes') { - //debugger; - tempmaskCtx.save(); - tempmaskCtx.translate(Width, 0); - tempmaskCtx.scale(-1, 1); - tempmaskCtx.drawImage(tempMaskImg, 0, 0); - } - else { - tempmaskCtx.drawImage(tempMaskImg, 0, 0); - } + //mask image code + //draw mask for annotation + var tempMaskImg = new Image(); + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); + tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIA/" + tranparencyMaskImgSrc; + tempMaskImg.onload = function () { + // debugger; + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d'); + if (IsMirror == 'Yes') { + //debugger; + tempmaskCtx.save(); + tempmaskCtx.translate(Width, 0); + tempmaskCtx.scale(-1, 1); + tempmaskCtx.drawImage(tempMaskImg, 0, 0); + } + else { + tempmaskCtx.drawImage(tempMaskImg, 0, 0); } - PreviousBodyRegionHeight = HeightforTransImage; - PreviousBodyRegionY = YforTransImage; - PreviousBodyRegionWidth = WidthforTransImage; - PreviousBodyRegionX = XforTransImage; - previousBodyRegionId = bodyRegionId; + } - // $scope.layerNumber = parseInt($scope.layerNumber - 1); - } + PreviousBodyRegionHeight = HeightforTransImage; + PreviousBodyRegionY = YforTransImage; + PreviousBodyRegionWidth = WidthforTransImage; + PreviousBodyRegionX = XforTransImage; + previousBodyRegionId = bodyRegionId; + + // $scope.layerNumber = parseInt($scope.layerNumber - 1); + + //} } + $scope.changeTransparency = function () { + //this changes the transparency when user click on transparency scale(we have already set the original + //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated) + // if (isTransparencyChanged == true) { + + // var txtTransparencyChange = document.getElementById("txtTransparencyChange"); + + var transNumber = $scope.transNumber; + + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + var modestyTemCanvas = $("canvas[id*='tempCanvasModesty_']"); + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + + for (var j = 0; j < modestyTransCanvases.length; j++) { + var ctx = document.getElementById(modestyTransCanvases[j].id).getContext('2d'); + var imageDa = ctx.getImageData(0, 0, modestyTransCanvases[j].width, modestyTransCanvases[j].height); + //modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]); + + var imageData = imageDa.data; + var length = imageData.length; + // set every fourth value to 50 + for (var i = 3; i < length; i += 4) { + //NIKITA + if ($scope.voId == "9" || $scope.voId == "11") { + + if (imageData[i] == 0) { + + } + else { + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + } + else { + if (imageData[i] == 0) { + + } + else + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + + // imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + // after the manipulation, reset the data + // imageDa.data = imageData; + // and put the imagedata back to the canvas + //ctx.putImageData(imageDa, XforTransImage, YforTransImage); + ctx.putImageData(imageDa, 0, 0); + } + } + + + var ctx = document.getElementById('transparencyCanvas').getContext('2d'); + + // var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); + var imageDa = ctx.getImageData(0, 0, $scope.transparencyCanvasWidth, $scope.transparencyCanvasHeight); + + // get the image data values + var imageData = imageDa.data; + var length = imageData.length; + // set every fourth value to 50 + for (var i = 3; i < length; i += 4) { + //NIKITA + if ($scope.voId == "9" || $scope.voId == "11") { + if (imageData[i] == 0) { + } + else { + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + } + else { + if (imageData[i] == 0) { + + } + else + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + + // imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + // after the manipulation, reset the data + // imageDa.data = imageData; + // and put the imagedata back to the canvas + //ctx.putImageData(imageDa, XforTransImage, YforTransImage); + ctx.putImageData(imageDa, 0, 0); + + + //} + } @@ -4380,6 +4635,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + for (var j = 0; j < modestyTransCanvases.length; j++) { + + modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]); + } + } + + var modestyTempCanvases = $("canvas[id*='tempCanvasModesty_']"); + if (modestyTempCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + for (var j = 0; j < modestyTempCanvases.length; j++) { + + modestyTempCanvases[j].parentNode.removeChild(modestyTempCanvases[j]); + } + } + $scope.isResized = true; @@ -4395,10 +4666,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo transparencyCanvas.style.left = tCanvas.style.left; // x + "px"; transparencyCanvas.style.top = tCanvas.style.top//y + "px"; transparencyCanvas.style.border = "black 1px solid"; + transparencyCanvas.style.zIndex = 200; + + document.getElementById('canvasDiv').appendChild(transparencyCanvas); $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } }); + $(".ui-wrapper").css("z-index", "600"); + //bind click listener + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); } $scope.transparencyCanvasHeight = tCanvasHeight; $scope.transparencyCanvasWidth = tCanvasWidth; @@ -4449,17 +4726,39 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) - //bind click listener - //bind click listener - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + + + //for modesty + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { + $.each($scope.modestyImageInfo, function (index, value) { + // alert(' $.each(BodyRegionDictionary1') + + + var bodyRegionRight = parseInt(value.x) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.y) + parseInt(value.Height); + var TBRight = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.width).replace('px', '')); + var TBBottom = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.height).replace('px', '')); + var TBStartX = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')); + var TBStartY = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')); + + if (TBStartX <= bodyRegionRight && value.x <= TBRight && TBStartY <= bodyRegionBottom && value.y <= TBBottom) { + + + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, false); + + } + }) + } + // }); - $(".ui-wrapper").css("z-index", "600"); + //$(".ui-wrapper").css("z-index", "600"); $scope.isResized = false; } + function TransparencyCanvasClickListener(evt) { //alert('tb clicked') // debugger; @@ -4482,49 +4781,49 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var isMirror; var width; var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - if ($rootScope.viewOrientationId == 5) { + if ($rootScope.viewOrientationId == 5) { - var clickedBodyRegionData = new jinqJs() - .from(BodyRegionDictionary) - .where('bodyRegionId == 6') - .select(); + var clickedBodyRegionData = new jinqJs() + .from(BodyRegionDictionary) + .where('bodyRegionId == 6') + .select(); - // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId; - x = clickedBodyRegionData[0].X; - y = clickedBodyRegionData[0].Y; - width = clickedBodyRegionData[0].Width; - var height = clickedBodyRegionData[0].Height; - isMirror = clickedBodyRegionData[0].IsMirror; - var bodyRegionRight = parseInt(x) + parseInt(width); - var bodyRegionBottom = parseInt(y) + parseInt(height); - if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) { + // clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId; + x = clickedBodyRegionData[0].X; + y = clickedBodyRegionData[0].Y; + width = clickedBodyRegionData[0].Width; + var height = clickedBodyRegionData[0].Height; + isMirror = clickedBodyRegionData[0].IsMirror; + var bodyRegionRight = parseInt(x) + parseInt(width); + var bodyRegionBottom = parseInt(y) + parseInt(height); + if (actulalX <= bodyRegionRight && x <= actulalX && actualY <= bodyRegionBottom && y <= actualY) { - clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId; - x = clickedBodyRegionData[0].X; - y = clickedBodyRegionData[0].Y; - width = clickedBodyRegionData[0].Width; - var height = clickedBodyRegionData[0].Height; - isMirror = clickedBodyRegionData[0].IsMirror; - } + clickedBodyRegion = clickedBodyRegionData[0].bodyRegionId; + x = clickedBodyRegionData[0].X; + y = clickedBodyRegionData[0].Y; + width = clickedBodyRegionData[0].Width; + var height = clickedBodyRegionData[0].Height; + isMirror = clickedBodyRegionData[0].IsMirror; + } - } - else { - $.each(BodyRegionDictionary, function (index, value) { + } + else { + $.each(BodyRegionDictionary, function (index, value) { - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); - if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) { + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); + if (actulalX <= bodyRegionRight && value.X <= actulalX && actualY <= bodyRegionBottom && value.Y <= actualY) { - clickedBodyRegion = value.bodyRegionId; - x = value.X; - y = value.Y; - width = value.Width; - isMirror = value.IsMirror; - return false; - } - }) - } + clickedBodyRegion = value.bodyRegionId; + x = value.X; + y = value.Y; + width = value.Width; + isMirror = value.IsMirror; + return false; + } + }) + } if (isMirror == "Yes") { @@ -4535,110 +4834,69 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci'; var clickedCanavs = document.getElementById(clickedCanvasMaskId); - //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation - var clickedBodyRegionData = new jinqJs() - .from(BodyRegionDictionary) - .where('bodyRegionId == ' + clickedBodyRegion) - .select(); - if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) { - - var nomMirroredBodyRegion = new jinqJs() - .from(clickedBodyRegionData) - .where('IsMirror == No') - .select(); - - - //debugger; - var oldMirrorMaskId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; - var oldMirrorMask = document.getElementById(oldMirrorMaskId); - if (oldMirrorMask != null) { - document.getElementById('canvasDiv').removeChild(oldMirrorMask); - } - var transparencyTempcanavsMask = document.createElement('canvas'); - transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; - transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height; - transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width; - transparencyTempcanavsMask.style.position = "absolute"; - transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px"; - transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px"; - transparencyTempcanavsMask.style.visibility = 'hidden'; - - document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask); - - var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion); - var tempMaskImg = new Image(); - var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); - tempMaskImg.onload = function () { - var tempmaskCtx = transparencyTempcanavsMask.getContext('2d'); - tempmaskCtx.drawImage(tempMaskImg, 0, 0); - - //get x,y of non mirrored canvas for this body region - x = transparencyTempcanavsMask.style.left; - y = transparencyTempcanavsMask.style.top; - - var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; - var maskCanvastrans = document.getElementById(maskCanvasTransId); - var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); - + var maskCanvasId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; + var maskCanvas = document.getElementById(maskCanvasId); + + if (maskCanvas != null) { + x = maskCanvas.style.left; + y = maskCanvas.style.top; + var maskCanvasTransId = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; + var maskCanvastrans = document.getElementById(maskCanvasTransId); + var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); - var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) - var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135); - var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); + } - var actulalX = mirrorXOnNormalImage - var actualY = mousePos.y + verticalScrollPosition + //if non mirrored canvas does not exist for this irror Body region then draw non mirrored image to get annotation + else if (maskCanvas == null) { + var clickedBodyRegionData = new jinqJs() + .from(BodyRegionDictionary) + .where('bodyRegionId == ' + clickedBodyRegion) + .select(); + if (clickedBodyRegionData != null || clickedBodyRegionData != undefined) { + var nomMirroredBodyRegion = new jinqJs() + .from(clickedBodyRegionData) + .where('IsMirror == No') + .select(); - var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci'; - var maskCanvas = document.getElementById(clickedCanvasMaskId); - var maskCanvasContext = maskCanvas.getContext("2d"); - var imgX = Math.round(actulalX - parseInt(x.replace('px', ''))); - var imgY = Math.round(actualY - parseInt(y.replace('px', ''))); - pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1); + var transparencyTempcanavsMask = document.createElement('canvas'); + transparencyTempcanavsMask.id = 'transparencyTempCanvasMask_' + clickedBodyRegion + '_mci'; + transparencyTempcanavsMask.height = nomMirroredBodyRegion[0].Height; + transparencyTempcanavsMask.width = nomMirroredBodyRegion[0].Width; + transparencyTempcanavsMask.style.position = "absolute"; + transparencyTempcanavsMask.style.left = nomMirroredBodyRegion[0].X + 'px' // x + "px"; + transparencyTempcanavsMask.style.top = nomMirroredBodyRegion[0].Y + "px"//y + "px"; + transparencyTempcanavsMask.style.visibility = 'hidden'; + document.getElementById('canvasDiv').appendChild(transparencyTempcanavsMask); - //trans layer image data - pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1); - // console.log('at the time' + pixelData.data[0]) - // debugger; - var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope); - if ($('#speechBubble').length > 0) - $('#speechBubble').remove(); + var tranparencyImgSrc = $scope.GetImageSource(clickedBodyRegion); + var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc); + var tempMaskImg = new Image(); + tempMaskImg.src = tranparencyMaskImgSrc; - if ($('#speechBubbleTrns').length > 0) { - $('#speechBubbleTrns').remove(); + tempMaskImg.onload = function () { + var transparencyTempcanavsMask = document.getElementById(maskCanvasId); + var tempmaskCtx = transparencyTempcanavsMask.getContext('2d'); + tempmaskCtx.drawImage(tempMaskImg, 0, 0); - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + //get x,y of non mirrored canvas for this body region + x = transparencyTempcanavsMask.style.left; + y = transparencyTempcanavsMask.style.top; - $scope.annotationTextArrayT1 = []; - $scope.annotationTextArrayT2 = []; - $scope.annotationTextArrayT1.push(annotations.annotationT1); - $scope.annotationTextArrayT2.push(annotations.annotationT2); + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, tempmaskCtx, clickedBodyRegion, x, y, evt) - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); } - else - // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) - - $scope.annotationTextArrayT1 = []; - $scope.annotationTextArrayT2 = []; - $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); } - tempMaskImg.src = "http://localhost/AIAHtml/" + tranparencyMaskImgSrc; - - } + } else { @@ -4675,21 +4933,160 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } else // $scope.createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + { + + $scope.annotationTextArrayT1 = []; + $scope.annotationTextArrayT2 = []; + $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); + } + + } + + + } + + function OnClickModestyTransCanvas(evt) { + + var mousePos = $scope.getMousePos(evt); + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + + var actulalX = mousePos.x + horizontlScrollPosition; + var actualY = mousePos.y + verticalScrollPosition; + + 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); + + 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 bodyRegionId = canvasId.slice(-1); + + 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)); + + //transparecncy canvas + var maskCanvasTransId = 'transparencyTempCanvasMask_' + bodyRegionId + '_mci'; + var maskCanvastrans = document.getElementById(maskCanvasTransId); + var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); + + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - canavsX), Math.round(actualY - canvasY), 1, 1); + + 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)); + + + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) $scope.annotationTextArrayT1 = []; + $scope.annotationTextArrayT2 = []; + $scope.annotationTextArrayT1.push(annotations.annotationT1); + $scope.annotationTextArrayT2.push(annotations.annotationT2); + + } + + if ($('#speechBubble').length > 0) + $('#speechBubble').remove(); + + + if ($('#speechBubbleTrns').length > 0) { + $('#speechBubbleTrns').remove(); + } + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); + + + } + + function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) + { + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135); + + var mirrorXOnNormalImage = parseInt(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); + + var actulalX = mirrorXOnNormalImage + var actualY = mousePos.y + verticalScrollPosition + + + + var clickedCanvasMaskId = 'imageCanvas' + clickedBodyRegion + '_mci'; + var maskCanvas = document.getElementById(clickedCanvasMaskId); + var maskCanvasContext = maskCanvas.getContext("2d"); + var imgX = Math.round(actulalX - parseInt((x).replace('px', ''))); + var imgY = Math.round(actualY - parseInt((y).replace('px', ''))); + var pixelData = maskCanvasContext.getImageData(imgX, imgY, 1, 1); + + + //trans layer image data + var pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1); + // console.log('at the time' + pixelData.data[0]) + // debugger; + var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope); + if ($('#speechBubble').length > 0) + $('#speechBubble').remove(); + + + if ($('#speechBubbleTrns').length > 0) { + $('#speechBubbleTrns').remove(); + + // createSpeechBubbleOnTransparencyBox(evt, annotations.annotationT1, annotations.annotationT2, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left + 5, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top - 50) + + $scope.annotationTextArrayT1 = []; $scope.annotationTextArrayT2 = []; $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 + { + $scope.annotationTextArrayT1 = []; + $scope.annotationTextArrayT2 = []; + $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); } - //debugger; - } - function clearTransCanvas() { + } + + + function clearTransCanvas() { var tCanvas = document.getElementById('transparencyCanvas'); if (tCanvas != null) { @@ -4815,25 +5212,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ctx.putImageData(originalTransparencyData, 0, 0); - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - - $scope.IncludedBodyRegions = []; - var counter = 0; - $.each(BodyRegionDictionary, function (index, value) { - - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); - - + //for modesty - if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + //for modesty + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { + $.each($scope.modestyImageInfo, function (index, value) { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, true); - - } + var brId = value.bodyRegionId; - }); + var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId; + var modestyTransCanvasId = 'modestyTransCanavs_' + brId; + var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d'); + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height); + var ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); + ctx.putImageData(originalTransparencyData, 0, 0); + }) + } + $scope.changeTransparency(); // }); @@ -4841,9 +5237,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.CloseTransparencyBox = function () { - + //To enable extract button - $scope.isTransparencyActivated = false; + $scope.isTransparencyActivated = false; $("#btnExtract").removeClass("disabled"); //$('.com_anno').css('display', 'none'); @@ -4887,7 +5283,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //var scope = angular.element(document.getElementById("DAView")).scope(); //scope.$apply(function () { // $scope.layerNumber = 0; - // $scope.isTransparencyActivated = false; + // $scope.isTransparencyActivated = false; //}) @@ -4904,6 +5300,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.transNumber = 50; $(".slider").slider({ value: 50 }) } + + + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + for (var j = 0; j < modestyTransCanvases.length; j++) { + + modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]); + } + } + $('#transparencyScale').css('visibility', 'hidden'); //$scope.isTransparencyActivated = false; @@ -4960,6 +5366,48 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) }; + $scope.createSpeechBubbleOnTransparencyBox = function (event, text1, text2, x, y) { + + $('#canvasDiv').css('cursor', 'pointer'); + $('