diff --git a/.gitignore b/.gitignore index 5920fe1..9725b84 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,5 @@ $tf*/ 400-SOURCECODE/AIAHTML5.ADMIN.Web 400-SOURCECODE/AIAHTML5.ADMIN.API/LogDetailsFile/LicenseCreation/LicenseCreation-30-11-18.txt 400-SOURCECODE/AIAHTML5.Web/Web.config +400-SOURCECODE/AIAHTML5.Web/Web.config 400-SOURCECODE/AIAHTML5.Web/Web.config \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 9a0a875..e9c36b9 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -150,6 +150,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l 'moduleName': '', 'mode': '', 'transparencyBounds': [], + 'isCallForTransparencyImage':false, 'layerNumberTransparency': 0, 'transparencyValue': 0, 'transparencyX': 0, @@ -259,6 +260,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l 'moduleName': '', 'mode': '', 'transparencyBounds': [], + 'isCallForTransparencyImage': false, 'layerNumberTransparency': 0, 'transparencyValue': 0, 'transparencyX': 0, @@ -1760,7 +1762,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l else { // for existing DA - var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); + var viewOrientationId = $scope.GetwindowStoreData(windowviewid, 'viewOrientationId'); + $scope.CalculateImageCordinates(viewOrientationId, windowviewid); } @@ -1941,7 +1944,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#spinner').css('visibility', 'visible'); //redraw body of respective layer - var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); + var viewOrientationId = $scope.GetwindowStoreData(windowviewid, 'viewOrientationId'); + $scope.CalculateImageCordinates(viewOrientationId, windowviewid); }, 500); @@ -2363,9 +2367,25 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if (isListManagerSelected == true) { $scope.SetwindowStoreData(windowviewid,'layerNumber',$('#txtLayerNumberDA_' + windowviewid).val()); } + + var lNumber=null; + if ($scope.GetwindowStoreData(windowviewid, 'isZoomed') && ($scope.GetwindowStoreData(windowviewid, 'isTransparencyBtnClicked') == true || $scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated'))) + { + if ($scope.GetwindowStoreData(windowviewid, 'isCallForTransparencyImage') == true) { + lNumber = $scope.GetwindowStoreData(windowviewid, 'layerNumber'); - var lNumber=$scope.GetwindowStoreData(windowviewid,'layerNumber'); + } + else + lNumber = $scope.GetwindowStoreData(windowviewid, 'layerNumberBeforeTBDraw'); + + console.log("GetImageSource lNumber IF= " + lNumber) + } + else{ + + lNumber = $scope.GetwindowStoreData(windowviewid, 'layerNumber'); + console.log("GetImageSource lNumber = " + lNumber); + } $scope.userInput = parseInt(lNumber); if (!$rootScope.isCallFromOtherModule) { @@ -2921,8 +2941,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var isGenderChnage = $scope.GetwindowStoreData(windowviewid,'isGenderChnage'); var isViewChange = $scope.GetwindowStoreData(windowviewid,'isViewChange'); var isHighlightBodyByBodySystem=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem'); - var isListManagerSelected=$scope.GetwindowStoreData(windowviewid,'isListManagerSelected'); - if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + var isListManagerSelected = $scope.GetwindowStoreData(windowviewid, 'isListManagerSelected'); + // var isTBACtive = $scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated'); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) { + + $scope.DrawTransparencyBox(windowviewid); + + } + else if ($scope.GetwindowStoreData(windowviewid, 'isExtract') == true) { $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $scope.DisableUI(); @@ -2935,11 +2961,17 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); - $scope.SetwindowStoreData(windowviewid,'isHighLight',true); + $scope.SetwindowStoreData(windowviewid, 'isHighLight', true); $scope.DisableUI(); $scope.highLightBody(windowviewid); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + $scope.CalculateDimensionsAndDrawTBox(windowviewid); + } } else { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + $scope.CalculateDimensionsAndDrawTBox(windowviewid); + } var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { $scope.ShowCBDataBodyView(windowviewid); @@ -3424,8 +3456,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var isViewChange = $scope.GetwindowStoreData(windowviewid,'isViewChange'); var isHighlightBodyByBodySystem=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem'); var isExtract= $scope.GetwindowStoreData(windowviewid,'isExtract') - var isListManagerSelected=$scope.GetwindowStoreData(windowviewid,'isListManagerSelected'); - if (isExtract == true) { + var isListManagerSelected = $scope.GetwindowStoreData(windowviewid, 'isListManagerSelected'); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) { + + $scope.DrawTransparencyBox(windowviewid); + + } + else if (isExtract == true) { $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $scope.DisableUI(); @@ -3457,9 +3494,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.highLightBody(windowviewid); console.log('just after highLightBody call'); + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + $scope.CalculateDimensionsAndDrawTBox(windowviewid); + } } else { + if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + $scope.CalculateDimensionsAndDrawTBox(windowviewid); + } var isHighlightBodyWithCBTermData = $scope.GetwindowStoreData(windowviewid, 'isHighlightBodyWithCBTermData'); if (isHighlightBodyWithCBTermData == true) { $scope.ShowCBDataBodyView(windowviewid); @@ -3471,13 +3514,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } //Added Code by sandy to create Draw transparencybox autometically for save CB - if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { - $scope.CalculateDimensionsAndDrawTBox(windowviewid); - //$scope.setOriginalDataAndChangeTransparency(windowviewid); - // finish CB window load - //$rootScope.DAWindowLoadComplete = true; - $rootScope.isLoading = true; - } + //if ($scope.GetwindowStoreData(windowviewid, 'isTransparent') == true) { + // $scope.CalculateDimensionsAndDrawTBox(windowviewid); + // //$scope.setOriginalDataAndChangeTransparency(windowviewid); + // // finish CB window load + // //$rootScope.DAWindowLoadComplete = true; + // $rootScope.isLoading = true; + //} } @@ -4698,6 +4741,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //layer change function $scope.LayerChange = function (windowviewid) { + $scope.DisableUI(); $rootScope.CloseListManager(); $scope.isLayerChange = true; @@ -4871,7 +4915,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } //2. - var viewOrientationId=$scope.GetwindowStoreData(windowviewid,'viewOrientationId'); + var viewOrientationId = $scope.GetwindowStoreData(windowviewid, 'viewOrientationId'); + console.log("CalculateImageCordinates call from 4723"); + $scope.CalculateImageCordinates(viewOrientationId,windowviewid); //3. @@ -5258,7 +5304,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var sub_id_annotation = "black_annotation" + TPspeechBubbleCounter+"_"+windowviewid + '-' + termNumber; var pointClicked_annotation = parseInt(x) + parseInt(y); var Exists_annotation = $('#canvasDivDA_' + windowviewid).find("div[id=" + pointClicked_annotation + "]").length; - $scope.createSpeechBubbleBasedOnTransparencyWithCtrl(pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation,windowviewid,TPspeechBubbleCounter); + $scope.createSpeechBubbleBasedOnTransparencyWithCtrl(pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation, windowviewid, TPspeechBubbleCounter); $scope.speechbubbleList.push({ xaxis: x, yaxis: y, ids: sub_id_annotation }); $scope.SetwindowStoreData(windowviewid,'speachBubbleArrayAnnotation',$scope.speechList1); $('.appendDragg_annotation').draggable({ @@ -5507,7 +5553,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if ($('#dot_annotation_' + windowviewid).length > 0) { $('#dot_annotation_' + windowviewid).show(); } - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "block" }); + //$('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "block" }); if ($('#dot_' + windowviewid).length > 0) { $('#dot_' + windowviewid).show(); @@ -5677,7 +5723,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l document.getElementById('sppeachBubble_' + windowviewid + '-' + termNumber).style.top = (Globe[0].currentY) + 'px'; } - $scope.createSpeechBubbleBasedOnTransparencyWithCtrl = function (pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation,windowviewid,TPspeechBubbleCounter) { + $scope.createSpeechBubbleBasedOnTransparencyWithCtrl = function (pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation, windowviewid, TPspeechBubbleCounter) { var sppechBubbleHTML_annotation = "
"; if ($scope.longest_annotationT1.length > $scope.longest_annotationT2.length) { @@ -5725,6 +5771,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l else { $('#canvasDivDA_' + windowviewid).find("div[id=" + pointClicked_annotation + "]").css("display", "block"); } + } } $scope.createSpeechBubbleBasedOnTransparencyWithoutCtrl = function (x, y, windowviewid, termNumber) { @@ -5989,7 +6036,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var currentlayer=$scope.GetwindowStoreData(windowviewid,'currentLayerNumber'); //Dated:19-07-2016 Issue#4975: Transparency box should not be clickable if it is already selected. - if ($('#txtLayerNumberDA_' + windowviewid).val() != 0 && currentlayer != undefined) { + if ($('#txtLayerNumberDA_' + windowviewid).val() != 0 && currentlayer != undefined && currentlayer != 0) { var totalayer=$scope.GetwindowStoreData(windowviewid,'totalLayers'); @@ -6053,8 +6100,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l function mouseUpListener(e) { - var len= (e.currentTarget.id).split("_").length; - var windowviewid = (e.currentTarget.id).split("_")[len-1]; + var len = (e.currentTarget.id).split("_").length; + var windowviewid = (e.currentTarget.id).split("_")[len - 1]; e.preventDefault(); //to prevent screen scroll on ipad while drawing TB @@ -6065,7 +6112,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isNormalMode')); $scope.SetwindowStoreData(windowviewid, 'IsHighlightModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isHighlight')); - // alert($scope.GetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw')); + // alert($scope.GetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw')); //$('.com_'+windowviewid).remove(); //$('#dot_'+windowviewid).remove(); //$('#bord_'+windowviewid).remove(); @@ -6113,11 +6160,11 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var previewRectangleWidth = $('.rectangle').width(); var previewRectangleHeight = $('.rectangle').height() - $scope.SetwindowStoreData(windowviewid,'currentLayerNumber',parseInt($('#txtLayerNumberDA_' + windowviewid).val())); + $scope.SetwindowStoreData(windowviewid, 'currentLayerNumber', parseInt($('#txtLayerNumberDA_' + windowviewid).val())); $('.rectangle').remove(); - var currentMousePosition = $scope.getMousePos(e.pageX,e.pageY,windowviewid); + var currentMousePosition = $scope.getMousePos(e.pageX, e.pageY, windowviewid); var canavsDivScrollPos = $scope.getCanavsDivScrollPosition(windowviewid); @@ -6135,11 +6182,12 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //Save TranparencyBox and slider for CurriculmBuilder //$rootScope.commonTBEndX = TransparencyEndX; //$rootScope.commonTBEndY = TransparencyBoxEndY; - var transparencyBounds = $scope.GetwindowStoreData(windowviewid,'transparencyBounds'); - transparencyBounds.push({ - 'h': $scope.TransparencyEndX, 'x': $scope.TransparencyBoxStartX, - 'w': $scope.TransparencyBoxEndY, 'y': $scope.TransparencyBoxStartY - }); + //var transparencyBounds = $scope.GetwindowStoreData(windowviewid,'transparencyBounds'); + //transparencyBounds.push({ + // 'h': $scope.TransparencyEndX, 'x': $scope.TransparencyBoxStartX, + // 'w': $scope.TransparencyBoxEndY, 'y': $scope.TransparencyBoxStartY + //}); + //$scope.SetwindowStoreData(windowviewid, 'transparencyBounds', transparencyBounds); if ($scope.TransparencyBoxStartX == $scope.TransparencyEndX && $scope.TransparencyBoxStartY == $scope.TransparencyBoxEndY) { @@ -6164,29 +6212,12 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#btnTranparency_' + windowviewid).removeClass('btn-black'); $('#btnTranparency_' + windowviewid).addClass('tButtonActive'); - $scope.SetwindowStoreData(windowviewid,'layerNumberBeforeTBDraw',parseInt($('#txtLayerNumberDA_' + windowviewid).val())); + $scope.SetwindowStoreData(windowviewid, 'layerNumberBeforeTBDraw', parseInt($('#txtLayerNumberDA_' + windowviewid).val())); // $scope.layerNumberBeforeTBDraw = parseInt($('#txtLayerNumberDA_' + windowviewid).val()); - //draw temp box to store the canvas data with original transparecy - if (document.getElementById('tempCanvas_' + windowviewid) != null) { - $('#tempCanvas_' + windowviewid).remove(); - } - if (document.getElementById('tempCanvas_'+ windowviewid) == null || document.getElementById('tempCanvas_'+ windowviewid) == undefined) { - var tempCanvas = document.createElement('canvas'); - tempCanvas.id = 'tempCanvas_' + windowviewid; - tempCanvas.height = TransparencyBoxEndY - $scope.startY; - tempCanvas.width = TransparencyEndX - $scope.startX; - tempCanvas.style.position = "absolute"; - tempCanvas.style.left = 200 + 'px'; - tempCanvas.style.top = 200 + 'px'; - tempCanvas.style.backgroundColor = "transparent"; - tempCanvas.style.visibility = 'hidden'; - tempCanvas.style.border = "black 1px solid"; - document.getElementById("canvasDivDA_" + windowviewid).appendChild(tempCanvas); - } - + - $scope.SetwindowStoreData(windowviewid,'isTransparencyBtnClicked',false); + $scope.SetwindowStoreData(windowviewid, 'isTransparencyBtnClicked', false); @@ -6210,189 +6241,294 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } - var new_startx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? TransparencyEndX : $scope.TransparencyBoxStartX; - var new_starty = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? TransparencyBoxEndY : $scope.TransparencyBoxStartY; - var new_endx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? $scope.TransparencyBoxStartX : TransparencyEndX; - var new_endy= (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? $scope.TransparencyBoxStartY:TransparencyBoxEndY ; - - $scope.TransparencyBoxStartX = new_startx; - TransparencyEndX = new_endx; - $scope.TransparencyBoxStartY = new_starty; - TransparencyBoxEndY = new_endy; + var new_startx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? TransparencyEndX : $scope.TransparencyBoxStartX; + var new_starty = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? TransparencyBoxEndY : $scope.TransparencyBoxStartY; + var new_endx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? $scope.TransparencyBoxStartX : TransparencyEndX; + var new_endy = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? $scope.TransparencyBoxStartY : TransparencyBoxEndY; + $scope.TransparencyBoxStartX = new_startx; + var TransparencyEndX = new_endx; + $scope.TransparencyBoxStartY = new_starty; + var TransparencyBoxEndY = new_endy; + $scope.TBoxEndX = TransparencyEndX; + $scope.TBoxEndY = TransparencyBoxEndY; + $scope.TBHeight = height; + $scope.TBWidth = width; + + $scope.DrawTransparencyBox(windowviewid); + } + + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mousedown", mouseDownListener); + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mousemove", mouseMoveListener); + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mouseup", mouseUpListener); var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid, 'BodyRegionCordinatesData'); - $.each(BodyRegionDictionary, function (index, value) { + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("touchstart", mouseDownListener); + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("touchmove", mouseMoveListener); - var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width); + document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("touchend", mouseUpListener); + + + + //Dated:18-07-2016 Issue#4975: Transparency box should not be clickable if it is already selected. + $('#btnTranparency_' + windowviewid).removeClass('tButtonActive'); + $('#btnTranparency_' + windowviewid).addClass('btn-black'); + $('#btnIdentify_' + windowviewid).removeClass('btn-black'); + $('#btnIdentify_' + windowviewid).addClass('btn-primary'); + + // clear canvas before drawing transparency box + if ($rootScope.isAnnotationWindowOpen == true) { + $('#canvasDA_' + windowviewid).removeLayers(); + var paintCanvasObj = document.getElementById("canvasPaintDA_" + windowviewid); + if (paintCanvasObj != null) { + var ctx = paintCanvasObj.getContext("2d"); + ctx.clearRect(0, 0, 2277, 3248); + } + var sktch = $("#canvasPaintDA_" + windowviewid).sketch(); + $("#canvasPaintDA_" + windowviewid).sketch().actions = []; + $("#annotationpaintbrushsize").removeClass("activebtncolor"); + $("#annotationpainteraser").removeClass("activebtncolor"); + if ($("#DrawMode").hasClass("annotationtoolbartab")) { + if ($scope.GetwindowStoreData(windowviewid, 'isTBoxModestyVisible') == true) { + + $rootScope.switchCanvas(); - var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; - var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; - var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; - var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; - var bodyRegionRight = tBoxDimesions.bodyRegionRight; - var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; - var width = 0; - var height = 0; - if (TransparencyEndX < $scope.TransparencyBoxStartX) { - width = $scope.TransparencyBoxStartX - TransparencyEndX; - } - else { - width = TransparencyEndX - $scope.TransparencyBoxStartX; - } - if (TransparencyBoxEndY < $scope.TransparencyBoxStartY) { - height = $scope.TransparencyBoxStartY - TransparencyBoxEndY; } else { - height = TransparencyBoxEndY - $scope.TransparencyBoxStartY; + var drawCanvasZindex = $('#canvasDA_' + windowviewid).css("z-index"); + var paintCanvasZindex = $("#canvasPaintDA_" + windowviewid).css("z-index"); + drawCanvasZindex = parseInt(drawCanvasZindex) - 1; + paintCanvasZindex = parseInt(paintCanvasZindex) - 1; + if (drawCanvasZindex > paintCanvasZindex) { + $(".ui-wrapper").css("z-index", drawCanvasZindex); + $scope.SetwindowStoreData(windowviewid, 'UIWrapperZIndex', drawCanvasZindex); + } + else { + $(".ui-wrapper").css("z-index", paintCanvasZindex); + $scope.SetwindowStoreData(windowviewid, 'UIWrapperZIndex', paintCanvasZindex); + } } - var new_x, new_y; + } + else { + $rootScope.switchToTransparencycanvas(); + } + } + else { - new_x = (TransparencyEndX < $scope.TransparencyBoxStartX) ? TransparencyEndX : $scope.TransparencyBoxStartX; - new_y = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? TransparencyBoxEndY : $scope.TransparencyBoxStartY; + $scope.SetwindowStoreData(windowviewid, 'UIWrapperZIndex', 12000); + $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex')); - var transparencyCanvas = document.createElement('canvas'); - var tBox = document.getElementById('transparencyCanvas_'+ windowviewid); - if (tBox == null) { + } + //hide the speechbubble - transparencyCanvas.id = 'transparencyCanvas_'+ windowviewid; - $scope.transparencyCanvasId = transparencyCanvas.id; - transparencyCanvas.height = height; - transparencyCanvas.width = width; - transparencyCanvas.style.position = "absolute"; - //transparencyCanvas.style.left = $scope.startX + 'px' // x + "px"; - //transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; - transparencyCanvas.style.left = new_x + 'px' // x + "px"; - transparencyCanvas.style.top = new_y + "px" - transparencyCanvas.style.border = "black 1px solid"; - transparencyCanvas.style.backgroundColor = "transparent"; - transparencyCanvas.style.zIndex = 200; - document.getElementById("canvasDivDA_" + windowviewid).appendChild(transparencyCanvas); - $scope.transparencyChangeCounter = 0; - $('#transparencyCanvas_' + windowviewid).resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(windowviewid); }, start: function (event, ui) { clearTransCanvas(windowviewid); } }); + if ($rootScope.isAnnotationWindowOpen == true) + $rootScope.isTBCompleted = true; + } + } - $scope.transparencyCanvasHeight = transparencyCanvas.height; - $scope.transparencyCanvasWidth = transparencyCanvas.width; +// $scope.DrawTransparencyBox = function (TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, windowviewid) { - //bind click listener - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + $scope.DrawTransparencyBox = function (windowviewid) { + var newDimes = null; + // if ($scope.GetwindowStoreData(windowviewid, 'zoomInOut') == 25) { + if ( $scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated') && $scope.GetwindowStoreData(windowviewid, 'isZoomed') == true) { + // alert("ZOOM"); + newDimes = $scope.scaleTransparencyBox(windowviewid); - $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid,'UIWrapperZIndex')); + $scope.TransparencyBoxStartX = newDimes.scaledX1; + TransparencyEndX = newDimes.scaledX2; + $scope.TransparencyBoxStartY = newDimes.scaledY1; + TransparencyBoxEndY = newDimes.scaledY2; + $scope.TBoxEndX = newDimes.scaledX2; + $scope.TBoxEndY = newDimes.scaledY2; + $scope.TBHeight = newDimes.scaledHeight; + $scope.TBWidth = newDimes.scaledWidth; + } + $scope.transparencyDrawnRegions = []; + $scope.canThirdBRDrawn = false; - } - if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + var TransparencyBoxStartX = newDimes != null ? newDimes.scaledX1 : $scope.TransparencyBoxStartX, TransparencyEndX = newDimes != null ? newDimes.scaledX2 : $scope.TBoxEndX, TransparencyBoxStartY = newDimes != null ? newDimes.scaledY1 : $scope.TransparencyBoxStartY, TransparencyBoxEndY = newDimes != null ? newDimes.scaledY2 : $scope.TBoxEndY; + //draw temp box to store the canvas data with original transparecy + if (document.getElementById('tempCanvas_' + windowviewid) != null) { + $('#tempCanvas_' + windowviewid).remove(); + } + if (document.getElementById('tempCanvas_' + windowviewid) == null || document.getElementById('tempCanvas_' + windowviewid) == undefined) { + var tempCanvas = document.createElement('canvas'); + tempCanvas.id = 'tempCanvas_' + windowviewid; + tempCanvas.height = TransparencyBoxEndY - TransparencyBoxStartY; + tempCanvas.width = TransparencyEndX - TransparencyBoxStartX; + tempCanvas.style.position = "absolute"; + tempCanvas.style.left = 200 + 'px'; + tempCanvas.style.top = 200 + 'px'; + tempCanvas.style.backgroundColor = "transparent"; + tempCanvas.style.visibility = 'hidden'; + tempCanvas.style.border = "black 1px solid"; + document.getElementById("canvasDivDA_" + windowviewid).appendChild(tempCanvas); + } + var transparencyCanvas = document.createElement('canvas'); + var tBox = document.getElementById('transparencyCanvas_' + windowviewid); - $scope.SetwindowStoreData(windowviewid,'isTBDrawnOnBodyRegion',true); + if (document.getElementById('transparencyCanvas_' + windowviewid) != null) { + $('#transparencyCanvas_' + windowviewid).remove(); + $('#transparencyCanvas_' + windowviewid).parent().remove(); + } + if (document.getElementById('transparencyCanvas_' + windowviewid) == null) { - if (value.bodyRegionId == '3') { + transparencyCanvas.id = 'transparencyCanvas_' + windowviewid; + $scope.transparencyCanvasId = transparencyCanvas.id; + transparencyCanvas.height = TransparencyBoxEndY - TransparencyBoxStartY;; + transparencyCanvas.width = TransparencyEndX - TransparencyBoxStartX; + transparencyCanvas.style.position = "absolute"; + //transparencyCanvas.style.left = $scope.startX + 'px' // x + "px"; + //transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; + transparencyCanvas.style.left = TransparencyBoxStartX + 'px'//new_x + 'px' // x + "px"; + transparencyCanvas.style.top = TransparencyBoxStartY + 'px'// + "px" + transparencyCanvas.style.border = "black 1px solid"; + transparencyCanvas.style.backgroundColor = "transparent"; + transparencyCanvas.style.zIndex = 200; + document.getElementById("canvasDivDA_" + windowviewid).appendChild(transparencyCanvas); + $scope.transparencyChangeCounter = 0; - var BR_SixTBData = new jinqJs() - .from($scope.transparencyDrawnRegions) - .where('BRID == 6') - .select(); + $('#transparencyCanvas_' + windowviewid).resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(windowviewid); }, start: function (event, ui) { clearTransCanvas(windowviewid); } }); - if (BR_SixTBData != null && BR_SixTBData != undefined && BR_SixTBData.length > 0) { + $scope.transparencyCanvasHeight = transparencyCanvas.height; + $scope.transparencyCanvasWidth = transparencyCanvas.width; - $scope.canThirdBRDrawn = true; + //bind click listener + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); - } + $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex')); + + } + + var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid, 'BodyRegionCordinatesData'); + $.each(BodyRegionDictionary, function (index, value) { + + + var tBoxDimesions = $scope.getTBoxDimesions(TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width); + + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; + var bodyRegionRight = tBoxDimesions.bodyRegionRight; + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; + + + + if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + + $scope.SetwindowStoreData(windowviewid, 'isTBDrawnOnBodyRegion', true); + + if (value.bodyRegionId == '3') { + + var BR_SixTBData = new jinqJs() + .from($scope.transparencyDrawnRegions) + .where('BRID == 6') + .select(); + + if (BR_SixTBData != null && BR_SixTBData != undefined && BR_SixTBData.length > 0) { + $scope.canThirdBRDrawn = true; } - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - if (bodyVid == "9" || bodyVid == "11" || bodyVid == "2" || bodyVid == "3" || bodyVid == "6" || bodyVid == "7") { - 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, false, windowviewid); - } - else { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - } + + + } + var bodyVid = $scope.GetwindowStoreData(windowviewid, 'voId'); + if (bodyVid == "9" || bodyVid == "11" || bodyVid == "2" || bodyVid == "3" || bodyVid == "6" || bodyVid == "7") { + if (value.bodyRegionId == "6") { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); } else { - if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == true) { - - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - } + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + } + } + else { + if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == true) { - else { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + } - if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == false) { + else { - //1. draw 6th - var BRSixData = new jinqJs() - .from(BodyRegionDictionary) - .where('bodyRegionId == 6') - .select(); - var isMirror = BRSixData[0].IsMirror; - if (isMirror == 'Yes') { - //draw mirror arm - $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'Yes', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - //draw non mirror arm - $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'No', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - //draw 3rd BR - $timeout(function () { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - }, 200); - } - else { - //draw mirror arm - $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'No', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - //draw mirror arm - $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'Yes', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - //draw mirror arm - $timeout(function () { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); - }, 200); - } + if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == false) { + //1. draw 6th + var BRSixData = new jinqJs() + .from(BodyRegionDictionary) + .where('bodyRegionId == 6') + .select(); + var isMirror = BRSixData[0].IsMirror; + if (isMirror == 'Yes') { + //draw mirror arm + $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'Yes', TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + //draw non mirror arm + $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'No', TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + //draw 3rd BR + $timeout(function () { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + }, 200); } else { - var BR_SixTBData = new jinqJs() - .from($scope.transparencyDrawnRegions) - .where('BRID == 6') - .select(); - if (value.bodyRegionId == "6" && BR_SixTBData != undefined && BR_SixTBData != null && BR_SixTBData.length > 0) { } - else - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + //draw mirror arm + $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'No', TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + //draw mirror arm + $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'Yes', TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + //draw mirror arm + $timeout(function () { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + }, 200); } - } + } + else { + var BR_SixTBData = new jinqJs() + .from($scope.transparencyDrawnRegions) + .where('BRID == 6') + .select(); + if (value.bodyRegionId == "6" && BR_SixTBData != undefined && BR_SixTBData != null && BR_SixTBData.length > 0) { } + else + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + } } } - else { - //when user draw TB outside body than no bodyRegion - //is covred and nothing is drawn so the function is not called in which we are enabling UI - $scope.EnableUI(); - } - }) - //for modesty - var modestyImageInfo=$scope.GetwindowStoreData(windowviewid,'modestyImageInfo'); - if (modestyImageInfo.length > 0) { + } + else { + //when user draw TB outside body than no bodyRegion + //is covred and nothing is drawn so the function is not called in which we are enabling UI + $scope.EnableUI(); + } + }) - $.each(modestyImageInfo, function (index, value) { + //for modesty + var modestyImageInfo = $scope.GetwindowStoreData(windowviewid, 'modestyImageInfo'); + if (modestyImageInfo.length > 0) { - var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width); + $.each(modestyImageInfo, function (index, value) { - var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; - var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; - var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; - var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; - var bodyRegionRight = tBoxDimesions.bodyRegionRight; - var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; + var tBoxDimesions = $scope.getTBoxDimesions(TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width); - if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; + var bodyRegionRight = tBoxDimesions.bodyRegionRight; + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false,false, windowviewid); + if (TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { - } - }) - } + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid); + + } + }) + } // var transparencySliderHTML = // '