diff --git a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj index e5f5d94..5b7ffb2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj +++ b/400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj @@ -44565,6 +44565,8 @@ + + diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js index 4d15ed9..7778607 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js @@ -58,9 +58,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } else { $scope.setActiveTab(1); + $scope.reRunSearchOnLoad(); } - $scope.reRunSearchOnLoad(); + }); @@ -449,6 +450,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); + $("#annotationpaintbrushsize").attr('disabled', 'disabled'); + //$("#annotationpaintbrushsize").attr("href", "#"); } $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 15f0753..916f317 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -64,9 +64,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } else { $scope.setActiveTab(1); + $scope.reRunSearchOnLoad(); } - $scope.reRunSearchOnLoad(); + }); @@ -562,7 +563,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout theme: 'success', currentController: 'CIController', parentSlug: 'clinical-illustrations', - content: '
' + + content: '
' + '
' + '
' + '

' + $scope.clickedCISummary + '

' + @@ -619,7 +620,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $("#canvasPaint").css("display", "block"); $rootScope.BindCanvasDrawingListners(); - // $rootScope.FreeStylePaint(); + $rootScope.FreeStylePaint(); }); $scope.ReloadListViewImageDiv = function (id) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 7562470..9393297 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -15,6 +15,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $rootScope.BodyLayerData; $rootScope.VocabTermData; + //for modesty image layers + $scope.lowerlayerNumberForModesty; + $scope.HigherlayerNumberForModesty; + $scope.layerInfoForModesty; + $scope.VocabTermTxt; $scope.CommonData $rootScope.TermNumberData; @@ -89,7 +94,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //navigator man functionality $scope.navigatorImage; - $scope.NavigatorData; + $rootScope.NavigatorData; $scope.navimgsrc; $scope.dragdivleft = 0; @@ -140,6 +145,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + $scope.scroll = function () { // $window.scrollTo(0, 0); $("html,body").scrollTop(0); @@ -669,12 +675,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $http({ method: 'GET', url: NavigatorManJsonPath }) .success(function (data) { - $scope.NavigatorData = data; + $rootScope.NavigatorData = data; $scope.skinTone = $rootScope.globalSetting.ethnicity; var navigatorManData = new jinqJs() - .from($scope.NavigatorData.Navigtor.ViewOrientation) + .from($rootScope.NavigatorData.Navigtor.ViewOrientation) .where("_ViewOrientationId == " + $rootScope.currentBodyViewId) .select(); @@ -709,7 +715,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo navImageModesty = $scope.navigatorImage[0]._ImageName; } - $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navImageModesty; + // $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navImageModesty; + document.getElementById('navimg').src = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navImageModesty; $('#navigatorDiv').css('visibility', 'visible'); @@ -772,21 +779,23 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate coordinates for body region images $scope.CalculateImageCordinates = function (viewOrientationId) { - + $scope.layerInfoForModesty = []; $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $scope.modestyImageInfo = []; // annotation toolbar canvas - if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { - $("#canvasDiv").append(''); - $scope.BindCanvasDrawingListners(); + //history code + + if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { + var ATBarHtml = $("#canvasDiv").append(''); + $compile(ATBarHtml)($scope); + $scope.onDrawingCanvasClick(); // $rootScope.FreeStylePaint(); } - $scope.terminateCurrentlyRunningWPs(); var drawnBodyRegionCount = []; @@ -966,9 +975,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ((dtlOfSktn != null || dtlOfSktn != undefined) && (dtlOfSktn.length > 0)) { if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) > parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) { + $scope.figLaefImageName = dtlOfSktn[0]._ImageId; - //$scope.figLaefX = filtereddata[0]._X; - //$scope.figLaefY = filtereddata[0]._Y; + + + $scope.lowerlayerNumberForModesty = dtlOfSktn[0]._lns; + $scope.HigherlayerNumberForModesty = dtlOfSktn[0]._lne; + $scope.layerInfoForModesty.push({ "bodyRegionId": value._BodyRegionId, "lowerlayerNumberForModesty": $scope.lowerlayerNumberForModesty, "HigherlayerNumberForModesty": $scope.HigherlayerNumberForModesty }) var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue); @@ -2987,6 +3000,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //$(".com").css("display", "none"); //$("#bord").css({ "width": "0px", "display": "none" }); + + //history maintained issue + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + $("#sppeachBubble").remove(); + $("#dot").remove(); + } + + + $(".com").remove(); $("#bord").remove(); @@ -3089,6 +3111,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px'; document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px'; + + //history maintained issue + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { document.getElementById('sppeachBubble').style.zIndex = "100000000000"; } + + + $('#sppeachBubble').draggable( { drag: function (evt) { @@ -3572,6 +3600,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + + if (document.getElementById("btnStrutureBox").name == "showAnnotationStructure") { + $scope.showAnnotation() + + } + else { + $scope.hideAnnotation() + + + } + } + + $scope.showAnnotation = function() + { + $(".com").show(); + $('#dot').show(); + $('#bord').show(); + $('#sppeachBubble').show(); + $('#sppeachBubble_annotation').show(); + + $("#bord_annotation").show(); + $("#dot_annotation").show(); + $(".dynCross_anno").parent().parent().parent().show(); + } + + $scope.hideAnnotation=function() + { + $(".com").hide(); + $('#dot').hide(); + $('#bord').hide(); + $('#sppeachBubble').hide(); + $('#sppeachBubble_annotation').hide(); + $("#bord_annotation").hide(); + $("#dot_annotation").hide(); + $(".dynCross_anno").parent().parent().parent().hide(); } $scope.createSpeechBubbleBasedOnAnnotationLength = function (pointClicked, x, y, id) { @@ -4384,13 +4447,6 @@ 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(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) { @@ -4480,6 +4536,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } tempImg.src = tranparencyImgSrc;//"http://localhost/AIA/" + tranparencyImgSrc; + } @@ -4514,9 +4571,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo PreviousBodyRegionX = XforTransImage; previousBodyRegionId = bodyRegionId; - // $scope.layerNumber = parseInt($scope.layerNumber - 1); - //} + //set modesty image visiblility true/false as per layer + + + var layerInfo = new jinqJs() + .from($scope.layerInfoForModesty) + .where('bodyRegionId == ' + bodyRegionId) + .select(); + if (layerInfo != undefined && layerInfo.length>0){ + var lowerlayerNumberForModesty = layerInfo[0].lowerlayerNumberForModesty; + var HigherlayerNumberForModesty = layerInfo[0].HigherlayerNumberForModesty; + + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + for (var j = 0; j < modestyTransCanvases.length; j++) { + + if (modestyTransCanvases[j].id.match(bodyRegionId)) { + + var modestyCanavs = document.getElementById(modestyTransCanvases[j].id); + + if ((parseInt(lowerlayerNumberForModesty) <= parseInt($scope.layerNumber)) && (HigherlayerNumberForModesty) > parseInt($scope.layerNumber)) { + + modestyCanavs.style.visibility = 'visible'; + } + else { + + modestyCanavs.style.visibility = 'hidden'; + + } + } + + } + } + } } @@ -4611,6 +4700,114 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //} } + // History Maintained Issue// + + $rootScope.getAnnotationTextBasedOnSelectedBodyRegion = function (event) { + + + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + + + $rootScope.Xaxis = event.pageX - $('#canvasDiv').offset().left + horizontlScrollPosition; + $rootScope.Yaxis = event.pageY - $('#canvasDiv').offset().top + verticalScrollPosition; + + + $rootScope.setSelectedBodyRegionData(); + + if ($rootScope.isMirrorBodyRegion == "No") { + var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci"; + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + //var canvasDiv = document.getElementById('canvasDiv'); + //var verticalScrollPosition = canvasDiv.scrollTop; + //var horizontlScrollPosition = canvasDiv.scrollLeft; + var actulalX = $rootScope.Xaxis; + var actualY = $rootScope.Yaxis; + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, $rootScope.BodyRegionXAxis, $rootScope.BodyRegionYAxis); + var annotationText = $scope.GetAnnotationText(parseInt(RGBColor)); + + } + else { + + var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_MR_mci"; + var maskoffsetval = $('#' + maskCanvasId).offset(); + var mirrorCanvasX = maskoffsetval.left; + //alert(mirrorCanvasX); + var mirrorImageCanvas = document.getElementById(maskCanvasId); + var mirrorCanvasWidth = mirrorImageCanvas.clientWidth; + // alert(mirrorCanvasWidth); + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(event.pageX) + horizontlScrollPosition);// - 135); + var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); + var actulalX = mirrorXOnNormalImage; + var actualY = event.pageY + verticalScrollPosition; + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - $rootScope.BodyRegionYAxis), 1, 1); + pixelData.data[0] = pixelData.data[0] - 9; + pixelData.data[1] = pixelData.data[1] - 9; + pixelData.data[2] = pixelData.data[2] - 9 + var Red; + var Green; + var Blue; + var zero = "0"; + if ((pixelData.data[0]).toString().length != 2) { + Red = zero.concat((pixelData.data[0]).toString()) + } + else { + Red = (pixelData.data[0]).toString() + } + if ((pixelData.data[1]).toString().length != 2) { + Green = zero.concat((pixelData.data[1]).toString()) + } + else { + Green = (pixelData.data[1]).toString() + } + if ((pixelData.data[2]).toString().length != 2) { + Blue = zero.concat((pixelData.data[2]).toString()) + } + else { + Blue = (pixelData.data[2]).toString() + } + var RGBColor = (Red + Green + Blue); + // alert(RGBColor); + //$rootScope.previousHighlightList.push(RGBColor); + + } + + // var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci"; + + // alert(annotationText); + $scope.MultiLanguageAnnationArray = []; + $scope.MultiLanguageAnnationArray.push(annotationText); + if (annotationText == "undefined") { + } + else { + $scope.createDynamicSpeechBubble(event, event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true) + } + + + } + + + $rootScope.setSelectedBodyRegionData = function () { + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; + + $.each(BodyRegionDictionary, function (index, value) { + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); + if ($rootScope.Xaxis <= bodyRegionRight && $rootScope.Yaxis <= bodyRegionBottom && value.X <= $rootScope.Xaxis && value.Y <= $rootScope.Yaxis) { + $rootScope.BRId = value.bodyRegionId; + $rootScope.BodyRegionXAxis = value.X; + $rootScope.BodyRegionYAxis = value.Y; + $rootScope.isMirrorBodyRegion = value.IsMirror; + return false; + } + }); + } + function resizeCanvas() { @@ -5216,7 +5413,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ctx.putImageData(originalTransparencyData, 0, 0); - //for modesty //for modesty if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { @@ -5226,10 +5422,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo 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); + if (document.getElementById(modestyTransTempCanvasId) != null) { + + 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); + } }) } @@ -5881,20 +6080,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //if listanager is visisble then close it + $rootScope.isListManagerSelected = false; $rootScope.CloseListManager(); + var btnStrutureBoxname = document.getElementById("btnStrutureBox").name; - $(".com").toggle(); - $('#dot').toggle(); - $('#bord').toggle(); - $('#sppeachBubble').toggle(); - $('#sppeachBubble_annotation').toggle(); - - $("#bord_annotation").toggle(); - $("#dot_annotation").toggle(); - $(".dynCross_anno").parent().parent().parent().toggle(); + if (btnStrutureBoxname == "showAnnotationStructure") { + $("#btnStrutureBox").addClass("disableHideShowStructure"); + $scope.hideAnnotation(); + document.getElementById("btnStrutureBox").name = "hideAnnotationStructure"; + } + else { + $("#btnStrutureBox").removeClass("disableHideShowStructure"); + $scope.showAnnotation(); + document.getElementById("btnStrutureBox").name = "showAnnotationStructure"; + } + } @@ -6409,7 +6612,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //4. - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); + $scope.loadNavigatorForSelectedBodyView(currentBodyViewId); //5. change the search terms as per the selected bodyview $scope.loadSearchDataForBodyView(); @@ -6441,7 +6644,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //4. - $scope.loadSelectedBodyViewNavigator(currentBodyViewId); + $scope.loadNavigatorForSelectedBodyView(currentBodyViewId); //5. change the search terms as per the selected bodyview $scope.loadSearchDataForBodyView(); @@ -6641,7 +6844,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView($rootScope.voId); //3. load corresponding navigator man - $scope.loadSelectedBodyViewNavigator($rootScope.voId); + $scope.loadNavigatorForSelectedBodyView($rootScope.voId); //4. change the search terms as per the selected bodyview $scope.loadSearchDataForBodyView(); @@ -6675,7 +6878,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.loadSelectedBodyView($rootScope.voId); //2. - $scope.loadSelectedBodyViewNavigator($rootScope.voId); + $scope.loadNavigatorForSelectedBodyView($rootScope.voId); }; @@ -6761,20 +6964,28 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) + $scope.$on('changeNavigatorModestyEvent', function (event, data) { + console.log('changeNavigatorModestyEvent'); + + $scope.loadNavigatorForSelectedBodyView(data.bodyViewId); + + }) //Reload DA controller Body View after setting Change $scope.$on('reloadDABodyViewEvent', function (event, data) { //console.log('reloadDABodyViewEvent'); - $scope.layerNumber = parseInt($('#txtlayerNumber').val()); - //alert('mouseUp'); + if ($rootScope.isSettingEventAlredayDispachted == true) { + $rootScope.isSettingEventAlredayDispachted = false; + $scope.layerNumber = parseInt($('#txtlayerNumber').val()); + //alert('mouseUp'); - if ($scope.layerNumber == 0) { - $scope.loadSelectedBodyView(data.reloadDABodyViewId); - } - // $scope.loadSelectedBodyView(data.reloadDABodyViewId); - - $scope.loadSelectedBodyViewNavigator(data.reloadDABodyViewId); + if ($scope.layerNumber == 0) { + $scope.loadSelectedBodyView(data.reloadDABodyViewId); + } + // $scope.loadSelectedBodyView(data.reloadDABodyViewId); + $scope.loadNavigatorForSelectedBodyView(data.reloadDABodyViewId); + } // $scope.currentTitleFromJson = localStorage.getItem("currentViewTitle"); //$rootScope.isSettingEventAlredayDispachted = false; @@ -6782,17 +6993,15 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }) - - - $scope.loadSelectedBodyViewNavigator = function (currentBodyViewId) { + $scope.loadNavigatorForSelectedBodyView = function (currentBodyViewId) { //$rootScope.voId = currentBodyViewId; //$scope.skinTone = $rootScope.globalSetting.ethnicity; - if ($scope.NavigatorData != null || $scope.NavigatorData != undefined) { + if ($rootScope.NavigatorData != null || $rootScope.NavigatorData != undefined) { var navdtlOrient = new jinqJs() - .from($scope.NavigatorData.Navigtor.ViewOrientation) + .from($rootScope.NavigatorData.Navigtor.ViewOrientation) .where("_ViewOrientationId == " + currentBodyViewId) .select(); @@ -6822,7 +7031,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } - $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty; + // $scope.navimgsrc = 'http://localhost/AIAHTML5/content/images/DA/ethnicity/body-views/' + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty;//"~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty; + document.getElementById('navimg').src = '~/../content/images/DA/ethnicity/body-views/' + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty;//"~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $rootScope.globalSetting.ethnicity + '/navigator_images/' + navImageModesty; } } @@ -6847,7 +7057,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $("#canvas").css("display", "block"); $("#canvasPaint").css("display", "block"); - $rootScope.BindCanvasDrawingListners(); + $rootScope.onDrawingCanvasClick(); $rootScope.FreeStylePaint(); }); $scope.mousePs; @@ -6861,114 +7071,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo - $rootScope.FreeStylePaint = function (e) { - - var annotationCanvas = document.getElementById("canvas"); - // document.getElementById("canvasPaint").addEventListener("mouseup", OnPaintBrushCanvasMouseUp); - - annotationCanvas.addEventListener('mousedown', $scope.OnPaintCanvasMouseDown, false); - - annotationCanvas.addEventListener('mouseup', $scope.OnPaintBrushCanvasMouseUp, false); - } - $scope.OnPaintCanvasMouseDown = function (event) { - $rootScope.isMousedownOnPaintCanvas = true; - $scope.isStartPointDeleted = false; - var annotationCanvas = document.getElementById("canvas"); - $scope.startPageX = parseInt(event.clientX - ($("#canvas").offset().left)); - $scope.startPageY = parseInt(event.clientY - ($("#canvas").offset().top)); - - annotationCanvas.addEventListener('mousemove', $scope.OnPaintCanvasMouseMove, false); - - - - } - $scope.OnPaintCanvasMouseMove = function (event) { - - - $rootScope.xPage = parseInt(event.clientX - ($("#canvas").offset().left)); - $rootScope.yPage = parseInt(event.clientY - ($("#canvas").offset().top)); - - var btneraseBrushSizeValue = $("#btnBrushSize").val(); - $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue); - - if ($rootScope.isEraseToolSelected == true && $rootScope.isMousedownOnPaintCanvas == true) { - - var sktch = $('#canvasPaint').sketch(); - $('#canvasPaint').sketch().actions = []; - var paintCanvas = document.getElementById("canvasPaint"); - var paintCanvasContext = paintCanvas.getContext('2d'); - if ($scope.isStartPointDeleted == false) { - - paintCanvasContext.clearRect($scope.startPageX, $scope.startPageY, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); - - $scope.isStartPointDeleted = true; - } - - paintCanvasContext.clearRect($rootScope.xPage, $rootScope.yPage, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); - - - } - } - $scope.OnPaintBrushCanvasMouseDown = function (event) { - switch ($rootScope.shapeType) { - - case "FreeStylePaint": - - - - // $('#canvasPaint').sketch(); - // $('#canvasPaint').sketch({ defaultSize: 1 }); - // if ($("#amount-2").val() == '') { - // //$('#canvasPaint').sketch({ defaultSize: $scope.shapesize }); - // $('#canvasPaint').sketch(); - // } - // else { - - // // var a = $("#amount-2").val(); - //// $scope.shapesize = parseInt(a); - // // $('#canvasPaint').sketch({ defaultSize: $rootScope.shapeSize }); - // // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize }); - - // } - - - break; - - } - } - $scope.OnPaintBrushCanvasMouseUp = function (event) { - $rootScope.isMousedownOnPaintCanvas = false; - $rootScope.isEraseToolSelected = false; - - // var canvasElement1 = document.getElementById("canvasPaint"); - // var ctx1 = canvasElement1.getContext("2d"); - - //switch($rootScope.shapeType) - //{ - - // case "FreeStylePaint": - - - // if ($("#amount-2").val() == '') - // { - // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize }); - // } - // else - // { - - // var a = $("#amount-2").val(); - // $scope.shapesize = parseInt(a); - // alert(JSON.stringify({ defaultSize: $scope.shapesize })); - // $('#canvasPaint').sketch({ defaultSize: $scope.shapesize }); - - // } - - - // break; - - //} - - } + + @@ -7318,6 +7422,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); + + $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 4016108..7b8e4a8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -64,19 +64,30 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.isEraseToolSelected = false; $rootScope.isMousedownOnPaintCanvas = false; + //opacity code + $rootScope.shapestyleOpacity = 1; + $rootScope.shapestyleFillColor = "#fff"; + $rootScope.shapestyleFillBorderColor = "black"; + $rootScope.shapestyleborderWidth = 2; + $rootScope.shapestyleborderStyles = "solid"; $rootScope.$on("$locationChangeSuccess", function () { - if (($location.url() == "/da-body-view") || ($location.url() == "/clinical-illustrations-detail") || ($location.url() == "/clinical-animations-detail")) { + if (($location.url() == "/da-body-view")) { $rootScope.disableMenuannotation = " "; $rootScope.disableMenuoption = " "; - + } + else if (($location.url() == "/clinical-illustrations-detail") || ($location.url() == "/clinical-animations-detail")) { + $rootScope.disableMenuannotation = " "; + $rootScope.disableMenuoption = " "; + $rootScope.disableSubMenu = "disableSubMenu"; } else { $rootScope.disableMenuannotation = "disableMenuannotation"; $rootScope.disableMenuoption = "disableMenuoption"; + $rootScope.disableSubMenu = ""; $rootScope.CloseAnnotationTool(); $rootScope.CloseListManager(); angular.element('#modal-settings').modal('hide'); @@ -140,16 +151,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } } - // $rootScope.DrawLine = function () { - //$rootScope.isIdetifyClicked = false; - //$rootScope.isDrawingToolSelected = true; - //$rootScope.isLineDrawSelecyed = true; - // $rootScope.shapeType = "Line"; - // alert($rootScope.shapeType); - - - // } - $rootScope.ClearIframe = function () { if ($('#daImagePanel') != null) $('#daImagePanel').remove(); @@ -171,18 +172,25 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //7904 if ($rootScope.MenuModuleName == "DA") { if ($rootScope.disableAnnotationtoolOnListManager == true) { - $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').attr('disabled', 'disabled'); + $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); + $("#annotationpaintbrushsize").attr('disabled', 'disabled'); + // $rootScope.disableAnnotationTB = false; } else { $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); + $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); } // document.getElementById('modelbackground').style.display = "block"; // document.getElementById('modeleditstyle').style.display = "block"; } + if ($rootScope.MenuModuleName == "CA") + { + $("#annotationpaintbrushsize").attr("href", "#"); + } $("#OnIdentify").addClass("annotationtoolbartab"); $("#annotationToolBarOptions").addClass("active"); $("#annotationButton").addClass("active"); @@ -190,8 +198,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.isAnnotationWindowOpen = true; $(".annotationTollbar").css("display", "block"); $rootScope.$broadcast('annotationToolEvent', true); - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; if ($rootScope.isFontFamilyLoaded == false) { @@ -232,10 +240,11 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".annotationTollbar").css("display", "none"); $rootScope.isAnnotationWindowClose = true; - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); + $rootScope.isAnnotaionToolBarDrawingModeActive = true; } $rootScope.CIAnotationIdentifyModeOff = false; $rootScope.OnIdentifyClick = function () { @@ -249,25 +258,31 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').removeClass('activebtncolor'); } else { - $("#canvasPaint").css("display", "none"); - $("#canvas").css("display", "none"); + // $("#canvasPaint").css("display", "none"); + // $("#canvas").css("display", "none"); // $("#canvasPaint").css("z-index", "0"); // $("#canvas").css("z-index", "0"); $('.btnCursor').removeClass('activebtncolor'); } + + $rootScope.isAnnotaionToolBarDrawingModeActive = false; + $rootScope.switchCanvas(); } $rootScope.DrawingMode = function () { + //Annotation History + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $("#OnIdentify").removeClass("annotationtoolbartab"); $("#DrawMode").addClass("annotationtoolbartab"); $('.btnCursor').addClass('activebtncolor'); $rootScope.switchCanvas(); - $("#canvasPaint").css("display", "block"); - $("#canvas").css("display", "block"); + + // $("#canvasPaint").css("display", "block"); + // $("#canvas").css("display", "block"); } @@ -280,14 +295,12 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('#modal-settings').modal('toggle'); } - } - - //----Annotation Toolbar: Jcanvas----- - $rootScope.DrLine = function (e) { + $rootScope.DrawLine = function (e) + { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); @@ -295,7 +308,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.switchCanvas(); $rootScope.shapeType = "Line"; - $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-line").addClass("activebtncolor"); @@ -304,7 +316,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } - $rootScope.DrPin = function (e) { + $rootScope.DrawPin = function (e) { $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); @@ -338,32 +350,53 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-rectangle").addClass("activebtncolor"); } + $rootScope.paintBrush = function () { - // debugger; - // $('.btnCursor').addClass('activebtncolor'); - $rootScope.setListManagerZindex = true; - $("#canvasPaint").css("display", "block"); - $("#canvas").css("display", "block"); - $rootScope.switchCanvasToPaintCanvas(); - $rootScope.shapeType = "FreeStylePaint"; + $rootScope.isAnnotaionToolBarDrawingModeActive = false; + if ($rootScope.disableAnnotationtoolOnListManager == true) { + $rootScope.switchCanvas(); + var canvasPaintZindex = $('#canvasPaint').css("z-index"); //x + + var canvasZindex = $('#canvas').css("z-index"); //y + var listManagerZindex = $('#listManager').css("z-index"); //z + if (canvasPaintZindex > canvasZindex) { + + $('#listManager').css("z-index", canvasPaintZindex); + + } else { + + $('#listManager').css("z-index", canvasZindex); + } + + } else { + + // $('.btnCursor').addClass('activebtncolor'); + $rootScope.setListManagerZindex = true; + $("#canvasPaint").css("display", "block"); + $("#canvas").css("display", "block"); + $rootScope.switchCanvasToPaintCanvas(); + $rootScope.shapeType = "FreeStylePaint"; var btnBrushSizeValue = $("#btnBrushSize").val(); $rootScope.shapeSize = parseInt(btnBrushSizeValue); $("#annotationpaintbrushsize").attr("data-size", $rootScope.shapeSize); - $("#annotationpaintbrushsize").attr("data-color", $rootScope.shapestyleFillColor); + $("#annotationpaintbrushsize").attr("data-color", $rootScope.shapestyleColorWithOpacity); - if ($rootScope.shapeSize == '') { - $('#canvasPaint').sketch({ defaultSize: 1 }); - } - else { - $('#canvasPaint').sketch(); - } + if ($rootScope.shapeSize == '') { + $('#canvasPaint').sketch({ defaultSize: 1 }); + } + else { + $('#canvasPaint').sketch(); - // $('#canvasPaint').sketch(); + } + } + $('.btnCursor').removeClass('activebtncolor'); + $(".btn-annotation").removeClass("activebtncolor"); + $(".btn-annotation-brush").addClass("activebtncolor"); } @@ -412,23 +445,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-Text").addClass("activebtncolor"); - // $("#text_area").val(''); - // $("#text_area").css({ " font-family": 'Verdana, sans-serif', "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); - } + } $rootScope.DrawPolygon = function () { $rootScope.setListManagerZindex = true; $("#canvasPaint").css("display", "block"); $("#canvas").css("display", "block"); $rootScope.shapeType = "DrawPolygon"; - } - $rootScope.OpacityModal = function () { - - - } $rootScope.switchCanvas = function () { var x = $('#canvasPaint').css("z-index"); @@ -441,72 +467,75 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $('#canvas').css("z-index", y); } $rootScope.EraseDrawing = function () { + $rootScope.isAnnotaionToolBarDrawingModeActive = false; $rootScope.switchCanvas(); $rootScope.isEraseToolSelected = true; //$rootScope.switchCanvasToPaintCanvas(); - //// $('#canvasPaint').sketch({ defaultColor: "yellow", defaultSize: 1 }); - //var sktch = $('#canvasPaint').sketch(); - //$('#canvasPaint').sketch().actions = []; // this line empties the actions. - //var myCanvas = document.getElementById("canvasPaint"); - //var ctx = myCanvas.getContext('2d'); - //ctx.clearRect(0, 0, myCanvas.width, myCanvas.height); - //$rootScope.switchCanvas(); - + $('.btnCursor').removeClass('activebtncolor'); + $(".btn-annotation").removeClass("activebtncolor"); + $(".btn-annotation-erase").addClass("activebtncolor"); } - //opacity code - $rootScope.shapestyleOpacity = 1; - $rootScope.shapestyleFillColor = "#fff"; - $rootScope.shapestyleFillBorderColor = "black"; - $rootScope.shapestyleborderWidth = 2; - $rootScope.shapestyleborderStyles = "solid"; - $rootScope.shapestyle = function (id) { - // debugger; - document.getElementById('modelbackground').style.display = "none"; - document.getElementById('modeleditstyle').style.display = "none"; - - $rootScope.shapestyleOpacity = $("#" + id).css('opacity'); - $("#shapeStyleDiv").parent().css("opacity", $rootScope.shapestyleOpacity); - $rootScope.shapestyleFillColor = $("#" + id).css('background-color'); - $("#shapeStyleDiv").css("background-color", $rootScope.shapestyleFillColor); - $rootScope.shapestyleborderColor = $("#" + id).parent().css("border-top-color"); - $("#shapeStyleDiv").parent().css("border-color", $rootScope.shapestyleborderColor); - $rootScope.shapestyleborderWidthSeparatingPixel = $("#" + id).parent().css("border-top-width"); - $("#shapeStyleDiv").parent().css("border-width", $rootScope.shapestyleborderWidthSeparatingPixel); - var pixelSeparation = $rootScope.shapestyleborderWidthSeparatingPixel; - var intPart = pixelSeparation.split("p"); - - $rootScope.shapestyleborderWidth = intPart[0]; - $rootScope.shapestyleborderStyles = "solid"; + $rootScope.isShapeSyleOkBtnClicked = false; + $rootScope.setPropertiesForShapes = function (id) { + $rootScope.isShapeSyleOkBtnClicked = true; + + if ((document.getElementById('fill-option').checked == false) && (document.getElementById('Outline-Option').checked == false)) { + // $('#btnShapeStyle').attr('disabled', 'disabled'); + } else { + //$('#btnShapeStyle').removeAttr('disabled', 'disabled'); + document.getElementById('modelbackground').style.display = "none"; + document.getElementById('modeleditstyle').style.display = "none"; + $rootScope.shapestyleOpacity = $("#" + id).css('opacity'); + $("#shapeStyleDiv").parent().css("opacity", $rootScope.shapestyleOpacity); + $rootScope.shapestyleFillColor = $("#" + id).css('background-color'); + $rootScope.shapeStyleColorRGBA = $rootScope.shapestyleFillColor.replace("rgb", "rgba"); + $rootScope.shapestyleColorWithOpacity = $rootScope.shapeStyleColorRGBA.substring(0, $rootScope.shapeStyleColorRGBA.length - 1) + " " + "," + $rootScope.shapestyleOpacity + ")"; + $("#shapeStyleDiv").css("background-color", $rootScope.shapestyleFillColor); + $rootScope.shapestyleborderColor = $("#" + id).parent().css("border-top-color"); + // $("#shapeStyleDiv").parent().css("border-color", $rootScope.shapestyleborderColor); + $rootScope.borderDimensions = $("#" + id).parent().css("border-top-width"); + + document.getElementById("shapeStyleDiv").parentNode.style.border = $rootScope.borderDimensions + " " + "solid" + " " + $rootScope.shapestyleborderColor; - $('#editshapestyle').modal('hide'); - // name: 'Circle_' + $rootScope.resetCircle, + // $("#shapeStyleDiv").parent().css("border-width", $rootScope.shapestyleborderWidthSeparatingPixel); + var borderDimensions = $rootScope.borderDimensions; + var borderDimensionSplitArray = borderDimensions.split("p"); - // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); + $rootScope.shapestyleborderWidth = borderDimensionSplitArray[0]; + $rootScope.shapestyleborderStyles = "solid"; - //Edit Shape Style popup should open at it's default position - $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); + $('#editshapestyle').modal('hide'); + + //Edit Shape Style popup should open at it's default position + $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); + } } $rootScope.enableAnnotationToolBar = function () { if ($rootScope.disableAnnotationTB == true) { document.getElementById('modelbackground').style.display = "none"; - //$("#editshapestyle").modal('show'); document.getElementById('modeleditstyle').style.display = "none"; } else { document.getElementById('modelbackground').style.display = "block"; - //$("#editshapestyle").modal('show'); document.getElementById('modeleditstyle').style.display = "block"; + + // alert(document.getElementById('outlinedivId').style.border); + // alert(document.getElementById('imgOpacity').style.backgroundColor); + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", document.getElementById('imgOpacity').style.backgroundColor); + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", document.getElementById('outlinedivId').style.border); + if ($('#modeleditstyle').css("display") == "block") { //Check if the modal is already showing var previewOpacity = $('#imgOpacity').css("opacity"); $('#slider-range-min-4 div.ui-slider-range-min').css("width", (previewOpacity * 100) + "%"); $('#slider-range-min-4 span.ui-slider-handle').css("left", (previewOpacity * 100) + "%"); }; + } } @@ -522,308 +551,418 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".custom-tooltip-annotation").css('display', 'none'); $("#edit-block").removeClass("custom-tooltip-annotation"); - - } $rootScope.disableAnnotationToolBar = function () { - + if ($rootScope.isShapeSyleOkBtnClicked == false) { + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)"); + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)"); + var previewBorderColor = $("#outlineColor span.minicolors-swatch-color").css('background-color'); + $(".marginTopBtm10 div.outlinediv").css("border-color", previewBorderColor); + var previewBgColor = $("#editstylebackgroundcolor span.minicolors-swatch-color").css('background-color'); + $("#imgOpacity").css("background-color", previewBgColor); + $('#borderWidthCanvasElement').val(1); + $('.marginTopBtm10 div.outlinediv').css("border-width", 1); + $("#imgOpacity").css("opacity", 1); + $(".marginTopBtm10 div.outlinediv").css("opacity", 1); + //$("#borderWidthCanvasElement").change(function () { + // $(".marginTopBtm10 div.outlinediv").css("border-color", x); + //}); + } else { + var previewBgColor = $("#shapeStyleDiv").css('background-color'); + var previewBorderColor = $('#previewBorder').css('border-color'); + var previewBorderWidth = $('#previewBorder').css('border-width'); + var previewOpacity = $('#previewBorder').css('opacity'); + $('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", previewBgColor); + $("#imgOpacity").css("background-color", previewBgColor); + $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", previewBorderColor); + $(".marginTopBtm10 div.outlinediv").css("border-color", previewBorderColor); + $('.marginTopBtm10 div.outlinediv').css("border-width", previewBorderWidth); + $('#borderWidthCanvasElement').val(previewBorderWidth.split("px")); + $("#imgOpacity").css("opacity", previewOpacity); + $(".marginTopBtm10 div.outlinediv").css("opacity", previewOpacity); + } document.getElementById('modelbackground').style.display = "none"; document.getElementById('modeleditstyle').style.display = "none"; //Edit Shape Style popup should open at it's default position $("#modeleditstyle").css({ "left": "40%", "right": "0", "top": "70px" }); - - + } - //----End------------- - //--Common code of Annotation Toolbar for CI and DA------- - $rootScope.LineFn = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { - $(canvasId).addLayer({ - name: 'Line_' + LineNumber, - layer: true, - type: 'line', - draggable: true, - strokeStyle: shapestyleborderColor, - strokeWidth: shapestyleborderWidth, - rounded: true, - x1: offsetX1, y1: offsetY1, - x2: x, y2: y, - - click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 - } - }).drawLayers(); + $rootScope.DrawLineOnModuleItem = function (canvasId, LineNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + if ($rootScope.isLinePreviewCompleted == true) { + $rootScope.isLinePreviewCompleted = false; + $(canvasId).addLayer({ + name: 'Line_' + LineNumber, + layer: true, + type: 'line', + draggable: true, + strokeStyle: shapestyleborderColor, + strokeWidth: shapestyleborderWidth, + rounded: true, + x1: offsetX1, y1: offsetY1, + x2: x, y2: y, + click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - radius: 0 } + else { + //jcanvas property + layer.draggable = false; + } + }, + mouseout: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + }, + mouseover: function (layer) { - }).drawLayers(); - - }, - mouseover: function (layer) { - - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); } - }).drawLayers(); + else { + //jcanvas property + layer.draggable = false; + } + } - } + }).drawLayers(); - }).drawLayers(); + } + $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.RectangleFn = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { - $(canvasId).addLayer({ - layer: true, - name: 'Rect_' + RectNumber, - fillStyle: shapestyleFillColor, - type: 'rectangle', - draggable: true, - strokeStyle: shapestyleborderColor, - opacity: shapestyleOpacity, - strokeWidth: shapestyleborderWidth, - x: offsetX1, y: offsetY1, - width: x - offsetX1, - height: y - offsetY1, + $rootScope.DrawRectangleOnModuleItem = function (canvasId, RectNumber, shapestyleFillColor, shapestyleborderColor, shapestyleOpacity, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + if ($rootScope.isRectanglePreviewCompleted == true) { + $rootScope.isRectanglePreviewCompleted = false; + $(canvasId).addLayer({ + layer: true, + name: 'Rect_' + RectNumber, + fillStyle: shapestyleFillColor, + type: 'rectangle', + draggable: true, + strokeStyle: shapestyleborderColor, + opacity: shapestyleOpacity, + strokeWidth: shapestyleborderWidth, + fromCenter: false, + x: offsetX1, y: offsetY1, + width: (x - offsetX1), + height: (y - offsetY1), resizeFromCenter: false, - dblclick: function () { - // $rootScope.backOpacity(); + dblclick: function () { - }, + }, click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - }, + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - - }).drawLayers(); - - }, - mouseover: function (layer) { - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } - $(canvasId).setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + }, + mouseover: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); } - }).drawLayers(); - - } - }).drawLayers(); - - - + else { + //jcanvas property + layer.draggable = false; + } + } + }).drawLayers(); + } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.CircleFn = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { - - $(canvasId).addLayer({ - layer: true, - name: 'Circle_' + CircleNumber, - type: 'ellipse', - opacity: shapestyleOpacity, - draggable: true, - strokeStyle: shapestyleborderColor, - strokeWidth: shapestyleborderWidth, - fillStyle: shapestyleFillColor, - x: offsetX1, y: offsetY1, - width: (x - offsetX1) * 2, height: (y - offsetY1) * 2, - // Place a handle at each side and each corner - handlePlacement: 'both', - - - - click: function (layer) { - - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - radius: 3 + $rootScope.DrawCircleOnModuleItem = function (canvasId, CircleNumber, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, offsetX1, offsetY1, x, y) { + // console.log("up"+ offsetX1 + " " + offsetY1 + " " + (x - offsetX1) + " " + (y - offsetY1)); + if ($rootScope.isCirclePreviewCompleted == true) { + $rootScope.isCirclePreviewCompleted = false; + $(canvasId).addLayer({ + layer: true, + name: 'Circle_' + CircleNumber, + type: 'ellipse', + opacity: shapestyleOpacity, + draggable: true, + strokeStyle: shapestyleborderColor, + strokeWidth: shapestyleborderWidth, + fillStyle: shapestyleFillColor, + fromCenter: false, + x: (offsetX1), y: (offsetY1), + width: (x - offsetX1), height: (y - offsetY1), + // Place a handle at each side and each corner + resizeFromCenter: false, + handlePlacement: 'both', + click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + radius: 3 + } + }).drawLayers(); } - }).drawLayers(); - - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 + else { + //jcanvas property + layer.draggable = false; } - - }).drawLayers(); - - }, - mouseover: function (layer) { - - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 + }, + mouseout: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); } - }).drawLayers(); - - } - }).drawLayers(); + else { + layer.draggable = false; + } + }, + mouseover: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + } + }).drawLayers(); + } $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.ArrowFn = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { - - $('#canvas').drawLine({ - layer: true, - name: 'Arrow_' + ArrowNumber, - draggable: true, - strokeStyle: shapestyleborderColor, - strokeWidth: shapestyleborderWidth, - rounded: true, - startArrow: true, - arrowRadius: 7, - arrowAngle: 90, - x1: offsetX1, y1: offsetY1, - x2: x, y2: y, + $rootScope.DrawArrowOnModuleItem = function (canvasId, ArrowNumber, shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { + if ($rootScope.isArrowPreviewCompleted == true) { + $rootScope.isArrowPreviewCompleted = false; + $('#canvas').drawLine({ + layer: true, + name: 'Arrow_' + ArrowNumber, + draggable: true, + strokeStyle: shapestyleborderColor, + strokeWidth: shapestyleborderWidth, + rounded: true, + startArrow: true, + arrowRadius: 7, + arrowAngle: 90, + x1: offsetX1, y1: offsetY1, + x2: x, y2: y, - click: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 + click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + // $("#canvas").removeLayer(layer.name).drawLayers(); } - }).drawLayers(); - // $("#canvas").removeLayer(layer.name).drawLayers(); - - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 + else { + //jcanvas property + layer.draggable = false; } - }).drawLayers(); - - }, - mouseover: function (layer) { - - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 + }, + mouseout: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; } - }).drawLayers(); + }, + mouseover: function (layer) { - } + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + } - }); + }); + } + $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.PinFn = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { - - var xAxisPinDiff = offsetX1 - x; - var yAxisPinDiff = offsetY1 - y; - if (xAxisPinDiff != 0 && yAxisPinDiff != 0) - { + $rootScope.DrawPinOnModuleItem = function (canvasId, PinNumber, offsetX1, offsetY1, x, y, PinArcNumber) { + + if ($rootScope.isPinPreviewCompleted == true) { + $rootScope.isPinPreviewCompleted = false; var radial = $('#canvas').createGradient({ x1: 50, y1: 50, x2: 50, y2: 50, @@ -843,59 +982,77 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", x2: x, y2: y, click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.shapeTypePin = "Pin"; + $rootScope.canvasLayerNameCollection = []; + var pinLine_layer = layer.name; + var pinLine_layer_split = pinLine_layer.split("_"); + var pinArcName = "ArcPin_"; + var pinResult = pinArcName.concat(pinLine_layer_split[1]); + + $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult }); + + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); - $rootScope.shapeTypePin = "Pin"; - $rootScope.canvasLayerNameCollection = []; - var pinLine_layer = layer.name; - var pinLine_layer_split = pinLine_layer.split("_"); - var pinArcName = "ArcPin_"; - var pinResult = pinArcName.concat(pinLine_layer_split[1]); - - $rootScope.canvasLayerNameCollection.push({ pinName: layer.name, ArcName: pinResult }); - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - - + } + else { + //jcanvas property + layer.draggable = false; + } }, mouseout: function (layer) { - - $rootScope.canvasLayerNameCollection = []; - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 0, - // width: 0, height: 0, - radius: 0 - } - - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 0, + // width: 0, height: 0, + radius: 0 + } + + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } }, mouseover: function (layer) { - - $(canvasId).setLayer(layer.name, { - handle: { - type: 'arc', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - // width: 5, height: 5, - radius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $(canvasId).setLayer(layer.name, { + handle: { + type: 'arc', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + // width: 5, height: 5, + radius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } } }).drawArc({ draggable: true, @@ -909,13 +1066,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", fillStyle: radial, x: offsetX1, y: offsetY1, radius: 5, - //handle: { - // type: 'arc', - // fillStyle: '#fff', - // strokeStyle: '#c33', - // strokeWidth: 2, - // radius: 3 - //}, + add: function (layer) { @@ -927,17 +1078,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }).drawLayers(); } - + + $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); } - $rootScope.TextAreaFn = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { - - - debugger; - + $rootScope.TextEditorFunctionality = function (canvasId, TextNumber, offsetX1, offsetY1, resetTextRect, shapestyleOpacity, shapestyleborderColor, shapestyleborderWidth, shapestyleFillColor, x, y) { + if ($rootScope.isTextAreaPreviewCompleted == true) { + $rootScope.isTextAreaPreviewCompleted = false; $('#canvas').drawText({ layer: true, draggable: true, @@ -948,6 +1098,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", fillStyle: '#36c', strokeWidth: 0, x: $rootScope.offsetX1, y: $rootScope.offsetY1, + fromCenter: false, fontSize: '14pt', align: "left", fontFamily: 'Verdana, sans-serif', @@ -959,117 +1110,146 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }) - // Draw rect as wide as the text - .drawRect({ - layer: true, - name: "TextRect_" + $rootScope.TextNumber, - dragGroups: ['shapes'], - opacity: $rootScope.shapestyleOpacity, - strokeStyle: $rootScope.shapestyleborderColor, - strokeWidth: $rootScope.shapestyleborderWidth, - fillStyle: $rootScope.shapestyleFillColor, - x: $rootScope.offsetX1, y: $rootScope.offsetY1, - width: $rootScope.x - $rootScope.offsetX1, - height: $rootScope.y - $rootScope.offsetY1, - add: function (layer) { - - $rootScope.TextAreaRectID = layer.name; - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $rootScope.CurrentWidth = layer.width; - $rootScope.CurrentHeight = layer.height; - - }, - click: function (layer) { - - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push(layer.name); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - }, - dblclick: function (layer) { - - $rootScope.IsTextAlreadySave = false; - var RectNameArray = (layer.name).split("_"); - - var TextAreaRectangleName = "TextArea_"; - var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]); - $rootScope.TextAreaRectID = layer.name; - $rootScope.TextID = TextAreaRectNameConcat; - - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $("#annotationTextModal").css("padding-right", "0px"); - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); - - $("#text_area").val(''); - $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); - - $("#selected-font-family option:eq(0)").prop('selected', true); - $("#selected-font-size option:eq(0)").prop('selected', true); - - $("#text-italic").removeClass("ActiveFormattingButtonClass"); - - $("#text-bold").removeClass("ActiveFormattingButtonClass"); - - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - - $("#text-left").removeClass("ActiveFormattingButtonClass"); - - $("#text-right").removeClass("ActiveFormattingButtonClass"); - - $("#text-center").removeClass("ActiveFormattingButtonClass"); - - }, - mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - - }).drawLayers(); - - }, - mouseover: function (layer) { - - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - - } - }); + // Draw rect as wide as the text + .drawRect({ + layer: true, + name: "TextRect_" + $rootScope.TextNumber, + dragGroups: ['shapes'], + opacity: $rootScope.shapestyleOpacity, + strokeStyle: $rootScope.shapestyleborderColor, + fromCenter: false, + strokeWidth: $rootScope.shapestyleborderWidth, + fillStyle: $rootScope.shapestyleFillColor, + x: $rootScope.offsetX1, y: $rootScope.offsetY1, + width: ($rootScope.x - $rootScope.offsetX1), + height: ($rootScope.y - $rootScope.offsetY1), + resizeFromCenter: false, + add: function (layer) { + + $rootScope.TextAreaRectID = layer.name; + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + // $rootScope.CurrentWidth = layer.width; + // $rootScope.CurrentHeight = layer.height; + + }, + click: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push(layer.name); + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + }, + dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.IsTextAlreadySave = false; + var RectNameArray = (layer.name).split("_"); + + var TextAreaRectangleName = "TextArea_"; + var TextAreaRectNameConcat = TextAreaRectangleName.concat(RectNameArray[1]); + $rootScope.TextAreaRectID = layer.name; + $rootScope.TextID = TextAreaRectNameConcat; + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + + $("#text_area").val(''); + $("#text_area").css({ "font-family": "Arial", "font-size": "14px", "font-weight": "normal", "font-style": "normal", "color": "#000", "text-align": "left", "text-decoration": "none" }); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + + $("#selected-font-family option:eq(0)").prop('selected', true); + $("#selected-font-size option:eq(0)").prop('selected', true); + + $("#text-italic").removeClass("ActiveFormattingButtonClass"); + + $("#text-bold").removeClass("ActiveFormattingButtonClass"); + + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + + $("#text-left").removeClass("ActiveFormattingButtonClass"); + + $("#text-right").removeClass("ActiveFormattingButtonClass"); + + $("#text-center").removeClass("ActiveFormattingButtonClass"); + } + else { + //jcanvas property + layer.draggable = false; + } + }, + mouseout: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } + }, + mouseover: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + + } + else { + //jcanvas property + layer.draggable = false; + } + } + }); + + + // Annotation: Edit Text option is missing. - // alert($rootScope.CurrentWidth); - // alert($rootScope.CurrentHeight); $("#annotationTextModal").css("padding-right", "0px"); - if (($rootScope.CurrentWidth > 0 && $rootScope.CurrentHeight > 0) || ($rootScope.CurrentWidth > 0 && $rootScope.CurrentHeight <= 0) || ($rootScope.CurrentWidth <= 0 && $rootScope.CurrentHeight > 0)) { - $("#annotationTextModal").modal("toggle"); - document.getElementById('modelbackground').style.display = "block"; - } - $('.btnCursor').trigger('click'); + $("#annotationTextModal").modal("toggle"); + document.getElementById('modelbackground').style.display = "block"; + + } + $('.btnCursor').trigger('click'); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); $("#text_area").val(''); @@ -1095,9 +1275,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $(".btn-annotation").removeClass("activebtncolor"); - $('.btnCursor').addClass('activebtncolor'); - - + $('.btnCursor').addClass('activebtncolor'); } @@ -1120,15 +1298,18 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", // var y = event.clientY; $rootScope.offsetX1 = 0; $rootScope.offsetY1 = 0; + //alert($location.path()); + + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; $rootScope.offsetX1 = event.offsetX; $rootScope.offsetY1 = event.offsetY; - ctx.clearRect(0, 0, 2277, 3248); $rootScope.clicked = true; - // alert("x:"+$rootScope.offsetX1 + " y:" + $rootScope.offsetY1); + canvasElement.addEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false); } - $rootScope.rectNumber = 0; $rootScope.LineNumber = 0; $rootScope.CircleNumber = 0; @@ -1145,98 +1326,163 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", var arrayRect = {}; var storeLine = ''; - //$rootScope.canvasLayerNameCollection1 = []; + $rootScope.OnPaintCanvasMouseUp = function (event) { if (!$rootScope.clicked) { return; } + var AnnotationCanvas = document.getElementById('canvas'); + AnnotationCanvas.removeEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove, false); + + $(".line").remove(); + $(".arrow").remove(); + $(".pin").remove(); + $(".circle").remove(); + $(".rectangle").remove(); + $(".textarea").remove(); $rootScope.clicked = false; $rootScope.x = 0; $rootScope.y = 0; - - $rootScope.x = parseInt(event.clientX - ($("#canvas").offset().left)); - $rootScope.y = parseInt(event.clientY - ($("#canvas").offset().top)); - - + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + $rootScope.x = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left; + $rootScope.y = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top; var canvasElement = document.getElementById("canvas"); var ctx = canvasElement.getContext("2d"); - var canvasPaintElement = document.getElementById("canvasPaint"); var PaintCanvasctx = canvasPaintElement.getContext("2d"); - - switch ($rootScope.shapeType) { - case "cursor": - // ctx.clearRect(0, 0, 2277, 3248); ctx.beginPath(); PaintCanvasctx.beginPath(); - - break; - case "Line": - //$rootScope.canvasLayerNameCollection = []; + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.LineNumber = $rootScope.ObjectIndex++; - - $rootScope.LineFn('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) - + // $rootScope.isLinePreviewCompleted = true; + $rootScope.DrawLineOnModuleItem('#canvas', $rootScope.LineNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y) break; - case "Rectangle": + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.rectNumber = $rootScope.ObjectIndex++; - $rootScope.RectangleFn('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); - + // $rootScope.isRectanglePreviewCompleted = true; + $rootScope.DrawRectangleOnModuleItem('#canvas', $rootScope.rectNumber, $rootScope.shapestyleFillColor, $rootScope.shapestyleborderColor, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); + break; - case "Circle": - // alert($rootScope.shapestyleborderWidth); + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.CircleNumber = $rootScope.ObjectIndex++; - - $rootScope.CircleFn('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); + // $rootScope.isCirclePreviewCompleted = true; + $rootScope.DrawCircleOnModuleItem('#canvas', $rootScope.CircleNumber, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Arrow": + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.ArrowNumber = $rootScope.ObjectIndex++; - - $rootScope.ArrowFn('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); - - // $scope.resetRect += 1; + //$rootScope.isArrowPreviewCompleted = true; + $rootScope.DrawArrowOnModuleItem('#canvas', $rootScope.ArrowNumber, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y); break; case "Pin": + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.PinNumber = $rootScope.PinObjectIndex++; $rootScope.PinArcNumber = $rootScope.ArcObjectIndex++; - $rootScope.PinFn('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); + //$rootScope.isPinPreviewCompleted = true; + + $rootScope.DrawPinOnModuleItem('#canvas', $rootScope.PinNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.x, $rootScope.y, $rootScope.PinArcNumber); break; case "TextArea": - + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.IsTextAlreadySave = false; $("#text_area").val(''); // Draw text $rootScope.resetTextRect = $rootScope.ObjectIndex++; $rootScope.TextNumber = $rootScope.ObjectIndex++; - $rootScope.TextAreaFn('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); + // $rootScope.isTextAreaPreviewCompleted = true; + $rootScope.TextEditorFunctionality('#canvas', $rootScope.TextNumber, $rootScope.offsetX1, $rootScope.offsetY1, $rootScope.resetTextRect, $rootScope.shapestyleOpacity, $rootScope.shapestyleborderColor, $rootScope.shapestyleborderWidth, $rootScope.shapestyleFillColor, $rootScope.x, $rootScope.y); break; - case "DrawPolygon": - break; } //} } - - - - - + $rootScope.OnPaintCanvasMouseMove = function (event) { + var canvasDiv = document.getElementById('canvasDiv'); + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left; + $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#canvasDiv').offset().top; + switch ($rootScope.shapeType) { + case "Line": + $(".line").remove(); + $rootScope.isLinePreviewCompleted = true; + $("#canvasDiv").append("
"); + $rootScope.Annotationangle(); + break; + case "Arrow": + $(".arrow").remove(); + $rootScope.isArrowPreviewCompleted = true; + $("#canvasDiv").append("
"); + $rootScope.Annotationangle(); + break; + case "Pin": + $(".pin").remove(); + $rootScope.isPinPreviewCompleted = true; + $("#canvasDiv").append("
"); + $rootScope.Annotationangle(); + break; + case "Circle": + $(".circle").remove(); + $rootScope.isCirclePreviewCompleted = true; + $("#canvasDiv").append("
"); + break; + case "Rectangle": + $(".rectangle").remove(); + $rootScope.isRectanglePreviewCompleted = true; + $("#canvasDiv").append("
"); + break; + case "TextArea": + $(".textarea").remove(); + $rootScope.isTextAreaPreviewCompleted = true; + $("#canvasDiv").append("
"); + break; + } + } + $rootScope.Annotationangle = function (event) { + var dy = $rootScope.MouseMoveYAxis - $rootScope.offsetY1; + var dx = $rootScope.MouseMoveXAxis - $rootScope.offsetX1; + var theta = 0; + if (dx < 0) { + theta = Math.atan(dy / dx) * (180 / Math.PI); + theta = theta + 180; + } + else if (dy < 0) { + theta = Math.atan(dy / dx) * (180 / Math.PI); + theta = theta + 360; + } + else { + theta = Math.atan(dy / dx) * (180 / Math.PI); + } + var dottedLineWidth = Math.sqrt(($rootScope.offsetX1 - $rootScope.MouseMoveXAxis) * ($rootScope.offsetX1 - $rootScope.MouseMoveXAxis) + ($rootScope.offsetY1 - $rootScope.MouseMoveYAxis) * ($rootScope.offsetY1 - $rootScope.MouseMoveYAxis)); + switch ($rootScope.shapeType) { + case "Line": + $('.line').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); + break; + case "Arrow": + $('.arrow').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); + break; + case "Pin": + $('.pin').css({ 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%', 'width': dottedLineWidth + 'px' }); + break; + } + } ///----- - $rootScope.saveText = function () { - debugger; + document.getElementById('modelbackground').style.display = "none"; // this part will work first time when save button will be clicked if ($rootScope.IsTextAlreadySave == false) { @@ -1251,15 +1497,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.textArea = $("#text_area").val(); // deleting previous text area - - $("#canvas").removeLayer($rootScope.TextID).drawLayers(); $("#canvas").removeLayer($rootScope.TextAreaRectID).drawLayers(); - - - // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); - // $("#canvas").removeLayer("TextRect_" + $rootScope.TextNumber).drawLayers(); - // Text After Saving in Rectangle $rootScope.resetTextRect = $rootScope.ObjectIndex++; $('#canvas').drawText({ @@ -1271,6 +1510,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", fillStyle: $rootScope.fontColor, fontStyle: $rootScope.fontWeight + " " + $rootScope.fontStyle, fontSize: $rootScope.fontSizes, + fromCenter: false, fontFamily: $rootScope.fontFamily, align: $rootScope.textAlignmt, strokeWidth: 0, @@ -1294,228 +1534,221 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", opacity: $rootScope.shapestyleOpacity, strokeStyle: $rootScope.shapestyleborderColor, strokeWidth: $rootScope.shapestyleborderWidth, + fromCenter: false, x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, + resizeFromCenter: false, click: function (layer) { - $rootScope.shapeTypeText = "textAreaRect"; - - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextAreaNew_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + + var layerName = layer.name; + var splitedName = layerName.split("_"); + var textValName = "TextAreaNew_"; + var concatinateResult = textValName.concat(splitedName[1]); + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; } - }).drawLayers(); }, dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; - $rootScope.isTextAreaClosedButtonActive = false; - $rootScope.IsTextAlreadySave = true; - - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var TextAreaRectName = "TextAreaNew_"; - var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); - // alert(TextAreaRectNameConcatenated); - //if (_rectLayerOnSaveSplit[1]%2 == 0) - //{ - // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1] - 1; - - //} - //else - //{ - - // _rectLayerOnSaveSplit[1] = _rectLayerOnSaveSplit[1]; - //} - - $rootScope.layerNameArr = layer.name; - $rootScope.rectTextArr = TextAreaRectNameConcatenated; - - - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - // var _rectLayerOnSaveSplitInt; - - - // _rectLayerOnSaveSplitInt = parseInt(_rectLayerOnSaveSplit[1]); + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var TextAreaRectName = "TextAreaNew_"; + var TextAreaRectNameConcatenated = TextAreaRectName.concat(_rectLayerOnSaveSplit[1]); - //alert(_rectLayerOnSaveSplitInt); - // alert($rootScope.TextPropertyArray.length); + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = TextAreaRectNameConcatenated; - for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { - if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; - $("#text_area").val(textArrVal); - var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; - var fontWeightProp = fontStyleProp.split(" "); + for (var i = 0; i <= $rootScope.TextPropertyArray.length - 1; i++) { + if ($rootScope.TextPropertyArray[i].layerName == TextAreaRectNameConcatenated) { - $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); - $("#text_area").css("font-weight", fontWeightProp[0]); - $("#text_area").css("font-style", fontWeightProp[1]); - $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); - $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); - $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); - $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); + var textArrVal = $rootScope.TextPropertyArray[i].Rect_Text; + $("#text_area").val(textArrVal); + var fontStyleProp = $rootScope.TextPropertyArray[i].FontStyle; + var fontWeightProp = fontStyleProp.split(" "); - var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily; - // alert(CurrentFontFamily); - // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); - var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize); - $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); - $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + $("#text_area").css("font-size", $rootScope.TextPropertyArray[i].FontSize); + $("#text_area").css("font-weight", fontWeightProp[0]); + $("#text_area").css("font-style", fontWeightProp[1]); + $("#text_area").css("text-align", $rootScope.TextPropertyArray[i].Align); + $("#text_area").css("color", $rootScope.TextPropertyArray[i].FontColor); + $("#text_area").css("font-family", $rootScope.TextPropertyArray[i].FontFamily); + $("#text_area").css("text-decoration", $rootScope.TextPropertyArray[i].TextDecoration); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": $rootScope.TextPropertyArray[i].FontColor }); - CurrentFontFamily = ''; - CurrentFontSize = ''; + var CurrentFontFamily = $rootScope.TextPropertyArray[i].FontFamily; + // alert(CurrentFontFamily); + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); + var CurrentFontSize = parseInt($rootScope.TextPropertyArray[i].FontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); - // $(".ActiveDefaultColorAnnotation").css({ "background-color": $rootScope.TextPropertyArray[_rectLayerOnSaveSplitInt].FontColor + "!important" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + CurrentFontFamily = ''; + CurrentFontSize = ''; - //adding text text decoration active class in text edit pop-up + if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { + $("#text-underline").addClass("ActiveFormattingButtonClass"); + } + else { - if ($rootScope.TextPropertyArray[i].TextDecoration == "underline") { - - $("#text-underline").addClass("ActiveFormattingButtonClass"); - - } - - else { - - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - - } + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + } + //adding text font weight active class in text edit pop-up - //adding text font weight active class in text edit pop-up + if (fontWeightProp[0] == 700) { - if (fontWeightProp[0] == 700) { + $("#text-bold").addClass("ActiveFormattingButtonClass"); + } + else { - $("#text-bold").addClass("ActiveFormattingButtonClass"); + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - } + } - else { + //adding text font style active class in text edit pop-up - $("#text-bold").removeClass("ActiveFormattingButtonClass"); + if (fontWeightProp[1] == "italic") { - } - //adding text font style active class in text edit pop-up + $("#text-italic").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-italic").removeClass("ActiveFormattingButtonClass"); - if (fontWeightProp[1] == "italic") { + } - $("#text-italic").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-italic").removeClass("ActiveFormattingButtonClass"); + //adding text alignment active class in text edit pop-up + if ($rootScope.TextPropertyArray[i].Align == "left") { - } + $("#text-right").removeClass("ActiveFormattingButtonClass"); - //adding text alignment active class in text edit pop-up + $("#text-center").removeClass("ActiveFormattingButtonClass") - if ($rootScope.TextPropertyArray[i].Align == "left") { + $("#text-left").addClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); + } - $("#text-center").removeClass("ActiveFormattingButtonClass") + else if ($rootScope.TextPropertyArray[i].Align == "right") { - $("#text-left").addClass("ActiveFormattingButtonClass"); - } - else if ($rootScope.TextPropertyArray[i].Align == "right") { + $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").addClass("ActiveFormattingButtonClass"); + } - $("#text-center").removeClass("ActiveFormattingButtonClass") + else if ($rootScope.TextPropertyArray[i].Align == "center") { - $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").addClass("ActiveFormattingButtonClass"); + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").addClass("ActiveFormattingButtonClass"); + } } - - else if ($rootScope.TextPropertyArray[i].Align == "center") { - - $("#text-left").removeClass("ActiveFormattingButtonClass"); - - $("#text-right").removeClass("ActiveFormattingButtonClass"); - - $("#text-center").addClass("ActiveFormattingButtonClass"); - - + else { + // alert("no"); } - - } - else { - // alert("no"); - - } - - } - - // _rectLayerOnSaveSplitInt = ''; - textArrVal = ''; - $("#annotationTextModal").css("padding-right", "0px"); - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); - // $("#selected-font-family").val(CurrentFontFamily); - // $("#selected-font-size").val(CurrentFontSize); + // _rectLayerOnSaveSplitInt = ''; + textArrVal = ''; + $("#annotationTextModal").css("padding-right", "0px"); + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); + // $("#selected-font-family").val(CurrentFontFamily); + // $("#selected-font-size").val(CurrentFontSize); + } + else { + //jcanvas property + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } }, mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); - + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } } }); $("#text_area").val(''); @@ -1581,6 +1814,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", fontFamily: _modifiedFontFamily, align: _modifiedTextAlign, strokeWidth: 0, + fromCenter: false, text: _modifiedText, x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, maxWidth: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, @@ -1595,154 +1829,189 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", groups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], dragGroups: ['TextAreaAfterEdit_' + $rootScope.resetTextSave], opacity: $rootScope.shapestyleOpacity, + fromCenter: false, strokeStyle: $rootScope.shapestyleborderColor, strokeWidth: $rootScope.shapestyleborderWidth, x: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].x, y: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].y, width: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].width, height: $rootScope.rectDimension[$rootScope.rectDimension.length - 1].height, + resizeFromCenter: false, click: function (layer) { - $rootScope.shapeTypeText = "textAreaRect"; - var layerNameSplit = layer.name; - var splitedName = layerNameSplit.split("_"); - var textValName = "TextAreaAfterEdit_"; - var concatinateResult = textValName.concat(splitedName[1]); - $rootScope.canvasLayerNameCollection = []; - $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); - - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.shapeTypeText = "textAreaRect"; + var layerName = layer.name; + var splitedName = layerName.split("_"); + var textValName = "TextAreaAfterEdit_"; + var concatinateResult = textValName.concat(splitedName[1]); + $rootScope.canvasLayerNameCollection = []; + $rootScope.canvasLayerNameCollection.push({ textareaRectangle: layer.name, textareaString: concatinateResult }); + + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } }, dblclick: function (layer) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.isTextAreaClosedButtonActive = false; + $rootScope.IsTextAlreadySave = true; + var _rectLayerOnSave = layer.name; + var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); + var RectNameAfterEdit = "TextAreaAfterEdit_"; + var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); + $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; + + $rootScope.layerNameArr = layer.name; + $rootScope.rectTextArr = RectNameAfterEditResult; + + $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); + $("#text_area").val(_modifiedText); + $("#text_area").css("font-size", _modifiedFontSize); + $("#text_area").css("font-weight", _modifiedFontWeight); + $("#text_area").css("font-style", _modifiedFontStyle); + $("#text_area").css("text-align", _modifiedTextAlign); + $("#text_area").css("color", _modifiedFontColor); + $("#text_area").css("font-family", _modifiedFontFamily); + $("#text_area").css("text-decoration", _modifiedFontDecoration); + $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); + + // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); + // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); + + //khushbu + var CurrentFontFamily = _modifiedFontFamily; + // alert(CurrentFontFamily); + // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); + var CurrentFontSize = parseInt(_modifiedFontSize); + $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); + $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); + CurrentFontFamily = ''; + CurrentFontSize = ''; + //adding text text decoration active class in text edit pop-up + if (_modifiedFontDecoration == "underline") { + $("#text-underline").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-underline").removeClass("ActiveFormattingButtonClass"); + } - $rootScope.isTextAreaClosedButtonActive = false; - $rootScope.IsTextAlreadySave = true; - var _rectLayerOnSave = layer.name; - var _rectLayerOnSaveSplit = _rectLayerOnSave.split("_"); - var RectNameAfterEdit = "TextAreaAfterEdit_"; - var RectNameAfterEditResult = RectNameAfterEdit.concat(_rectLayerOnSaveSplit[1]); - $rootScope.modifySavedTextIndexNumber = _rectLayerOnSaveSplit[1]; - - $rootScope.layerNameArr = layer.name; - $rootScope.rectTextArr = RectNameAfterEditResult; - - $rootScope.rectDimension.push({ width: layer.width, height: layer.height, x: layer.x, y: layer.y }); - $("#text_area").val(_modifiedText); - $("#text_area").css("font-size", _modifiedFontSize); - $("#text_area").css("font-weight", _modifiedFontWeight); - $("#text_area").css("font-style", _modifiedFontStyle); - $("#text_area").css("text-align", _modifiedTextAlign); - $("#text_area").css("color", _modifiedFontColor); - $("#text_area").css("font-family", _modifiedFontFamily); - $("#text_area").css("text-decoration", _modifiedFontDecoration); - $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": _modifiedFontColor }); - - // $(".ActiveDefaultColorAnnotation").css({ "background-color": _modifiedFontColor + "!important" }); - // $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").addClass("ActiveDefaultColorAnnotation"); - - //khushbu - var CurrentFontFamily = _modifiedFontFamily; - // alert(CurrentFontFamily); - // CurrentFontFamily = CurrentFontFamily.replace(/'/g, ""); - var CurrentFontSize = parseInt(_modifiedFontSize); - $("#selected-font-family option[value=" + CurrentFontFamily + "]").prop('selected', true); - $("#selected-font-size option[value=" + CurrentFontSize + "]").prop('selected', true); - CurrentFontFamily = ''; - CurrentFontSize = ''; - //adding text text decoration active class in text edit pop-up - if (_modifiedFontDecoration == "underline") { - $("#text-underline").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-underline").removeClass("ActiveFormattingButtonClass"); - } + //adding text font weight active class in text edit pop-up + if (_modifiedFontWeight == 700) { - //adding text font weight active class in text edit pop-up - if (_modifiedFontWeight == 700) { + $("#text-bold").addClass("ActiveFormattingButtonClass"); + } + else { - $("#text-bold").addClass("ActiveFormattingButtonClass"); - } - else { + $("#text-bold").removeClass("ActiveFormattingButtonClass"); - $("#text-bold").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text font style active class in text edit pop-up + if (_modifiedFontStyle == "italic") { - //adding text font style active class in text edit pop-up - if (_modifiedFontStyle == "italic") { + $("#text-italic").addClass("ActiveFormattingButtonClass"); + } + else { + $("#text-italic").removeClass("ActiveFormattingButtonClass"); - $("#text-italic").addClass("ActiveFormattingButtonClass"); - } - else { - $("#text-italic").removeClass("ActiveFormattingButtonClass"); + } - } + //adding text alignment active class in text edit pop-up + if (_modifiedTextAlign == "left") { + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").addClass("ActiveFormattingButtonClass"); + } + else if (_modifiedTextAlign == "right") { - //adding text alignment active class in text edit pop-up - if (_modifiedTextAlign == "left") { - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").addClass("ActiveFormattingButtonClass"); - } - else if (_modifiedTextAlign == "right") { + $("#text-center").removeClass("ActiveFormattingButtonClass") + $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").addClass("ActiveFormattingButtonClass"); - $("#text-center").removeClass("ActiveFormattingButtonClass") - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").addClass("ActiveFormattingButtonClass"); + } + else if (_modifiedTextAlign == "center") { + $("#text-left").removeClass("ActiveFormattingButtonClass"); + $("#text-right").removeClass("ActiveFormattingButtonClass"); + $("#text-center").addClass("ActiveFormattingButtonClass"); - } - else if (_modifiedTextAlign == "center") { - $("#text-left").removeClass("ActiveFormattingButtonClass"); - $("#text-right").removeClass("ActiveFormattingButtonClass"); - $("#text-center").addClass("ActiveFormattingButtonClass"); + } + document.getElementById('modelbackground').style.display = "block"; + $("#annotationTextModal").modal("toggle"); } - - document.getElementById('modelbackground').style.display = "block"; - $("#annotationTextModal").modal("toggle"); + else { + //jcanvas property + layer.draggable = false; + } }, mouseout: function (layer) { - $rootScope.canvasLayerNameCollection = []; - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: 'pink', - strokeStyle: 'yellow', - strokeWidth: 0, - width: 0, height: 0, - cornerRadius: 0 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $rootScope.canvasLayerNameCollection = []; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: 'pink', + strokeStyle: 'yellow', + strokeWidth: 0, + width: 0, height: 0, + cornerRadius: 0 + } + }).drawLayers(); + } + else { + //jcanvas property + layer.draggable = false; + } }, mouseover: function (layer) { - $('#canvas').setLayer(layer.name, { - handle: { - type: 'rectangle', - fillStyle: '#fff', - strokeStyle: '#c33', - strokeWidth: 2, - width: 5, height: 5, - cornerRadius: 3 - } - }).drawLayers(); + if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + //jcanvas property + layer.draggable = true; + $('#canvas').setLayer(layer.name, { + handle: { + type: 'rectangle', + fillStyle: '#fff', + strokeStyle: '#c33', + strokeWidth: 2, + width: 5, height: 5, + cornerRadius: 3 + } + }).drawLayers(); + } + + else { + //jcanvas property + layer.draggable = false; + } } + }); } } //---- - $rootScope.BindCanvasDrawingListners = function (event) { + $rootScope.onDrawingCanvasClick = function (event) { $rootScope.clicked = true; // OnPaintCanvasMouseDown(event); @@ -1753,6 +2022,16 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp, false); } // alert("doclick"); + // annotation history + if (event != undefined) { + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + + $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(event); + + } + } + + }; @@ -1770,9 +2049,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } else if ($rootScope.shapeTypeText == "textAreaRect") { - - - $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaRectangle).drawLayers(); $("#canvas").removeLayer($rootScope.canvasLayerNameCollection[0].textareaString).drawLayers(); $rootScope.shapeTypeText = ""; @@ -1780,7 +2056,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } else { - // alert($rootScope.canvasLayerNameCollection); $("#canvas").removeLayer($rootScope.canvasLayerNameCollection).drawLayers(); } @@ -1794,12 +2069,6 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", document.getElementById('modelbackground').style.display = "none"; - //if ($rootScope.isTextAreaClosedButtonActive == true) { - // $("#canvas").removeLayer('TextArea_' + $rootScope.TextNumber).drawLayers(); - // $("#canvas").removeLayer("TextRect_" + $rootScope.resetTextRect).drawLayers(); - - //} - } //-- End ---------------------------- @@ -1836,17 +2105,9 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.PaintCanvasMousedownListener = function (canvasContext, x, y) { if ($rootScope.isLineDrawSelecyed == true) { - canvasContext.lineWidth = 0.1; - //$scope.paintCanvasContext.lineJoin = 'round'; - //$scope.paintCanvasContext.lineCap = 'round'; + canvasContext.lineWidth = 0.1; canvasContext.strokeStyle = 'red'; - - canvasContext.beginPath(); - - //var canvasOffset = $("#myCanvas").offset(); - //var offsetX = canvasOffset.left; - //var offsetY = canvasOffset.top; canvasContext.moveTo(x, y); } @@ -1891,41 +2152,50 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $rootScope.disableAnnotationtoolOnListManager = false; $rootScope.ShowListManager = function () { + $rootScope.switchCanvas(); + $("#annotationpaintbrushsize").attr("href", "#"); console.log('ShowListManager') $rootScope.disableAnnotationtoolOnListManager = true; - $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').attr('disabled', 'disabled'); + $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); $('#slider-range-min-2').slider('disable'); + $("#annotationpaintbrushsize").attr('disabled', 'disabled'); $rootScope.isLoading = true; $('#spinner').css('visibility', 'visible'); $('#listManager').css('display', 'block'); $("#listManager").css("visibility", "visible"); - - // $('#termList option[selected="selected"]').prop("selected", false); - // $("#termList").find("option[value=" + $rootScope.searchSelectedText + "]").prop("selected", true); - // $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); - // $("#termList").find("option[value=" + $rootScope.searchSelectedText + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); + + // $('#termList option[selected="selected"]').prop("selected", false); + // $("#termList").find("option[value=" + $rootScope.searchSelectedText + "]").prop("selected", true); + // $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); + // $("#termList").find("option[value=" + $rootScope.searchSelectedText + "]").css({ "background-color": "#3399FF", "color": "#ffffff" }); $('#listManager').draggable(); $rootScope.islistManagerEventAlredayDispachted = true; $rootScope.$broadcast('listManagerEvent', true); - + $('#termList option[selected="selected"]').prop("selected", false); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').prop("selected", true); $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); $('#termList option[value="' + $rootScope.searchSelectedText + '"]').css({ "background-color": "#3399FF", "color": "#ffffff" }); + + } $rootScope.CloseListManager = function () { - console.log('close') + + + console.log('close'); $rootScope.disableAnnotationtoolOnListManager = false; if ($rootScope.MenuModuleName == "DA") { - + $("#annotationpaintbrushsize").attr("href", "#canvasPaint"); if ($rootScope.disableAnnotationtoolOnListManager == false) { - $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); + $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); + $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); + $rootScope.switchCanvasToPaintCanvas(); } } $('#listManager').css('display', 'none'); @@ -1948,7 +2218,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } } - + $rootScope.prevId = ""; } function fillListManagerTerms() { @@ -2068,39 +2338,137 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", }; $rootScope.UpdateSetting = function (setting) { - + var isReloadingViewRequired = false; //1. if (typeof (setting.ethnicity) !== "undefined" && setting.ethnicity !== null) { $rootScope.ChangeEthnicity(setting, setting.ethnicity); + } + if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) { + $rootScope.ChangeModesty(setting, setting.modesty); + } + + //2. + if((setting.ethnicity!=null && setting.ethnicity!= $rootScope.globalSetting.ethnicity) && (setting.modesty!=null && setting.modesty != $rootScope.globalSetting.modesty) ){ $rootScope.globalSetting.ethnicity = setting.ethnicity; localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); - $rootScope.setEthncitySettings($rootScope.globalSetting.ethnicity); + + $rootScope.globalSetting.modesty = setting.modesty; + localStorage.setItem("globalModesty", setting.modesty); + + isReloadingViewRequired = true; + } - if (typeof (setting.modesty) !== "undefined" && setting.modesty !== null) { - $rootScope.ChangeModesty(setting, setting.modesty); + + else if (setting.ethnicity!=null && setting.ethnicity != $rootScope.globalSetting.ethnicity) { + + $rootScope.globalSetting.ethnicity = setting.ethnicity; + localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); + + $rootScope.globalSetting.modesty = localStorage.getItem("globalModesty"); + + isReloadingViewRequired = true; + } + else if (setting.modesty!= null && setting.modesty != $rootScope.globalSetting.modesty) { $rootScope.globalSetting.modesty = setting.modesty; localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); - $rootScope.setModestySettings($rootScope.globalSetting.modesty); + + $rootScope.globalSetting.ethnicity = localStorage.getItem("globalEthnicity"); + + if ($('.modestyImg') != null) { + if (($rootScope.globalSetting.modesty == 'Y')) { + $('.modestyImg').css('visibility', 'visible'); + } + + else { + $('.modestyImg').css('visibility', 'hidden'); + } + } + $rootScope.changeNavigatorModesty(); } + + var len = $rootScope.openModules.length; + if (len > 0) { + if (isReloadingViewRequired == true) { + $rootScope.reloadChildController(); + } + } + else { + $('#modal-settings').modal('hide'); + } - //2. - //localStorage.setItem("globalEthnicity", $rootScope.globalSetting.ethnicity); + }; - //3. - //localStorage.setItem("globalModesty", $rootScope.globalSetting.modesty); - //4. - //$rootScope.reloadChildController(); - var len = $rootScope.openModules.length; - if (len > 0) { - $rootScope.reloadChildController(); + $rootScope.FreeStylePaint = function (e) { + + var annotationCanvas = document.getElementById("canvas"); + annotationCanvas.addEventListener('mousedown', $rootScope.OnPaintBrushCanvasMouseDown, false); + annotationCanvas.addEventListener('mouseup', $rootScope.OnPaintBrushCanvasMouseUp, false); + // document.getElementById("canvasPaint").addEventListener("mouseup", OnPaintBrushCanvasMouseUp); + //alert($rootScope.isAnnotaionToolBarDrawingModeActive); + //if ($rootScope.isAnnotaionToolBarDrawingModeActive == true) { + + // alert($rootScope.isAnnotaionToolBarDrawingModeActive); + // $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(e); + + //} + //else { + + + + //} } - else { - $('#modal-settings').modal('hide'); + + + + + + + + $rootScope.OnPaintBrushCanvasMouseDown = function (event) { + $rootScope.isMousedownOnPaintCanvas = true; + $rootScope.isStartPointDeleted = false; + var annotationCanvas = document.getElementById("canvas"); + $rootScope.startPageX = parseInt(event.clientX - ($("#canvas").offset().left)); + $rootScope.startPageY = parseInt(event.clientY - ($("#canvas").offset().top)); + + annotationCanvas.addEventListener('mousemove', $rootScope.OnPaintBrushCanvasMouseMove, false); + + } + $rootScope.OnPaintBrushCanvasMouseMove = function (event) { + + $rootScope.xPage = parseInt(event.clientX - ($("#canvas").offset().left)); + $rootScope.yPage = parseInt(event.clientY - ($("#canvas").offset().top)); + + var btneraseBrushSizeValue = $("#btnBrushSize").val(); + $rootScope.eraseshapeSize = parseInt(btneraseBrushSizeValue); + + if ($rootScope.isEraseToolSelected == true && $rootScope.isMousedownOnPaintCanvas == true) { + + var sktch = $('#canvasPaint').sketch(); + $('#canvasPaint').sketch().actions = []; + var paintCanvas = document.getElementById("canvasPaint"); + var paintCanvasContext = paintCanvas.getContext('2d'); + if ($rootScope.isStartPointDeleted == false) { + + paintCanvasContext.clearRect($rootScope.startPageX, $rootScope.startPageY, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); + + $rootScope.isStartPointDeleted = true; + } + + paintCanvasContext.clearRect($rootScope.xPage, $rootScope.yPage, $rootScope.eraseshapeSize, $rootScope.eraseshapeSize); + + } + } + $rootScope.OnPaintBrushCanvasMouseUp = function (event) { + $rootScope.isMousedownOnPaintCanvas = false; + $rootScope.isEraseToolSelected = false; + $(".btn-annotation-erase").removeClass("activebtncolor"); + + } - }; $rootScope.reloadChildController = function () { @@ -2114,8 +2482,8 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //Check that what current bodyview is open if ($rootScope.openViews.length > 0) { var openViewLen = $rootScope.openViews.length; - var currentOpenViewId = $rootScope.openViews[openViewLen - 1].BodyViewId; - //$rootScope.isSettingEventAlredayDispachted = true; + var currentOpenViewId = localStorage.getItem("currentBodyViewId");//$rootScope.openViews[openViewLen - 1].BodyViewId; + $rootScope.isSettingEventAlredayDispachted = true; $rootScope.$broadcast('reloadDABodyViewEvent', { reloadDABodyViewId: currentOpenViewId }, true); } else { @@ -2125,6 +2493,14 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", } }; + $rootScope.ShowExportImageWindow = function () { + $(".export-image").css("display", "block"); + }; + $rootScope.CloseExportImageWindow = function () { + console.log('close') + $(".export-image").css("display", "none"); + }; + }] ); \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html index feb1045..e408134 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/ca/ca-view.html @@ -59,43 +59,43 @@
- +
- - - - - + + + + + - - - - - - - - diff --git a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html index 251bc5a..ee348ac 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html +++ b/400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html @@ -238,7 +238,7 @@
- +
@@ -313,7 +313,7 @@ - + diff --git a/400-SOURCECODE/AIAHTML5.Web/content/data/json/settings/fontstyle.json b/400-SOURCECODE/AIAHTML5.Web/content/data/json/settings/fontstyle.json index 3d22eaa..ff5d0a7 100644 --- a/400-SOURCECODE/AIAHTML5.Web/content/data/json/settings/fontstyle.json +++ b/400-SOURCECODE/AIAHTML5.Web/content/data/json/settings/fontstyle.json @@ -160,8 +160,6 @@ },{ "FontName": "Vivaldi" },{ -"FontName": "Webdings" -},{ "FontName": "Wide Latin" },{ "FontName": "Wingdings" diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index f8bf3c4..06fba51 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -1,7 +1,7 @@  - + @@ -19,7 +19,6 @@ - @@ -483,7 +480,7 @@ -
TitleRegionSystemSpecialty
TitleRegionSystemSpecialty
+ {{item._Title}} + {{item._BodyRegion}} + {{item._BodySystem}} + {{item._MedicalSpecialty}}
+ {{item._Title}} + {{item._BodyRegion}} + {{item._BodySystem}} + {{item._MedicalSpecialty}}