diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index 319e201..3512881 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -600,13 +600,14 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location //click event not work on object-tag document //so then add mouseenter - $("#ThreeDImagePanel_" + windowviewid).unbind('mouseenter');// remove prev event + //remove pre event + $("#ThreeDImagePanel_" + windowviewid).off("mouseenter mouseout touchstart touchcancel"); - $("#ThreeDImagePanel_" + windowviewid).on('mouseenter', function (event) { + $("#ThreeDImagePanel_" + windowviewid).on('mouseenter mouseout touchstart touchcancel', function (event) { + //after drawing annotation click not work on iPad/Android device var pnlName = event.currentTarget.id; - $rootScope.resetMenuOptionOnClick(pnlName); - - }); + $rootScope.resetMenuOptionOnClick(pnlName); + }); } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js index 9d871d0..bcdafe6 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AIController.js @@ -1119,8 +1119,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } } else { - $scope.jsPanelWidth = $(window).outerWidth() - 30; - $scope.jsPanelHeight = $(window).outerHeight() - 150; + $scope.jsPanelWidth = $(window).innerWidth() - 30; + $scope.jsPanelHeight = $(window).innerHeight() - 150; $scope.jsPanelLeft = 15; $scope.jsPanelTop = 70; } @@ -1132,10 +1132,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout theme: 'success', currentController: 'AIController', parentSlug: $scope.GetAIwindowStoreData(windowviewid, 'parentSlugName'), - content: '
'+ + content: '
'+ '
'+ '
'+ - '
' + + '
' + '' + '
'+ '
', @@ -1224,9 +1224,9 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('.jsPanel-content .jsPanel-theme-success').css('overflow-y', 'auto !important') var canvasDIvHeight = $('#aiImagePanel_' + windowviewid+ " .jsPanel-content").height(); // console.log($rootScope.OpenAdamImages); - $('#AIView').css("height", $(window).outerHeight() - 65); + $('#AIView').css("height", $(window).innerHeight()-100); - $('#AIView').css("width", $(window).outerWidth() - 15); + $('#AIView').css("width",$(window).innerWidth()-100); $('#canvasDivAI_' + windowviewid).css('height', canvasDIvHeight); @@ -1234,10 +1234,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var canvas = document.getElementById("canvasAI_" + windowviewid); var canvasPaint = document.getElementById("canvasPaintAI_" + windowviewid); - canvas.height = canvasDIvHeight-20; - canvasPaint.height = canvasDIvHeight-20; - canvas.width = screen.width-70; - canvasPaint.width = screen.width-70; + canvas.height = canvasDIvHeight; + canvasPaint.height = canvasDIvHeight + canvas.width = screen.width; + canvasPaint.width = screen.width; } @@ -1321,25 +1321,26 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } } - $scope.JsPanelclick = function (windowviewid) { - + $scope.JsPanelclick = function (windowviewid) { //reset option list manager and annotation //call when module loaded $rootScope.resetMenuOption(); - // call from while open module in CB - $("#aiImagePanel_" + windowviewid).on('click', function (event) { + //remove pre event + $("#aiImagePanel_" + windowviewid).off("click touchstart"); + $("#aiImagePanel_" + windowviewid).on('click touchstart', function (event) { + //after drawing annotation click not work on iPad/Android device var pnlName = event.currentTarget.id; $rootScope.resetMenuOptionOnClick(pnlName); - // store image for export while click on panel - var currentViewTitle = $scope.GetAIwindowStoreData(windowviewid, 'currentViewTitle'); var imageName = $scope.GetAIwindowStoreData(windowviewid, 'imageName'); $rootScope.StoreTitleName(currentViewTitle); $rootScope.StoreOrgImageName(imageName); + }); + } }] diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js index 3133993..bea46cf 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CAController.js @@ -952,7 +952,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout ' kind="captions" srclang="en" label="On">' + ' ' + - ' Here we are

' + clickedCASummary + '

', + ' Here we are

' + clickedCASummary + '

', title: tittle, position: { @@ -971,7 +971,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.UnsaveCurriculum = true; } $scope.SetCAwindowStoreData(windowviewid, 'minimised',true); - $scope.SetCAwindowStoreData(windowviewid, 'maximised',false); + $scope.SetCAwindowStoreData(windowviewid, 'maximised',false); }, onmaximized:function (panel) { var isAutoCalled = $scope.GetCAwindowStoreData(windowviewid, 'minmaxAutoEvent'); @@ -981,6 +981,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $scope.SetCAwindowStoreData(windowviewid, 'maximised',true); $scope.SetCAwindowStoreData(windowviewid, 'minimised',false); + var canvasDIvHeight = $('#caImagePanel_' + windowviewid+ " .jsPanel-content").height(); + $('#playerinlineVideo_'+ windowviewid ).css("height",canvasDIvHeight-120 ); }, onnormalized:function (panel) { var isAutoCalled = $scope.GetCAwindowStoreData(windowviewid, 'minmaxAutoEvent'); @@ -990,6 +992,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $scope.SetCAwindowStoreData(windowviewid, 'minimised',false); $scope.SetCAwindowStoreData(windowviewid, 'maximised',false); + var canvasDIvHeight = $('#caImagePanel_' + windowviewid+ " .jsPanel-content").height(); + $('#playerinlineVideo_'+ windowviewid ).css("height",canvasDIvHeight-120 ); }, resizable: { stop: function (event, ui) { @@ -1059,12 +1063,17 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { $('.jsPanel-content').css("width", "100%"); } } + + if(screen.height<=640) + { + $('#btnTxtOnOff_' + windowviewid).css("top", "-15px"); + } + } if (!$rootScope.isCallFromOtherModule) { $('#CAView').css("height", $(window).outerHeight() - 20); - $('#CAView').css("width", $(window).outerWidth() - 30); } @@ -1081,17 +1090,17 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $rootScope.CAWindowLoadComplete = true; } $scope.JsPanelclick(windowviewid); - - var isTextVisible = $scope.GetCAwindowStoreData(windowviewid, 'isTextVisible'); - + var isTextVisible = $scope.GetCAwindowStoreData(windowviewid, 'isTextVisible'); if(isTextVisible) { - $("#btnTxtOnOff_" + windowviewid).text("Text Off"); $("#sid_" + windowviewid).css("visibility", "visible"); + $("#btnTxtOnOff_" + windowviewid).text("Text Off"); + $("#sid_" + windowviewid).css("visibility", "visible"); } else { - $("#btnTxtOnOff_" + windowviewid).text("Text On"); $("#sid_" + windowviewid).css("visibility", "hidden"); + $("#btnTxtOnOff_" + windowviewid).text("Text On"); + $("#sid_" + windowviewid).css("visibility", "hidden"); } @@ -1103,10 +1112,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //call when module loaded $rootScope.resetMenuOption(); // call from while open module in CB - $("#caImagePanel_" + windowviewid).on('click', function (event) { - var pnlName = event.currentTarget.id; - $rootScope.resetMenuOptionOnClick(pnlName); - + //remove pre event + $("#caImagePanel_" + windowviewid).off("click touchstart"); + + $("#caImagePanel_" + windowviewid).on('click touchstart', function (event) { + //after drawing annotation click not work on iPad/Android device + var pnlName = event.currentTarget.id; + $rootScope.resetMenuOptionOnClick(pnlName); }); } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js index 1261b08..baca382 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CIController.js @@ -904,14 +904,14 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout theme: 'success', currentController: 'CIController', parentSlug: $scope.GetCIwindowStoreData(windowviewid, 'parentSlugName'), - content:'
'+ + content:'
'+ '
'+ '
'+ - '
' + + '
' + //'
' + '' + - '
' + - '

' + selectedImageCISummary + '

' + + '
' + + '

' + selectedImageCISummary + '

' + '
' + '
'+ '
', @@ -942,6 +942,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $scope.SetCIwindowStoreData(windowviewid, 'maximised',true); $scope.SetCIwindowStoreData(windowviewid, 'minimised',false); + var canvasDIvHeight = $('#ciImagePanel_' + windowviewid+ " .jsPanel-content").height(); + $('#canvasDivCI_' + windowviewid).css('height', canvasDIvHeight); }, onnormalized:function (panel) { var isAutoCalled = $scope.GetCIwindowStoreData(windowviewid, 'minmaxAutoEvent'); @@ -951,6 +953,8 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout } $scope.SetCIwindowStoreData(windowviewid, 'minimised',false); $scope.SetCIwindowStoreData(windowviewid, 'maximised',false); + var canvasDIvHeight = $('#ciImagePanel_' + windowviewid+ " .jsPanel-content").height(); + $('#canvasDivCI_' + windowviewid).css('height', canvasDIvHeight); }, resizable: { stop: function (event, ui) { @@ -1019,11 +1023,15 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var canvas = document.getElementById("canvasCI_" + windowviewid); var canvasPaint = document.getElementById("canvasPaintCI_" + windowviewid); - canvas.height = canvasDIvHeight-200; - canvasPaint.height = canvasDIvHeight-200; - canvas.width = screen.width-70; - canvasPaint.width = screen.width-70; - + canvas.height = canvasDIvHeight; + canvasPaint.height = canvasDIvHeight; + canvas.width = screen.width-20; + canvasPaint.width = screen.width-20; + if(screen.height<400) + { + $('#summary_' + windowviewid).css("bottom", "-220px"); + } + } var openedImage = document.getElementById('ciimage_' + windowviewid ); @@ -1032,10 +1040,7 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (!$rootScope.isCallFromOtherModule) { $("#ciimage_"+windowviewid).css("left", (screen.width-this.width-70)/2 + "px"); } - $("#ciimage_"+windowviewid).css("visibility","visible"); - // $("#ciimage_"+windowviewid).css("width", this.width + "px"); - // $("#ciimage_"+windowviewid).css("height", this.height + "px"); - + $("#ciimage_"+windowviewid).css("visibility","visible"); var canvasZIndex = $("#canvasCI_" + windowviewid).css("z-index"); var canvasPaintZIndex = $("#canvasPaintCI_" + windowviewid).css("z-index"); @@ -1142,20 +1147,21 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout //reset option list manager and annotation //call when module loaded $rootScope.resetMenuOption(); + //remove pre event + $("#ciImagePanel_" + windowviewid).off("click touchstart"); + + $("#ciImagePanel_" + windowviewid).on('click touchstart', function (event) { + //after drawing annotation click not work on iPad/Android device + var pnlName = event.currentTarget.id; + $rootScope.resetMenuOptionOnClick(pnlName); + // store image for export while click on panel + var currentViewTitle = $scope.GetCIwindowStoreData(windowviewid, 'currentViewTitle'); + var imageName = $scope.GetCIwindowStoreData(windowviewid, 'imageName'); + $rootScope.StoreTitleName(currentViewTitle); + $rootScope.StoreOrgImageName(imageName); + + }); - // call from while open module in CB - $("#ciImagePanel_" + windowviewid).on('click', function (event) { - - var pnlName = event.currentTarget.id; - $rootScope.resetMenuOptionOnClick(pnlName); - - // store image for export while click on panel - - var currentViewTitle = $scope.GetCIwindowStoreData(windowviewid, 'currentViewTitle'); - var imageName = $scope.GetCIwindowStoreData(windowviewid, 'imageName'); - $rootScope.StoreTitleName(currentViewTitle); - $rootScope.StoreOrgImageName(imageName); - }); } $scope.GetTextVisiblity = function (windowviewid, btnTextValue) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js index 1f9677e..63fd138 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js @@ -29,10 +29,17 @@ function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location, $ } angular.element(document).ready(function (e) { - - $("#treecontent").css('height',screen.height-250); - $("#cbdivarea").css('height',screen.height-170); - + + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + $("#treecontent").css('height',screen.height-140); + $("#cbdivarea").css('height',screen.height-60); + } + else + { + $("#treecontent").css('height',screen.height-250); + $("#cbdivarea").css('height',screen.height-170); + } $('#sidebar-wrapper').unbind('click'); $("#sidebar-wrapper").on('click', function (event) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 345b9f7..f1f1774 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1135,6 +1135,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.daViewLoader = function (windowviewid) { + $scope.CanvasDivScroll(windowviewid); $scope.PanelActivity(windowviewid); $scope.JsPanelclick(windowviewid); @@ -1229,18 +1230,49 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //reset option list manager and annotation //call when module loaded $rootScope.resetMenuOption(); - $("#daImagePanel_" + windowviewid).on('click', function (event) { + //remove pre event + $("#daImagePanel_" + windowviewid).off("click touchstart"); + + $("#daImagePanel_" + windowviewid).on('click touchstart', function (event) { + + //after drawing annotation click not work on iPad/Android device var pnlName=event.currentTarget.id; $rootScope.resetMenuOptionOnClick(pnlName); - + // store image for export while click on panel var currentViewTitle = $scope.GetwindowStoreData(windowviewid, 'currentViewTitle'); $rootScope.StoreTitleName(currentViewTitle); $scope.LoadImageToExport(windowviewid); + + }); + + } + + $scope.CanvasDivScroll = function (windowviewid) { + // #7972 Mozilla Firefox> Incorrect navigation + $("#canvasDivDA_"+windowviewid).scroll(function (event) { + var len= (event.currentTarget.id).split("_").length; + var windowviewid = (event.currentTarget.id).split("_")[len-1]; + + var candivScrollleft=$('#canvasDivDA_' + windowviewid).scrollLeft(); + var candivScrollTop=$('#canvasDivDA_' + windowviewid).scrollTop(); + + // Fix Navigator position by CanvasDiv Scrolling + var can = $("#canvasDivDA_" + windowviewid); + var canheight = can[0].scrollHeight; + var canwidth = can[0].scrollWidth; + + var dragDivTop= (candivScrollTop/canheight)*($('#navigatorDiv_' + windowviewid).height()); + var dragDivLeft= (candivScrollleft/canwidth)*($('#navigatorDiv_' + windowviewid).width()); + + $("#draggable_" + windowviewid).css('top', dragDivTop); + $("#draggable_" + windowviewid).css('left', dragDivLeft>40?40:dragDivLeft); + $scope.SetwindowStoreData(windowviewid,'CanvasDivLeftPosition',candivScrollleft); + $scope.SetwindowStoreData(windowviewid,'CanvasDivTopPosition',candivScrollTop); }); } @@ -1340,17 +1372,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); } } , - change: function (event, ui) { - var targetid = event.target.id; - var len= (targetid).split("_").length; - var windviewid = (targetid).split("_")[len-1]; - var scope = angular.element(document.getElementById("daViewDA_" + windviewid)).scope(); - scope.$apply(function () { - scope.onTransparencyChange(event, ui); - }); - } - // , - // stop: function (event, ui) { + // change: function (event, ui) { // var targetid = event.target.id; // var len= (targetid).split("_").length; // var windviewid = (targetid).split("_")[len-1]; @@ -1359,6 +1381,16 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // scope.onTransparencyChange(event, ui); // }); // } + // , + stop: function (event, ui) { + var targetid = event.target.id; + var len= (targetid).split("_").length; + var windviewid = (targetid).split("_")[len-1]; + var scope = angular.element(document.getElementById("daViewDA_" + windviewid)).scope(); + scope.$apply(function () { + scope.onTransparencyChange(event, ui); + }); + } }) .slider("pips", { rest: "label", @@ -2006,6 +2038,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l { "transparentTermNumber": $scope.daOpenInOtherModules.callOuts[i].transparentTermNumber, "termNumber": $scope.daOpenInOtherModules.callOuts[i].termNumber, + "istpboxTerm":$scope.daOpenInOtherModules.callOuts[i].istpboxTerm==undefined?0:$scope.daOpenInOtherModules.callOuts[i].istpboxTerm, "tips_x": $scope.daOpenInOtherModules.callOuts[i].tips_x, "tips_y": $scope.daOpenInOtherModules.callOuts[i].tips_y, "x": $scope.daOpenInOtherModules.callOuts[i].x, @@ -2152,12 +2185,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //history code - if ($("#canvasDivDA_" + windowviewid).find("canvas[id='canvasPaint']").length == 0) { + if ($("#canvasDivDA_" + windowviewid).find("canvas[id='canvasPaintDA']").length == 0) { var canvasPaintID = "canvasPaintDA_" + windowviewid; var canvasID = "canvasDA_" + windowviewid; - var ATBarHtml = $("#canvasDivDA_" + windowviewid).append(''); - $compile(ATBarHtml)($scope); - + + var ATBarHtml = $("#canvasDivDA_" + windowviewid).append(''); + $compile(ATBarHtml)($scope); + } var isCBAnnotationActive= $scope.GetwindowStoreData(windowviewid, 'isCBAnnotationActive'); @@ -2418,6 +2452,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } + function scaleRectangle(x, y, height, width, mirrorValue,windowviewid) { var nzoom = $scope.GetwindowStoreData(windowviewid,'zoomInOut'); var existingZoon = 100; @@ -2647,298 +2682,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } FlipedImgCanvas.addEventListener('click', function (evt) { - $rootScope.UnsaveCurriculum = true; - var preTermData = []; - var len= (evt.currentTarget.id).split("_").length; - var windowviewid = (evt.currentTarget.id).split("_")[len-1]; - var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); - $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; - //to get correct data on multihighlight highlight - if ($scope.isLayerChange == true) { - $scope.isLayerChange = false; - } - - //birendra - // for mac os Command key use for multi selection - if (evt.ctrlKey || evt.metaKey) { - $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',true); - } - else - { - $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); - $('#typedTermName_' + windowviewid).val(''); - $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); - $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); - $scope.SetwindowStoreData(windowviewid,'previousHighlightList',[]); - - $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); - preTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); - - } - - //get mouse coordinate of mirror image click - var mousePos = $scope.getMousePos(evt.pageX,evt.pageY,windowviewid); - - var context = FlipedImgCanvas.getContext("2d"); - var canvasId = context.canvas.getAttribute('id'); - - - var mirrorCanvasX = context.canvas.offsetLeft; - var mirrorCanvasWidth = context.canvas.clientWidth; - - var maskCanvasId = (canvasId.replace('_MR', '_mci')); - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); - - - var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); - - //changing for mac os now - var os=$scope.getOS(); - if(os=='MacOS') - { - var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-2; - var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-2; - } - else - { - var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-1; - var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-1; - } - - var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition);// - 135); - - var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); - - var actulalX = mirrorXOnNormalImage - var actualY = mousePos.y + verticalScrollPosition - - - var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - y), 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); - - var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); - - previousHighlightList.push(RGBColor); - - //Save Term Number to Showing Annotaion Text for CB Module - var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); - AllTerms.push({ '_TermNumber': RGBColor }); - var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); - fullTermlist.push(parseInt(RGBColor)); - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - CurriculumTermData.push({ - "transparentTermNumber": 0, - "termNumber": parseInt(RGBColor), - "tips_x": parseInt( evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, - "tips_y": parseInt( evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, - "x": evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, - "y": evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top - }); - - - if ($scope.GetwindowStoreData(windowviewid,'isHighLight')) { - - if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { - if ($scope.machedIcolorInBodyRegion.length > 0) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { - var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; - - var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; - var grayCanvas = document.getElementById(grayCanvasID); - - var grayCanvasContext = grayCanvas.getContext("2d"); - var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); - if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { - var grayImageData = grayImageDataList[bodyRegionId - 1]; - grayCanvasContext.putImageData(grayImageData, 0, 0); - } - - // for mirrored canvas - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { - if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { - var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; - var grayCanvasMR = document.getElementById(grayCanvasID); - - var grayCanvasContextMR = grayCanvasMR.getContext("2d"); - var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); - if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { - var grayImageDataMR = grayImageMRDataList[bodyRegionId]; - - grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); - } - } - } - } - } - } - } - - $scope.highLightBodyBasedOnIcolor(RGBColor,windowviewid); - } - - - //extarct clicked body part is extarct button is already enabled. - - if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); - } - $scope.enableExtract(false,windowviewid); - } - - var annotationText - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - if (TermNData != null && TermNData != undefined) { - - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - } - else { - $rootScope.daloadSearchData(windowviewid); - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); - } - var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); - - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - - - $scope.MultiLanguageAnnationArray = []; - - if (TermAnnotationText.length>0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - } - else { - - //Remove Previous TermNumber from TBox - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } - if (preTermData != undefined && preTermData.length > 0) { - for (var i = 0; i < preTermData.length; i++) { - if (preTermData[i].termNumber != parseInt(RGBColor)) { - if ($('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).remove(); - } - } - - } - } - - if ($('#dot_' + windowviewid).length > 0) { - $('#dot_' + windowviewid).remove(); - - - if ($('#sppeachBubble_' + windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - - if ($('.com_' + windowviewid).length > 0) { - $('.com_' + windowviewid).remove(); - } - if ($('#bord_' + windowviewid).length > 0) { - $('#bord_' + windowviewid).remove(); - } - - //Remove previous SpeechBubble with termnumber - if (preTermData != undefined && preTermData.length > 0) { - for (var i = 0; i < preTermData.length; i++) { - if (preTermData[i].termNumber != parseInt(RGBColor)) { - if ($('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).remove(); - } - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).remove(); - } - } - } - - $scope.MultiLanguageAnnationArray = []; - if (TermAnnotationText.length > 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - } - else { - - $scope.MultiLanguageAnnationArray = []; - - if (TermAnnotationText.length > 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - } - - - } - - }, false); - - FlipedImgCanvas.addEventListener('mousedown', function (evt) { + $scope.FlipedImgCanvasClickAnnotation(FlipedImgCanvas,x,y,evt); }, false); + FlipedImgCanvas.addEventListener('touchstart', function (evt) { - FlipedImgCanvas.addEventListener('mouseup', function (evt) { + $scope.FlipedImgCanvasClickAnnotation(FlipedImgCanvas,x,y,evt); - }, false); + },false); var context = FlipedImgCanvas.getContext("2d"); @@ -2947,14 +2699,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var cw, ch, imgW, imgH, mouseX, mouseY; var scaleFactor = 1.00; - //$scaler = $("#scaler"); - //$scaler.val(scaleFactor); - //$scaler.hide(); - var img = new Image(); img.onload = start; - // img.src = "~/../content/images/" + src;; img.src = src; @@ -3124,333 +2871,298 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } - $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage, windowviewid) { - $scope.DisableUI(); - - var imgCanvas = document.createElement('canvas'); + $scope.FlipedImgCanvasClickAnnotation =function(FlipedImgCanvas,BodyRegoinX,BodyRegoinY,evt){ + + $rootScope.UnsaveCurriculum = true; + var len= (evt.currentTarget.id).split("_").length; + var windowviewid = (evt.currentTarget.id).split("_")[len-1]; + var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; + //to get correct data on multihighlight highlight + if ($scope.isLayerChange == true) { + $scope.isLayerChange = false; + } - imgCanvas.height = h; - imgCanvas.width = w; - imgCanvas.setAttribute("data-IsMirrored", "N") - imgCanvas.style.position = "absolute"; - imgCanvas.style.left = x + "px"; - imgCanvas.style.top = y + "px"; + //birendra + // for mac os Command key use for multi selection + if (evt.ctrlKey || evt.metaKey) { + $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',true); + } + else + { + $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); + $('#typedTermName_' + windowviewid).val(''); + $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); + $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); + $scope.SetwindowStoreData(windowviewid,'previousHighlightList',[]); - if (isMaskImage == 'Y') { - imgCanvas.style.visibility = 'hidden'; - imgCanvas.id = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; + $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); + } - else { - imgCanvas.id = 'imageCanvas' + bodyRegionId + "_" + windowviewid; - if (bodyRegionId == 3) { - //set z index of hip canavs to fix the issue caused by overlapping of arm canavs on hip canavs. - imgCanvas.style.zIndex = "100"; - } - if (bodyRegionId.match('modestyImg')) { - //added class to further access this canavs to show and hide leaf as per modesty seting - imgCanvas.className = 'modestyImg_'+windowviewid; - imgCanvas.style.visibility = 'hidden' - //set z index to make leaf canvas on top of hip canavs - imgCanvas.style.zIndex = "200"; + var MousePositionX=0; + var MousePositionY=0; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + if(evt.touches!=undefined ||evt.changedTouches!=undefined) + { + var touch = evt.touches[0] || evt.changedTouches[0]; + MousePositionX=touch.pageX ; + MousePositionY=touch.pageY ; } - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); + else return; + } + else + { + MousePositionX=evt.pageX ; + MousePositionY=evt.pageY ; + + } - if ((bodyVid == 11 || bodyVid == 9) && bodyRegionId == 6) { - imgCanvas.style.zIndex = "500"; - } + //get mouse coordinate of mirror image click + var mousePos = $scope.getMousePos(MousePositionX,MousePositionY,windowviewid); - if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { - imgCanvas.style.visibility = 'visible' - } + var context = FlipedImgCanvas.getContext("2d"); + var canvasId = context.canvas.getAttribute('id'); + + + var mirrorCanvasX = context.canvas.offsetLeft; + var mirrorCanvasWidth = context.canvas.clientWidth; + + var maskCanvasId = (canvasId.replace('_MR', '_mci')); + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + + var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); + + //changing for mac os now + var os=$scope.getOS(); + if(os=='MacOS') + { + var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-2; + var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-2; + } + else + { + var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-1; + var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-1; } - imgCanvas.addEventListener('click', function (evt) { - $rootScope.UnsaveCurriculum = true; - var preTermData; //Use for Remove SpeechBUbble With TermNumber - var len= (evt.currentTarget.id).split("_").length; - var windowviewid = (evt.currentTarget.id).split("_")[len-1]; - var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); - $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; - if ($scope.isLayerChange == true) { - $scope.isLayerChange = false; - } - //birendra - // for mac os Command key use for multi selection - if (evt.ctrlKey || evt.metaKey) { - $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',true); + var distanceXOnMirrorImage = (parseInt(mirrorCanvasX) + parseInt(mirrorCanvasWidth)) - (parseInt(mousePos.x) + horizontlScrollPosition); - console.log('CTRL ON') - } - else - { - preTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + var mirrorXOnNormalImage = parseInt(maskCanvasContext.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage); - $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); - $('#typedTermName_' + windowviewid).val(''); - $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); - $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); - $scope.SetwindowStoreData(windowviewid,'previousHighlightList',[]); - $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); + var actulalX = mirrorXOnNormalImage + var actualY = mousePos.y + verticalScrollPosition - console.log('multiAnnotationIsON: ' + false); - } + var pixelData = maskCanvasContext.getImageData(Math.round(actulalX - parseInt(maskCanvasContext.canvas.offsetLeft)), Math.round(actualY - BodyRegoinY), 1, 1); + pixelData.data[0] = pixelData.data[0] - 9; + pixelData.data[1] = pixelData.data[1] - 9; + pixelData.data[2] = pixelData.data[2] - 9 - var annotationText; - var context = imgCanvas.getContext("2d"); + 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() - var canvasId = context.canvas.getAttribute('id'); - var maskCanvasId; - //for leaf canvas - if (canvasId.match('modestyImg')) { - maskCanvasId = canvasId; - } - else { - maskCanvasId = canvasId.split("_")[0] + '_mci' + "_" + windowviewid; - } - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); + } + if ((pixelData.data[2]).toString().length != 2) { + Blue = zero.concat((pixelData.data[2]).toString()) + } + else { + Blue = (pixelData.data[2]).toString() - var mousePos = $scope.getMousePos(evt.pageX,evt.pageY,windowviewid); + } + var RGBColor = (Red + Green + Blue); - var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); - //changing for mac os now - var os=$scope.getOS(); - if(os=='MacOS') - { - var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-2; - var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-2; - } - else - { - var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-1; - var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-1; - } - - //We substracted 135, as the difference between flex and html coordinates for same organ is 135 - - var actulalX = mousePos.x + horizontlScrollPosition; - var actualY = mousePos.y + verticalScrollPosition; + var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); + + previousHighlightList.push(RGBColor); + + //Save Term Number to Showing Annotaion Text for CB Module + var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); + AllTerms.push({ '_TermNumber': RGBColor }); + var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); + fullTermlist.push(parseInt(RGBColor)); + + if ($scope.GetwindowStoreData(windowviewid,'isHighLight')) { - var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); + if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { + if ($scope.machedIcolorInBodyRegion.length > 0) { + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { + var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; + var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; + var grayCanvas = document.getElementById(grayCanvasID); - //Modesty ON - if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { - RGBColor = DA[0].figLeafTermId; - annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor, null, windowviewid); - } - //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to - //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er - // - else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') { + var grayCanvasContext = grayCanvas.getContext("2d"); + var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); + if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { + var grayImageData = grayImageDataList[bodyRegionId - 1]; + grayCanvasContext.putImageData(grayImageData, 0, 0); + } - bodyRegionId = maskCanvasId.split("_")[0].slice(-1); - maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; + // for mirrored canvas + var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); + if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; + var grayCanvasMR = document.getElementById(grayCanvasID); - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); - RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); + var grayCanvasContextMR = grayCanvasMR.getContext("2d"); + var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); + if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { + var grayImageDataMR = grayImageMRDataList[bodyRegionId]; + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); + } + } + } + } + } + } } - else { - RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); - } - var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); - if (TermNData != null && TermNData != undefined) { - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + $scope.highLightBodyBasedOnIcolor(RGBColor,windowviewid); + } - } - else { - $rootScope.daloadSearchData(windowviewid); - annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + //extarct clicked body part is extarct button is already enabled. + + if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { + $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); } - var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); + $scope.enableExtract(false,windowviewid); + } - previousHighlightList.push(RGBColor); - - //Save Term Number to Showing Annotaion for CB Module - var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); - AllTerms.push({ '_TermNumber': RGBColor }); - var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); - fullTermlist.push(parseInt(RGBColor)); - - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - CurriculumTermData.push({ - "transparentTermNumber": 0, - "termNumber": parseInt(RGBColor), - "tips_x": parseInt( evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, - "tips_y": parseInt( evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, - "x": evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, - "y": evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top - }); + var annotationText + var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); + if (TermNData != null && TermNData != undefined) { - + annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + } + else + { + $rootScope.daloadSearchData(windowviewid); + annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + } + var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); - if ($scope.GetwindowStoreData(windowviewid,'isHighLight') == true) { - if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { - if ($scope.machedIcolorInBodyRegion.length > 0) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { - var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; - - var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; - var grayCanvas = document.getElementById(grayCanvasID); - var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); - var grayCanvasContext = grayCanvas.getContext("2d"); - if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { - var grayImageData = grayImageDataList[bodyRegionId - 1]; - grayCanvasContext.putImageData(grayImageData, 0, 0); - } - var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - // for unhighlight the mirrored body region - if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { - if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { - var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; - var grayCanvasMR = document.getElementById(grayCanvasID); - var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); - var grayCanvasContextMR = grayCanvasMR.getContext("2d"); + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { + $scope.MultiLanguageAnnationArray = []; - var grayImageDataMR = grayImageMRDataList[bodyRegionId]; + if (TermAnnotationText.length>0) { + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); + } - } - } - } + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + } + } + else + { + $scope.saveTermNumberForSaveCB(windowviewid,RGBColor); - } - } - } - } + $scope.MultiLanguageAnnationArray = []; + if (TermAnnotationText.length > 0) { + + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { } - else - { - $scope.highLightBodyBasedOnIcolor(RGBColor,windowviewid); + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); } + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + } + + } + + var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + CurriculumTermData.push({ + "transparentTermNumber": 0, + "termNumber": parseInt(RGBColor), + "istpboxTerm":0, + "tips_x": parseInt( MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, + "tips_y": parseInt( MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, + "x": MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, + "y": MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top + }); + + + } + + $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage, windowviewid) { + $scope.DisableUI(); + + var imgCanvas = document.createElement('canvas'); + + imgCanvas.height = h; + imgCanvas.width = w; + imgCanvas.setAttribute("data-IsMirrored", "N") + imgCanvas.style.position = "absolute"; + imgCanvas.style.left = x + "px"; + imgCanvas.style.top = y + "px"; + + if (isMaskImage == 'Y') { + imgCanvas.style.visibility = 'hidden'; + imgCanvas.id = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; + } + else { + imgCanvas.id = 'imageCanvas' + bodyRegionId + "_" + windowviewid; + + if (bodyRegionId == 3) { + //set z index of hip canavs to fix the issue caused by overlapping of arm canavs on hip canavs. + imgCanvas.style.zIndex = "100"; + } + if (bodyRegionId.match('modestyImg')) { + //added class to further access this canavs to show and hide leaf as per modesty seting + imgCanvas.className = 'modestyImg_'+windowviewid; + imgCanvas.style.visibility = 'hidden' + //set z index to make leaf canvas on top of hip canavs + imgCanvas.style.zIndex = "200"; } + var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); - - //extarct clisked body part is extarct button is already enabled. - if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { - $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); - } - $scope.enableExtract(false,windowviewid); + if ((bodyVid == 11 || bodyVid == 9) && bodyRegionId == 6) { + imgCanvas.style.zIndex = "500"; } - var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); - if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { - - if (TermAnnotationText.length > 0) { - $scope.MultiLanguageAnnationArray = []; - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - + if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + imgCanvas.style.visibility = 'visible' } - else { - - $scope.MultiLanguageAnnationArray = []; - - console.log('1. annotationText: ' + annotationText); - - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } - if (preTermData != undefined && preTermData.length > 0) { - for (var i = 0; i < preTermData.length; i++) { - if (preTermData[i].termNumber != parseInt(RGBColor)) { - if ($('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).remove(); - } - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).remove(); - } - } - } - - if ($('#dot_'+windowviewid).length > 0) { - $('#dot_'+windowviewid).remove(); - - if ($('#sppeachBubble_'+windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - if ($('.com_'+windowviewid).length > 0) { - $('.com_'+windowviewid).remove(); - } - if ($('#bord_'+windowviewid).length > 0) { - $('#bord_'+windowviewid).remove(); - } - - if (TermAnnotationText.length > 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - - console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); + } - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - //Remove previous SpeechBubble with termnumber - var TermAnnotationText = $scope.GetwindowStoreData(windowviewid, 'TermAnnotationText'); - if (preTermData != undefined && preTermData.length > 0) { - for (var i = 0; i < preTermData.length; i++) { - if (preTermData[i].termNumber != parseInt(RGBColor)) { - if ($('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).remove(); - } - } - - } - } - - } - else { - $scope.MultiLanguageAnnationArray = []; - if (TermAnnotationText.length > 0) { - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + imgCanvas.addEventListener('click', function (evt) { - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } + $scope.imageCanvasClickAnnotation(imgCanvas,x,y,evt); - console.log('3. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); + },false); - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); - } - } + imgCanvas.addEventListener('touchstart', function (evt) { + $scope.imageCanvasClickAnnotation(imgCanvas,x,y,evt); - } - }, false); + },false); var PI = Math.PI; var PI2 = PI * 2; @@ -3463,8 +3175,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l img.src = src; - - function start() { context.drawImage(img, 0, 0); @@ -3650,6 +3360,237 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l document.getElementById('canvasDivDA_' + windowviewid).appendChild(imgCanvas); } + $scope.imageCanvasClickAnnotation =function(imgCanvas,BodyRegoinX,BodyRegoinY,evt) + { + $rootScope.UnsaveCurriculum = true; + var len= (evt.target.id).split("_").length; + var windowviewid = (evt.target.id).split("_")[len-1]; + var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); + $scope.imageVerticalScrollPosition = canvasDiv.scrollTop; + if ($scope.isLayerChange == true) { + $scope.isLayerChange = false; + } + //birendra + // for mac os Command key use for multi selection + if (evt.ctrlKey || evt.metaKey) { + $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',true); + + console.log('CTRL ON') + } + else + { + $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); + $('#typedTermName_' + windowviewid).val(''); + $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); + $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); + $scope.SetwindowStoreData(windowviewid,'previousHighlightList',[]); + $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); + console.log('multiAnnotationIsON: ' + false); + + } + + var annotationText; + var context = imgCanvas.getContext("2d"); + + var canvasId = context.canvas.getAttribute('id'); + var maskCanvasId; + //for leaf canvas + if (canvasId.match('modestyImg')) { + maskCanvasId = canvasId; + } + else { + maskCanvasId = canvasId.split("_")[0] + '_mci' + "_" + windowviewid; + } + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + + var MousePositionX=0; + var MousePositionY=0; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + if(evt.touches!=undefined ||evt.changedTouches!=undefined) + { + var touch = evt.touches[0] || evt.changedTouches[0]; + MousePositionX=touch.pageX ; + MousePositionY=touch.pageY ; + } + else return; + } + else + { + MousePositionX=evt.pageX ; + MousePositionY=evt.pageY ; + + } + + var mousePos = $scope.getMousePos(MousePositionX,MousePositionY,windowviewid); + + var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); + //changing for mac os now + var os=$scope.getOS(); + if(os=='MacOS') + { + var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-2; + var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-2; + } + else + { + var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-1; + var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-1; + } + + //We substracted 135, as the difference between flex and html coordinates for same organ is 135 + + var actulalX = mousePos.x + horizontlScrollPosition; + var actualY = mousePos.y + verticalScrollPosition; + + var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, BodyRegoinX, BodyRegoinY); + + + //Modesty ON + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { + RGBColor = DA[0].figLeafTermId; + annotationText = $scope.GetAnnotationBasedOnActualTermNo(RGBColor, null, windowviewid); + } + //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to + //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er + // + else if (maskCanvasId.match('modestyImg') && RGBColor == '000000') { + + bodyRegionId = maskCanvasId.split("_")[0].slice(-1); + maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci' + "_" + windowviewid; + + var maskCanvas = document.getElementById(maskCanvasId); + var maskCanvasContext = maskCanvas.getContext("2d"); + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, BodyRegoinX, BodyRegoinY); + + } + else { + RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, BodyRegoinX, BodyRegoinY); + + } + var TermNData=$scope.GetwindowStoreData(windowviewid,'TermNumberData'); + if (TermNData != null && TermNData != undefined) { + annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + + } + else { + $rootScope.daloadSearchData(windowviewid); + annotationText = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); + + } + var previousHighlightList=$scope.GetwindowStoreData(windowviewid,'previousHighlightList'); + + previousHighlightList.push(RGBColor); + + //Save Term Number to Showing Annotaion for CB Module + var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); + AllTerms.push({ '_TermNumber': RGBColor }); + var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); + fullTermlist.push(parseInt(RGBColor)); + + if ($scope.GetwindowStoreData(windowviewid,'isHighLight') == true) { + if ($scope.machedIcolorInBodyRegion != null || $scope.machedIcolorInBodyRegion != undefined) { + if ($scope.machedIcolorInBodyRegion.length > 0) { + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { + for (var i = 0; i < $scope.machedIcolorInBodyRegion.length; i++) { + var bodyRegionId = $scope.machedIcolorInBodyRegion[i]; + + var grayCanvasID = 'imageCanvas' + bodyRegionId + "_" + windowviewid; + var grayCanvas = document.getElementById(grayCanvasID); + var grayImageDataList=$scope.GetwindowStoreData(windowviewid,'grayImageDataList'); + var grayCanvasContext = grayCanvas.getContext("2d"); + if (grayImageDataList[bodyRegionId - 1] != null || grayImageDataList[bodyRegionId - 1] != undefined) { + var grayImageData = grayImageDataList[bodyRegionId - 1]; + grayCanvasContext.putImageData(grayImageData, 0, 0); + } + var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId'); + // for unhighlight the mirrored body region + if (bodyVid == "1" || bodyVid == "4" || bodyVid == "5" || bodyVid == "8") { + if (bodyRegionId == 4 || bodyRegionId == 5 || bodyRegionId == 6) { + var grayCanvasID = 'imageCanvas' + bodyRegionId + '_MR' + "_" + windowviewid; + var grayCanvasMR = document.getElementById(grayCanvasID); + var grayImageMRDataList=$scope.GetwindowStoreData(windowviewid,'grayImageMRDataList'); + var grayCanvasContextMR = grayCanvasMR.getContext("2d"); + + if (grayImageMRDataList[bodyRegionId] != null || grayImageMRDataList[bodyRegionId] != undefined) { + + var grayImageDataMR = grayImageMRDataList[bodyRegionId]; + + grayCanvasContextMR.putImageData(grayImageDataMR, 0, 0); + + } + } + } + + } + } + } + } + + if (maskCanvasId.match('modestyImg') && RGBColor != '000000') { } + else + { + $scope.highLightBodyBasedOnIcolor(RGBColor,windowviewid); + } + + } + + //extarct clisked body part is extarct button is already enabled. + if ($scope.GetwindowStoreData(windowviewid,'isExtract') == true) { + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == false) { + $scope.SetwindowStoreData(windowviewid,'isListManagerSelected',false); + } + $scope.enableExtract(false,windowviewid); + } + + var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); + if ($scope.GetwindowStoreData(windowviewid,'multiAnnotationIsON') == true) { + + if (TermAnnotationText.length > 0) { + $scope.MultiLanguageAnnationArray = []; + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); + } + + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + } + + } + else + { + $scope.saveTermNumberForSaveCB(windowviewid,RGBColor); + $scope.MultiLanguageAnnationArray = []; + + if (TermAnnotationText.length > 0) { + for (var i = 0; i <= TermAnnotationText.length - 1; i++) { + + $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); + } + + console.log('2. annotationText: ' + annotationText + ' , length: ' + $scope.MultiLanguageAnnationArray.length); + + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, RGBColor); + } + + } + + var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + CurriculumTermData.push({ + "transparentTermNumber": 0, + "termNumber": parseInt(RGBColor), + "istpboxTerm":0, + "tips_x": parseInt( MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, + "tips_y": parseInt( MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, + "x": MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, + "y": MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top + }); + + + } + $scope.ShowCBDataBodyView = function(windowviewid) { // added by Birendra @@ -4960,59 +4901,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#layerChangeSliderDA_" + windowviewid).slider("option", "value", sliderVal); // Annotations Closing Code - - $('.com_anno_'+windowviewid).remove(); - - $('#sppeachBubble_annotation_'+windowviewid).remove(); - $('#dot_annotation_'+windowviewid).remove(); - $('#bord_annotation_'+windowviewid).remove(); - - $('#dot_'+windowviewid).remove(); - $('#sppeachBubble_'+windowviewid).remove(); - $('.com_'+windowviewid).remove(); - $('#bord_' + windowviewid).remove(); - - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#dot_' + windowviewid).length > 0) { - $('#dot_' + windowviewid).remove(); - } - if ($('#sppeachBubble_' + windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - if ($('.com_' + windowviewid).length > 0) { - $('.com_' + windowviewid).remove(); - } - if ($('#bord_' + windowviewid).length > 0) { - $('#bord_' + windowviewid).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - if (CurriculumTermData != undefined && CurriculumTermData.length > 0) { - for (var i = 0; i < CurriculumTermData.length; i++) { - if ($('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).remove(); - } - } - } + $scope.removeAllTermNumberForSaveCB(windowviewid); //Remove Annotaion for Slide Changes to Save CB $scope.SetwindowStoreData(windowviewid, 'previousHighlightList', []); $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); - + $('#typedTermName_' + windowviewid).val(''); if (($("#canvasPaintDA_"+windowviewid).css("display") == "block") && ($("#canvasDA_"+windowviewid).css("display") == "block")) { @@ -5086,6 +4981,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.createDynamicSpeechBubble = function (event, x, y, isAnnotationNotForTBox, tipx, tipy,windowviewid, termNumber) { + var termNumber=parseInt(termNumber); if (isAnnotationNotForTBox == true) { if ($scope.MultiLanguageAnnationArray.length > 1) { $scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; }); @@ -5106,7 +5002,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l speechBubbleCounter = speechBubbleCounter + 1; $scope.SetwindowStoreData(windowviewid, 'speechBubbleCounter', speechBubbleCounter); - if (termNumber != undefined && termNumber != 0) { + if (termNumber != undefined ) { var id = "speechBubble" + speechBubbleCounter + '_' + windowviewid + '-' + termNumber;//Add by Sandy for Save Annotation } @@ -5374,31 +5270,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } else { - $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',false); - $('#bord_annotation_'+windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - - if ($('#dot_' + windowviewid).length > 0) { - $('#dot_' + windowviewid).remove(); - } - if ($('#sppeachBubble_' + windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - if ($('.com_' + windowviewid).length > 0) { - $('.com_' + windowviewid).remove(); - } - if ($('#bord_' + windowviewid).length > 0) { - $('#bord_' + windowviewid).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } + $scope.SetwindowStoreData(windowviewid,'multiAnnotationIsON',false); $scope.createSpeechBubbleBasedOnTransparencyWithoutCtrl(x, y,windowviewid, termNumber); $('#sppeachBubble_annotation_' + windowviewid + '-' + termNumber).draggable( @@ -5444,10 +5316,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('.crossDiv_annotation_'+windowviewid).on('click', function (evt) { var len= (evt.target.className).split("_").length; var windid = (evt.target.className).split("_")[len-1]; - $('#sppeachBubble_annotation_'+windid).remove(); - $('#bord_annotation_'+windid).remove(); - $('#dot_annotation_' + windid).remove(); - + //Delete Annotation in case of show multipule annotation var removeid = $(this).parent().parent().attr('id'); var termNumber = removeid.split("-")[1]; @@ -5462,6 +5331,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $rootScope.UnsaveCurriculum = true; } $('#' + removeid).remove(); + $('#bord_annotation_'+windid).remove(); + $('#dot_annotation_' + windid).remove(); + }); } } @@ -6117,50 +5989,14 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l function mouseUpListener(e) { var len = (e.currentTarget.id).split("_").length; - var windowviewid = (e.currentTarget.id).split("_")[len - 1]; - //to prevent screen scroll on ipad while drawing TB - e.preventDefault(); - $rootScope.UnsaveCurriculum = true; - $scope.SetwindowStoreData(windowviewid, 'isTBDrawnOnBodyRegion', false); - $scope.SetwindowStoreData(windowviewid, 'isTransparencyActivated', true); - $scope.SetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isNormalMode')); - $scope.SetwindowStoreData(windowviewid, 'IsHighlightModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isHighlight')); - - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#dot_' + windowviewid).length > 0) { - $('#dot_' + windowviewid).remove(); - } - if ($('#sppeachBubble_' + windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - if ($('.com_' + windowviewid).length > 0) { - $('.com_' + windowviewid).remove(); - } - if ($('#bord_' + windowviewid).length > 0) { - $('#bord_' + windowviewid).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - if (CurriculumTermData != undefined && CurriculumTermData.length > 0) { - for (var i = 0; i < CurriculumTermData.length; i++) { - if ($('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).remove(); - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).remove(); - } - } - } - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); + var windowviewid = (e.currentTarget.id).split("_")[len - 1]; + //to prevent screen scroll on ipad while drawing TB + e.preventDefault(); + $rootScope.UnsaveCurriculum = true; + $scope.SetwindowStoreData(windowviewid, 'isTBDrawnOnBodyRegion', false); + $scope.SetwindowStoreData(windowviewid, 'isTransparencyActivated', true); + $scope.SetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isNormalMode')); + $scope.SetwindowStoreData(windowviewid, 'IsHighlightModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isHighlight')); var previewRectangleWidth = $('.rectangle').width(); var previewRectangleHeight = $('.rectangle').height() @@ -6255,7 +6091,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mousemove", mouseMoveListener); document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mouseup", mouseUpListener); - var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid, 'BodyRegionCordinatesData'); document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("touchstart", mouseDownListener); document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("touchmove", mouseMoveListener); @@ -6285,7 +6120,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if ($("#DrawMode").hasClass("annotationtoolbartab")) { if ($scope.GetwindowStoreData(windowviewid, 'isTBoxModestyVisible') == true) { - $rootScope.switchCanvas(); + $rootScope.switchCanvas("daImagePanel_"+windowviewid); } else { @@ -6305,7 +6140,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } else { - $rootScope.switchToTransparencycanvas(); + $rootScope.switchToTransparencycanvas("daImagePanel_"+windowviewid); } } else { @@ -6388,6 +6223,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //bind click listener transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + //bind touch listener + transparencyCanvas.addEventListener('touchstart', TransparencyCanvasClickListener); $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex')); $(".ui-wrapper").css("left",TransparencyBoxStartX-2+ 'px'); @@ -6585,11 +6422,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.SetwindowStoreData(windowviewid, 'isTransparencyActivated', true); $scope.SetwindowStoreData(windowviewid, 'IsNormalModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isNormalMode')); $scope.SetwindowStoreData(windowviewid, 'IsHighlightModeBeforeTBDraw', $scope.GetwindowStoreData(windowviewid, 'isHighlight')); - $('.com_' + windowviewid).remove(); - $('#dot_' + windowviewid).remove(); - $('#bord_' + windowviewid).remove(); - $('#sppeachBubble_' + windowviewid).remove(); - + //Get Transparecy attributes from save CB var transparencyBounds = $scope.GetwindowStoreData(windowviewid, 'transparencyBounds'); $.each(transparencyBounds, function (index, value){ @@ -6680,6 +6513,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l //bind click listener transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + //bind touch listener + transparencyCanvas.addEventListener('touchstart', TransparencyCanvasClickListener); $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex')); $(".ui-wrapper").css("left",$scope.startX-2+ 'px'); @@ -7098,6 +6933,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l canvasModesty.style.zIndex = $rootScope.modestyCanvasZindex; canvasModesty.addEventListener('click', OnClickModestyTransCanvas); + canvasModesty.addEventListener('touchstart', OnClickModestyTransCanvas); document.getElementById("canvasDivDA_" + windowviewid).appendChild(canvasModesty); } @@ -7665,121 +7501,86 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } // History Maintained Issue// + $scope.onDrawingCanvasTouch = function (event) { + if (event != undefined && (event.target.id).match("canvasDA")) { + + if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { + $rootScope.getAnnotationTextBasedOnSelectedBodyRegion(event); + } + } + + }; + $rootScope.getAnnotationTextBasedOnSelectedBodyRegion = function (event) { - var len= (event.currentTarget.id).split("_").length; - var windowviewid = (event.currentTarget.id).split("_")[len-1]; + var len= (event.target.id).split("_").length; + var windowviewid = (event.target.id).split("_")[len-1]; + $rootScope.isMirrorBodyRegion=undefined; var canvasDiv = document.getElementById("canvasDivDA_" + windowviewid); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; - - $rootScope.Xaxis = event.pageX - $('#canvasDivDA_' + windowviewid).offset().left + horizontlScrollPosition; - $rootScope.Yaxis = event.pageY - $('#canvasDivDA_' + windowviewid).offset().top + verticalScrollPosition; + var MousePositionX=0; + var MousePositionY=0; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + if(event.touches!=undefined ||event.changedTouches!=undefined) + { + var touch = event.touches[0] || event.changedTouches[0]; + MousePositionX=touch.pageX ; + MousePositionY=touch.pageY ; + $rootScope.Xaxis = touch.pageX - $('#canvasDivDA_' + windowviewid).offset().left + horizontlScrollPosition; + $rootScope.Yaxis = touch.pageY - $('#canvasDivDA_' + windowviewid).offset().top + verticalScrollPosition; + } + else return; + } + else + { + MousePositionX=event.pageX ; + MousePositionY=event.pageY ; + $rootScope.Xaxis = event.pageX - $('#canvasDivDA_' + windowviewid).offset().left + horizontlScrollPosition; + $rootScope.Yaxis = event.pageY - $('#canvasDivDA_' + windowviewid).offset().top + verticalScrollPosition; + } $rootScope.setSelectedBodyRegionData(windowviewid); + var gender= $scope.GetwindowStoreData(windowviewid,'genderId'); + var currentBodyViewId =$scope.GetwindowStoreData(windowviewid,'voId'); + + if ($rootScope.isMirrorBodyRegion == "No") { - var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci" + "_" + windowviewid; - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); - - 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),windowviewid); - $scope.NormalTermNumber = RGBColor; - } - else { - var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_MR_mci"+ "_" + windowviewid; - var maskoffsetval = $('#' + maskCanvasId).offset(); - var mirrorCanvasX = maskoffsetval.left; - var mirrorImageCanvas = document.getElementById(maskCanvasId); - var mirrorCanvasWidth = mirrorImageCanvas.clientWidth; - var maskCanvas = document.getElementById(maskCanvasId); - var maskCanvasContext = maskCanvas.getContext("2d"); + var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_mci" + "_" + windowviewid; - 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() + if($rootScope.BRId=="2" || $rootScope.BRId=="3") + { + if(gender=="Female" && (currentBodyViewId=="5")) + { + var maskCanvasId = "imageCanvasmodestyImg" + $rootScope.BRId + "_" + windowviewid; + } + else if(gender=="Female" && $rootScope.BRId=="2" && (currentBodyViewId=="6"|| currentBodyViewId=="7"|| currentBodyViewId=="11")) + { + var maskCanvasId = "imageCanvasmodestyImg" + $rootScope.BRId + "_" + windowviewid; + } + else if(gender=="Male" && $rootScope.BRId=="3" && currentBodyViewId=="1") + { + var maskCanvasId = "imageCanvasmodestyImg" + $rootScope.BRId + "_" + windowviewid; + } + } - var RGBColor = (Red + Green + Blue); - $scope.NormalTermNumber = RGBColor; - } - - if (event.ctrlKey || event.metaKey) { - $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', true); - } - else { - $scope.SetwindowStoreData(windowviewid, 'isListManagerSelected', false); - $('#typedTermName_' + windowviewid).val(''); - $scope.SetwindowStoreData(windowviewid, 'fullTermlist', []); - $scope.SetwindowStoreData(windowviewid, 'AllTerms', []); - $scope.SetwindowStoreData(windowviewid, 'previousHighlightList', []); - $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); - $scope.removeAllTermNumberForSaveCB(windowviewid);//Calling Methode for remove Annotations Text + var maskCanvas = document.getElementById(maskCanvasId); + + $scope.imageCanvasClickAnnotation(maskCanvas,$rootScope.BodyRegionXAxis,$rootScope.BodyRegionYAxis,event); } - - //Save Term Number to Showing Annotaion Text for CB Module - var RGBColor = $scope.NormalTermNumber; - var AllTerms = $scope.GetwindowStoreData(windowviewid, 'AllTerms'); - AllTerms.push({ '_TermNumber': RGBColor }); - var fullTermlist = $scope.GetwindowStoreData(windowviewid, 'fullTermlist'); - fullTermlist.push(parseInt(RGBColor)); - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - CurriculumTermData.push({ - "transparentTermNumber": 0, - "termNumber": parseInt(RGBColor), - "tips_x": parseInt(event.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, - "tips_y": parseInt(event.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, - "x": event.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, - "y": event.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top - }); - - $scope.MultiLanguageAnnationArray = []; - - var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); - for (var i = 0; i <= TermAnnotationText.length - 1; i++) { - - $scope.MultiLanguageAnnationArray.push(TermAnnotationText[i]); - } - if (TermAnnotationText.length>0) { - $scope.createDynamicSpeechBubble(event, event.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, event.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, true, 0, 0, windowviewid, $scope.NormalTermNumber) + else + { + var maskCanvasId = "imageCanvas" + $rootScope.BRId + "_MR"+ "_" + windowviewid; + var mirrorImageCanvas = document.getElementById(maskCanvasId); + $scope.FlipedImgCanvasClickAnnotation(mirrorImageCanvas,$rootScope.BodyRegionXAxis,$rootScope.BodyRegionYAxis,event); } - var previousHighlightList = $scope.GetwindowStoreData(windowviewid, 'previousHighlightList'); - - previousHighlightList.push(RGBColor); - if ($scope.GetwindowStoreData(windowviewid,'isHighLight') == true) { - $scope.highLightBodyBasedOnIcolor(RGBColor, windowviewid); - } + } $rootScope.setSelectedBodyRegionData = function (windowviewid) { @@ -7873,7 +7674,27 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var windowviewid = (evt.currentTarget.id).split("_")[len-1]; var pixelData; var pixelDataTrans; - var mousePos = $scope.getMousePos(evt.pageX,evt.pageY,windowviewid); + + var MousePositionX=0; + var MousePositionY=0; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + if(evt.touches!=undefined ||evt.changedTouches!=undefined) + { + var touch = evt.touches[0] || evt.changedTouches[0]; + MousePositionX=touch.pageX ; + MousePositionY=touch.pageY ; + } + else return; + } + else + { + MousePositionX=evt.pageX ; + MousePositionY=evt.pageY ; + } + + var mousePos = $scope.getMousePos(MousePositionX,MousePositionY,windowviewid); var canvasDiv = document.getElementById("canvasDivDA_" + windowviewid); //changing for mac os now @@ -7964,7 +7785,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var maskCanvasContexttrans = maskCanvastrans.getContext("2d"); - getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt,MousePositionX,MousePositionY) } @@ -8009,7 +7830,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l x = transparencyTempcanavsMask.style.left; y = transparencyTempcanavsMask.style.top; - getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, tempmaskCtx, clickedBodyRegion, x, y, evt) + getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, tempmaskCtx, clickedBodyRegion, x, y, evt,MousePositionX,MousePositionY) } } @@ -8039,12 +7860,17 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.annotationTextArrayT1.push($rootScope.annotationTextForTrans1[i]); } for (var i = 0; i <= $rootScope.annotationTextForTrans2.length - 1; i++) { - $scope.annotationTextArrayT2.push($rootScope.annotationTextForTrans2[i]); - } - $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid)//Calling Method for Tbox termnumber SaveCB + $scope.annotationTextArrayT2.push($rootScope.annotationTextForTrans2[i]); + + } + var TBoxTermNumber=annotations.TBoxTermNumber; + var NormalTermNumber=annotations.NormalTermNumber; + + $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid,TBoxTermNumber,NormalTermNumber,MousePositionX,MousePositionY);//Calling Method for Tbox termnumber SaveCB + var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); if (TermAnnotationText.length > 0) { - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, $scope.TBoxTermNumber); + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, TBoxTermNumber); } } @@ -8066,7 +7892,26 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var tCanvasHeightAftrSplit = tCanvasHeight.split("p"); var tCanvasTotalWidth = parseInt(tCanvasLeftAftrSplit[0]) + parseInt(tCanvasWidthAftrSplit[0]); var tCanvasTotalHeight = parseInt(tCanvasTopAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); - var mousePos = $scope.getMousePos(evt.pageX,evt.pageY,windowviewid); + var MousePositionX=0; + var MousePositionY=0; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + if(evt.touches!=undefined ||evt.changedTouches!=undefined) + { + var touch = evt.touches[0] || evt.changedTouches[0]; + MousePositionX=touch.pageX ; + MousePositionY=touch.pageY ; + } + else return; + } + else + { + MousePositionX=evt.pageX ; + MousePositionY=evt.pageY ; + } + + var mousePos = $scope.getMousePos(MousePositionX,MousePositionY,windowviewid); var canvasDiv = document.getElementById('canvasDivDA_'+windowviewid); //changing for mac os now var os=$scope.getOS(); @@ -8102,7 +7947,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.annotationTextArrayT2 = []; $scope.annotationTextArrayT1.push(annotationText); $scope.annotationTextArrayT2.push(annotationText); - $scope.TBoxTermNumber = RGBColor; + $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid,0,RGBColor,MousePositionX,MousePositionY)//Calling Method for Tbox termnumber SaveCB } //Modesty On but clicked somewhre else, we did modesty check because the modesty image covers whole body region so if user will click to //see the annotation apart from leaf then the actual click will be on modesty canvas, but for annotation er @@ -8133,11 +7978,16 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } for (var i = 0; i <= annotations.annotationT2.length - 1; i++) { - $scope.annotationTextArrayT2.push(annotations.annotationT2[i]); + $scope.annotationTextArrayT2.push(annotations.annotationT2[i]); } + var TBoxTermNumber=annotations.TBoxTermNumber; + var NormalTermNumber=annotations.NormalTermNumber; + + $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid,TBoxTermNumber,NormalTermNumber,MousePositionX,MousePositionY);//Calling Method for Tbox termnumber SaveCB + } - $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid)//Calling Method for Tbox termnumber SaveCB + var tCanvasTopPos = $(".ui-wrapper").css("top"); var tCanvasTopPosAftrSplit = tCanvasTopPos.split("p"); var tCanvasHeight = $(".ui-wrapper").css("height"); @@ -8145,7 +7995,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var tCanvasAttr = parseInt(tCanvasTopPosAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); if (TermAnnotationText.length > 0) { - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, $scope.TBoxTermNumber); + $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, TBoxTermNumber); } } else { @@ -8153,7 +8003,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } } - function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) { + function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt,MousePositionX,MousePositionY) { var len= (evt.target.id).split("_").length; var windowviewid = (evt.target.id).split("_")[len-1]; @@ -8198,35 +8048,52 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l for (var i = 0; i <= $rootScope.annotationTextForTrans2.length - 1; i++) { $scope.annotationTextArrayT2.push($rootScope.annotationTextForTrans2[i]); } - $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid)//Calling Method for Tbox termnumber SaveCB + + var TBoxTermNumber=annotations.TBoxTermNumber; + var NormalTermNumber=annotations.NormalTermNumber; + + $scope.saveTBoxTermNumberForSaveCB(evt, windowviewid,TBoxTermNumber,NormalTermNumber,MousePositionX,MousePositionY);//Calling Method for Tbox termnumber SaveCB + var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); if (TermAnnotationText.length > 0) { - $scope.createDynamicSpeechBubble(evt, evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, $scope.TBoxTermNumber); + $scope.createDynamicSpeechBubble(evt, MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top, false, 0, 0, windowviewid, TBoxTermNumber); } } //Added Method to Save TransparencyBox TermNumbers for SaveCB - $scope.saveTBoxTermNumberForSaveCB = function (evt, windowviewid) { + $scope.saveTBoxTermNumberForSaveCB = function (evt, windowviewid,TBoxTermNumber,NormalTermNumber,MousePositionX,MousePositionY) { if (evt.ctrlKey || evt.metaKey) { $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', true); } else { //Remove previous SpeechBubble with termnumber - var normalTermNumber = $scope.NormalTermNumber; - var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - if (CurriculumTermData != undefined && CurriculumTermData.length > 0) { - for (var i = 0; i < CurriculumTermData.length; i++) { - //if (CurriculumTermData[i].termNumber != parseInt(normalTermNumber)) { - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + CurriculumTermData[i].transparentTermNumber).remove(); - } - if ($('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + CurriculumTermData[i].termNumber).remove(); - } - //} + + var preTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + if (preTermData != undefined && preTermData.length > 0) { + for (var i = 0; i < preTermData.length; i++) { + if (preTermData[i].transparentTermNumber != parseInt(TBoxTermNumber)) { + + var CurriculumTermData = []; + CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + CurriculumTermData = new jinqJs() + .from(CurriculumTermData) + .delete().at("transparentTermNumber == " + preTermData[i].transparentTermNumber,'istpboxTerm == ' + 1).select(); + + $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', CurriculumTermData); + } + } } - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); + + // remove all in multi annotation + $('.com_anno_' + windowviewid).remove(); + // $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); + + // remove all in single annotation + $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); + $('#bord_annotation_' + windowviewid).remove(); + $('#dot_annotation_' + windowviewid).remove(); + $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); } var canvasDiv = document.getElementById('canvasDivDA_' + windowviewid); @@ -8244,56 +8111,101 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } var CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); CurriculumTermData.push({ - "transparentTermNumber": parseInt($scope.TBoxTermNumber), - "termNumber": parseInt($scope.NormalTermNumber), - "tips_x": parseInt(evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, - "tips_y": parseInt(evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, - "x": evt.pageX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, - "y": evt.pageY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top + "transparentTermNumber": parseInt(TBoxTermNumber), + "termNumber": parseInt(NormalTermNumber), + "istpboxTerm":1, + "tips_x": parseInt(MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left) + 30, + "tips_y": parseInt(MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top) + 10, + "x": MousePositionX + horizontlScrollPosition - $('#canvasDivDA_' + windowviewid).offset().left, + "y": MousePositionY + verticalScrollPosition - $('#canvasDivDA_' + windowviewid).offset().top }); $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', CurriculumTermData); } - //Added method to remove All Previous Annotations Text Fro SaveCB - $scope.removeAllTermNumberForSaveCB = function (windowviewid) { + + //Remove all TP term while close box + $scope.removeAllTermTpClose = function (windowviewid) { + var preTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); - $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); if (preTermData != undefined && preTermData.length > 0) { for (var i = 0; i < preTermData.length; i++) { - if (preTermData[i].termNumber != parseInt($scope.NormalTermNumber)) { - if ($('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).length > 0) { - $('#sppeachBubble_' + windowviewid + '-' + preTermData[i].termNumber).remove(); - } - } - if ($('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid + '-' + preTermData[i].transparentTermNumber).remove(); - } + + var CurriculumTermData = []; + CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + CurriculumTermData = new jinqJs() + .from(CurriculumTermData) + .delete().at('istpboxTerm == ' + 1).select(); + + $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', CurriculumTermData); + } } + + // remove all in multi annotation + $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#sppeachBubble_annotation_' + windowviewid).length > 0) { - $('#sppeachBubble_annotation_' + windowviewid).remove(); - } - if ($('#bord_annotation_' + windowviewid).length > 0) { - $('#bord_annotation_' + windowviewid).remove(); - } - if ($('#dot_annotation_' + windowviewid).length > 0) { - $('#dot_annotation_' + windowviewid).remove(); - } - $('#bord_annotation_' + windowviewid).css({ "width": "0px", "display": "none" }); - $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); - if ($('#dot_' + windowviewid).length > 0) { - $('#dot_' + windowviewid).remove(); - if ($('#sppeachBubble_' + windowviewid).length > 0) { - $('#sppeachBubble_' + windowviewid).remove(); - } - if ($('.com_' + windowviewid).length > 0) { - $('.com_' + windowviewid).remove(); - } - if ($('#bord_' + windowviewid).length > 0) { - $('#bord_' + windowviewid).remove(); + // remove all in single annotation + $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); + $('#bord_annotation_' + windowviewid).remove(); + $('#dot_annotation_' + windowviewid).remove(); + + $scope.SetwindowStoreData(windowviewid, 'multiAnnotationIsON', false); + + } + + + //Added method to remove All Previous Annotations Text Fro SaveCB + $scope.removeAllTermNumberForSaveCB = function (windowviewid) { + $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', []); + + // remove all in multi annotation in TP + $('.dynCross_anno_' + windowviewid).parent().parent().parent().remove(); + + // remove all in single annotation in TP + $('.crossDiv_annotation_' + windowviewid).parent().parent().remove(); + $('#bord_annotation_' + windowviewid).remove(); + $('#dot_annotation_' + windowviewid).remove(); + + + + // remove all in multi annotation + $('.com_' + windowviewid).remove(); + + // remove all in single annotation + $('#dot_' + windowviewid).remove(); + $('#bord_' + windowviewid).remove(); + $('#crossDiv_' + windowviewid).parent().parent().remove(); + } + + //Added Method to Save TransparencyBox TermNumbers for SaveCB + $scope.saveTermNumberForSaveCB = function (windowviewid,NormalTermNumber) { + //Remove previous SpeechBubble with termnumber + + var preTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + if (preTermData != undefined && preTermData.length > 0) { + for (var i = 0; i < preTermData.length; i++) { + if (preTermData[i].termNumber != parseInt(NormalTermNumber)) { + + var CurriculumTermData = []; + CurriculumTermData = $scope.GetwindowStoreData(windowviewid, 'CurriculumTermData'); + CurriculumTermData = new jinqJs() + .from(CurriculumTermData) + .delete().at("termNumber == " + preTermData[i].termNumber,'istpboxTerm == ' + 0).select(); + + $scope.SetwindowStoreData(windowviewid, 'CurriculumTermData', CurriculumTermData); + } + } } + + // remove all in multi annotation + $('.com_' + windowviewid).remove(); + + // remove all in single annotation + $('#dot_' + windowviewid).remove(); + $('#bord_' + windowviewid).remove(); + $('#crossDiv_' + windowviewid).parent().parent().remove(); + } function clearTransCanvas(windowviewid) { @@ -8342,7 +8254,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } var RGBColor = (Red + Green + Blue); - $scope.NormalTermNumber = RGBColor; $rootScope.annotationTextForTrans1 = []; var annotationText1 = $scope.GetAnnotationText(parseInt(RGBColor),windowviewid); var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); @@ -8378,8 +8289,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } var RGBColorTrans = (RedTrans + GreenTrans + BlueTrans); - $scope.TBoxTermNumber = RGBColorTrans; - + $rootScope.annotationTextForTrans2 = []; var annotationText2 = $scope.GetAnnotationText(parseInt(RGBColorTrans),windowviewid); var TermAnnotationText=$scope.GetwindowStoreData(windowviewid,'TermAnnotationText'); @@ -8389,7 +8299,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l return { annotationT1: annotationText1, - annotationT2: annotationText2 + annotationT2: annotationText2, + NormalTermNumber: RGBColor, + TBoxTermNumber: RGBColorTrans } } @@ -8475,17 +8387,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var modestyTransCanvasId = 'modestyTransCanavs_' + brId + "_" + windowviewid; if (document.getElementById(modestyTransTempCanvasId) != null) { - + var modestyTransTempCanvas = document.getElementById(modestyTransTempCanvasId); var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d'); var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height); var ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); if ($scope.GetwindowStoreData(windowviewid, 'isHighLight') == true) { - //$timeout(function () { - - //var tempTransCanvas = document.getElementById(tempCanvasID); - //var tempCanvasContext = tempTransCanvas.getContext('2d'); - + var dataURL = document.getElementById(modestyTransTempCanvasId).toDataURL(); var img = new Image(); @@ -8493,7 +8401,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l img.onload = function () { - var DAData = new BitmapData(parseInt(document.getElementById(modestyTransTempCanvasId).width), parseInt(document.getElementById(modestyTransTempCanvasId).height)); + var DAData = new BitmapData(parseInt(modestyTransTempCanvas.width), parseInt(modestyTransTempCanvas.height)); DAData.draw(img); var colorMode = $scope.applyGrayMatrix(img, tempCanvasContext); @@ -8506,10 +8414,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l ctx.putImageData(DAData.data, 0, 0); - - //black issue - var imgData = ctx.getImageData(0, 0, document.getElementById(modestyTransTempCanvasId).document.getElementById(modestyTransTempCanvasId), transCanvas.height); + var imgData = ctx.getImageData(0, 0, modestyTransTempCanvas.width,modestyTransTempCanvas.height); var data = imgData.data; var c = 0; for (var i = 0; i < data.length; i += 4) { @@ -8567,18 +8473,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#btnExtract_" + windowviewid).removeClass("disabled"); $("#btnExtract_" + windowviewid).css("pointer-events", "auto"); - $scope.removeAllTermNumberForSaveCB(windowviewid);//Calling Methode for remove Annotations Text - $('.com_anno_'+windowviewid).remove(); - - $('#sppeachBubble_annotation_'+windowviewid).remove(); - $('#dot_annotation_'+windowviewid).remove(); - $('#bord_annotation_'+windowviewid).remove(); - - $('#dot_'+windowviewid).remove(); - $('#sppeachBubble_' + windowviewid).remove(); - $('.com_'+windowviewid).remove(); - $('#bord_'+windowviewid).remove(); - + $scope.removeAllTermTpClose(windowviewid); + // clear canvas on closing of transparency box if ($rootScope.isAnnotationWindowOpen == true) { $('#canvasDA_'+windowviewid).removeLayers(); @@ -8748,7 +8644,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#OnIdentify").removeClass("annotationtoolbartab"); $("#DrawMode").removeClass("annotationtoolbartab"); $('.btnCursor').removeClass('activebtncolor'); - $(".annotationTollbar").css("display", "none"); + $("#annotationTollbar").css("display", "none"); $("#annotationButton").removeClass("active"); if ($scope.GetwindowStoreData(windowviewid,'isTransparencyBtnClicked') == true && !$scope.GetwindowStoreData(windowviewid,'isTransparencyActivated')) { $("#btnExtract_" + windowviewid).addClass("disabled"); @@ -8812,15 +8708,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#canvasDivDA_' + windowviewid).scrollLeft($('#canvasDivDA_'+windowviewid).width() / 2) } - //remove annotation speech bubble - if ($('#dot_'+windowviewid).length > 0) { - $('#dot_'+windowviewid).remove(); - } - - if ($('#sppeachBubble_'+windowviewid).length > 0) { - $('#sppeachBubble_'+windowviewid).remove(); - } - $scope.removeAllTermNumberForSaveCB(windowviewid); } @@ -9057,29 +8944,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } } - // #7972 Mozilla Firefox> Incorrect navigation - $("#canvasDiv").scroll(function (event) { - var len= (event.currentTarget.id).split("_").length; - var windowviewid = (event.currentTarget.id).split("_")[len-1]; - - var candivScrollleft=$('#canvasDivDA_' + windowviewid).scrollLeft(); - var candivScrollTop=$('#canvasDivDA_' + windowviewid).scrollTop(); - - // Fix Navigator position by CanvasDiv Scrolling - var can = $("#canvasDivDA_" + windowviewid); - var canheight = can[0].scrollHeight; - var canwidth = can[0].scrollWidth; - - var dragDivTop= (candivScrollTop/canheight)*($('#navigatorDiv_' + windowviewid).height()); - var dragDivLeft= (candivScrollleft/canwidth)*($('#navigatorDiv_' + windowviewid).width()); - - $("#draggable_" + windowviewid).css('top', dragDivTop); - $("#draggable_" + windowviewid).css('left', dragDivLeft>40?40:dragDivLeft); - - $scope.SetwindowStoreData(windowviewid,'CanvasDivLeftPosition',candivScrollleft); - $scope.SetwindowStoreData(windowviewid,'CanvasDivTopPosition',candivScrollTop); - }); - $scope.enableExtract = function (isCalledFromButton,windowviewid) { $scope.SetwindowStoreData(windowviewid, 'mode', "EXTRACT"); @@ -9831,7 +9695,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $rootScope.CloseListManager(); //Remove the Search list and then Repopulate it on change of Gender - $('#searchListDiv_' + windowviewid).empty() + $('#searchListDiv_' + windowviewid).empty(); + + var canDiv = document.getElementById('canvasDivDA_' + windowviewid); + var canDivChildCount = canDiv.childElementCount; + if (canDivChildCount > 0) { + canDiv.innerHTML = ''; + } $scope.SetwindowStoreData(windowviewid,'isGenderChnage',true); @@ -10343,9 +10213,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.mousePs; - function OnPaintCanvasClick(event) { - - } $scope.GetBodySystemData = function (currentBodyViewId,windowviewid) { var bodySystemDataPath = '~/../content/data/json/da/body-views/' + currentBodyViewId + '/da_dat_body_system_term_' + currentBodyViewId + '.json'; @@ -11283,8 +11150,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var termsTotal = '' + VocabTermTxtfilter.length + ' Structures'; $("#totalTerms").empty(); - //$('#totalTerms').innerHTML = ''; - $('#totalTerms').append(termsTotal); $scope.EnableUI(); } @@ -11423,7 +11288,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var vocabTermDataArray = $scope.GetwindowStoreData(windowviewid, 'vocabTermDataArray')[lexiconInd].vocabTermTxt; - var searchvalue = $("#typedTermName_" + windowviewid).val(); var searchfilterdata = $filter('filter')(vocabTermDataArray, searchvalue); $scope.limitTofilterdata = $filter('limitTo')(searchfilterdata, 10); @@ -11441,7 +11305,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var len= (event.currentTarget.id).split("_").length; var windowviewid = (event.currentTarget.id).split("_")[len-1]; - $scope.EnableUI(); + $scope.DisableUI(); $('#searchedTermListPopUp_' + windowviewid).css({ 'background': '#fff', 'border-radius': '3px', @@ -11452,7 +11316,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l 'width': '350px', 'position': 'absolute', 'top': '170px', - 'left': '140px', + 'left': '40%', 'display': 'none', 'z-index': '780000', 'height': 'auto !important' @@ -11486,24 +11350,49 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#searchedTermListPopUp_' + windowviewid).css('display', 'block'); $('#searchedTermListPopUp_' + windowviewid).css("visibility", "visible"); - $('#searchedTermListPopUp_' + windowviewid).draggable(); + $('#searchedTermListPopUp_' + windowviewid).draggable({containment:'#daViewDA_' + windowviewid}); - $scope.FillSearchList(windowviewid); + setTimeout(() => { + $scope.FillSearchList(windowviewid); + }, 100); + + } $scope.FillSearchList = function (windowviewid) { if ($('#searchTermListUl_' + windowviewid).html() != "") { $('#searchTermListUl_' + windowviewid).empty(); } - $rootScope.a = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd'); - $scope.vocabArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); + var primaryLexiconIndex = $scope.GetwindowStoreData(windowviewid, 'primaryLexiconInd'); + var vocabTermDataArray=$scope.GetwindowStoreData(windowviewid,'vocabTermDataArray'); - $scope.sFilter = $("#typedTermName_" + windowviewid).val(); - var $e2 = $('
  • ' + - '{{item._TermText}}' + - '
  • ').appendTo('#searchTermListUl_' + windowviewid) - $compile($e2)($scope); + var searchvalue = $("#typedTermName_" + windowviewid).val(); + var searchfilterdata = $filter('filter')(vocabTermDataArray, searchvalue); + + var totalstructures=0; + angular.forEach(searchfilterdata[primaryLexiconIndex].VocabTermData.VocabTerms.Term, function (value2, key2) { + totalstructures=totalstructures+1; + var $el = $('').appendTo('#searchTermListUl_' + windowviewid); + $compile($el)($scope); + }) + var termsTotal = '' + totalstructures + ' Structures'; + $("#totalTerms").empty(); + $('#totalTerms').append(termsTotal); + $scope.EnableUI(); + + if (navigator.userAgent.match(/(iPod|iPhone|iPad|android)/i)) { + + $(document).on("mouseover", "#searchTermListUl_" + windowviewid+ " option", function (e) { + $('#searchedTermListPopUp_' + windowviewid).draggable('disable'); + }); + $(document).on("click", ".annotation-modal-header", function (e) { + + $('#searchedTermListPopUp_' + windowviewid).draggable('enable'); + + }); + } + } $scope.closeSerachTermListPopUp = function () { @@ -11682,6 +11571,13 @@ function OnIdentifyClick() { scope.IdentifyClick(windowviewid); }); } +function onDrawingCanvasTouch(event) { + console.log('onDrawingCanvasTouch is called '); + var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); + scope.$apply(function () { + scope.onDrawingCanvasTouch(event); + }); +} function OnZoom(event) { var scope = angular.element(document.getElementsByClassName("daBodyView")).scope(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index f8b24a6..8a42871 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -2535,7 +2535,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } -//reset option when load + //reset option when load $rootScope.resetMenuOption = function () { $timeout(function () { $rootScope.panelNameWithCb=""; @@ -2732,47 +2732,38 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.ShowAnnotationWindow = function () { var modulePanel = $("#HomeContainerDiv").find("div[id*='ImagePanel']"); - if (modulePanel != undefined && modulePanel.length>0) { + if (modulePanel != undefined && modulePanel.length>0) { for (var index = 0 ; index < modulePanel.length; index++) { var paneld = modulePanel[index].id; if(paneld.match("daImagePanel")||paneld.match("AAImagePanel")||paneld.match("ciImagePanel")||paneld.match("aiImagePanel")||paneld.match("picImagePanel")) { var len = (paneld).split("_").length; var MultiWinId = (paneld).split("_")[len - 1]; - var PanelElement= $scope.GetPanelElement(paneld); - - var canvasElement = PanelElement.canvasElement; - if (canvasElement == undefined) continue; - - $scope.onDrawingCanvasOnModule(canvasElement); - + $rootScope.isAnnotatiomToolBarPopupActive = true; $rootScope.isAnnotatiomToolBarPopupClosed = false; $rootScope.isAnnotaionToolBarDrawingModeActive = false; - if ($rootScope.disableAnnotationtoolOnListManager == true) { - $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); - $('#slider-range-min-2').slider('disable'); - $("#annotationpaintbrushsize").attr('disabled', 'disabled'); - $("#annotationpainteraser").attr('disabled', 'disabled'); - - } - else { - $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); - $('#slider-range-min-2').slider('enable'); - $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); - $("#annotationpainteraser").removeAttr('disabled', 'disabled'); - } + if ($rootScope.disableAnnotationtoolOnListManager == true) { + $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').attr('disabled', 'disabled'); + $('#slider-range-min-2').slider('disable'); + $("#annotationpaintbrushsize").attr('disabled', 'disabled'); + $("#annotationpainteraser").attr('disabled', 'disabled'); + + } + else { + $('#AnnotaionPopupDiv').find('input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); + $('#slider-range-min-2').slider('enable'); + $("#annotationpaintbrushsize").removeAttr('disabled', 'disabled'); + $("#annotationpainteraser").removeAttr('disabled', 'disabled'); + } - // $("#annotationpaintbrushsize").attr("href", "#" + canvasPaintId); - // $("#annotationpainteraser").attr("href", "#" + canvasPaintId); - $("#annotationpainteraser").removeAttr('disabled', 'disabled'); + $("#annotationpainteraser").removeAttr('disabled', 'disabled'); $("#OnIdentify").addClass("annotationtoolbartab"); $rootScope.isAnnotationWindowOpen = true; - $(".annotationTollbar").css("display", "block"); - + if(paneld.match("daImagePanel")) { $rootScope.daAnnotationToolEvent(MultiWinId); @@ -2825,11 +2816,22 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data { $rootScope.picAnnotationToolEvent(MultiWinId); } + + // var PanelElement= $scope.GetPanelElement(paneld); + // var canvasElement = PanelElement.canvasElement; + // if (canvasElement == undefined) continue; + // $scope.onDrawingCanvasOnModule(canvasElement); + // $scope.removeOnDrawingCanvas(canvasElement); + } - } } + $("#annotationTollbar").modal('show'); + $(".modal-backdrop").css("z-index", "0"); + + } + var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; if ($rootScope.isFontFamilyLoaded == false) { @@ -2865,7 +2867,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#DrawMode").removeClass("annotationtoolbartab"); $('.btnCursor').removeClass('activebtncolor'); - $(".annotationTollbar").css("display", "none"); + //$(".annotationTollbar").css("display", "none"); + $("#annotationTollbar").modal('hide'); $rootScope.isAnnotationWindowClose = true; $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); @@ -2885,8 +2888,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var PanelElement= $scope.GetPanelElement(paneld); var canvasElement = PanelElement.canvasElement; $scope.removeOnDrawingCanvas(canvasElement); - - + if (paneld.match("daImagePanel")) { if ($("#transparencyScale_" + MultiWinId).css("display") == "block") { @@ -2965,6 +2967,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } $rootScope.CIAnotationIdentifyModeOff = false; + $rootScope.OnIdentifyClick = function () { //clear sketch js event for paint and erase $.sketch = { tools: {}}; @@ -2995,7 +2998,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data { var len = (paneld).split("_").length; var MultiWinId = (paneld).split("_")[len - 1]; - + $rootScope.switchCanvas(paneld); if (paneld.match("daImagePanel")) { @@ -3062,6 +3065,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } + + // remove event listener + var PanelElement= $scope.GetPanelElement(paneld); + var canvasElement = PanelElement.canvasElement; + $scope.removeOnDrawingCanvas(canvasElement); + } } } @@ -3095,14 +3104,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var MaxZindexVal = Math.max(drawCanvasZindex, paintCanvasZindex, TransCanvasZindex); MaxZindexVal = MaxZindexVal + 1; $("#" + canvasId).css("z-index", MaxZindexVal); - if ($rootScope.currentBodyViewId == "11") { - $(".ui-wrapper").css("z-index", MaxZindexVal + 1); - $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); - - } - else { - $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); - } + $(".ui-wrapper").css("z-index", MaxZindexVal + 1); + $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); + } else { var drawCanvasZindex = $("#" + canvasId).css("z-index"); @@ -3117,12 +3121,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { $("#" + canvasId).css("z-index", MaxZindexVal); - if ($rootScope.currentBodyViewId == "11") { - $(".ui-wrapper").css("z-index", MaxZindexVal); - } - else { - $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); - } + $(".ui-wrapper").css("z-index", MaxZindexVal); + $('#' + ctx.getAttribute("id")).css("z-index", MaxZindexVal); + } @@ -3168,8 +3169,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.DrawingMode = function () { - //clear sketch js event for paint and erase - $.sketch = { tools: {}}; + //clear sketch js event for paint and erase + $.sketch = { tools: {}}; //Annotation History $rootScope.isAnnotaionToolBarDrawingModeActive = true; $("#OnIdentify").removeClass("annotationtoolbartab"); @@ -3184,7 +3185,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data for (var index = 0 ; index < modulePanel.length; index++) { var paneld = modulePanel[index].id; if(paneld.match("daImagePanel")||paneld.match("AAImagePanel")||paneld.match("ciImagePanel")||paneld.match("aiImagePanel")||paneld.match("picImagePanel")) - { + { $rootScope.switchCanvas(paneld); if(paneld.match("AAImagePanel")) { @@ -3232,6 +3233,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } + + // remove event listener + var PanelElement= $scope.GetPanelElement(paneld); + var canvasElement = PanelElement.canvasElement; + $scope.removeOnDrawingCanvas(canvasElement); + } } } @@ -3240,7 +3247,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data // Dissectible Anatomy > Settings should be disable if Annotation is Open. $rootScope.ShowSettingWindow = function () { - if ($(".annotationTollbar").css("display") == "block") { + if ($("#annotationTollbar").css("display") == "block") { $('#modal-settings').css("display", "none"); $("#modelsettingsbackground").css("display", "none"); } @@ -3280,7 +3287,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -3311,7 +3318,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } - + + $scope.onDrawingCanvasOnModule(canvasElement); + } } } @@ -3361,7 +3370,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $("#" + canvasPaintId).css("display", "block"); @@ -3392,10 +3401,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#summary_' + MultiWinId).css("z-index", canvasZIndex); } - } + } + + $scope.onDrawingCanvasOnModule(canvasElement); + } - } } + } } @@ -3439,6 +3451,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } + + // remove event listener + var PanelElement= $scope.GetPanelElement(paneld); + var canvasElement = PanelElement.canvasElement; + $scope.removeOnDrawingCanvas(canvasElement); } } } @@ -3466,7 +3483,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -3499,6 +3516,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $scope.onDrawingCanvasOnModule(canvasElement); } } @@ -3523,7 +3541,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.isAnnotaionToolBarDrawingModeActive = true; @@ -3595,12 +3613,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } + // remove event listener + $scope.removeOnDrawingCanvas(canvasElement); + } } } $rootScope.EraseDrawing = function () { - $('.btnCursor').removeClass('activebtncolor'); $(".btn-annotation").removeClass("activebtncolor"); $(".btn-annotation-erase").addClass("activebtncolor"); @@ -3614,12 +3634,15 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if(paneld.match("daImagePanel")||paneld.match("AAImagePanel")||paneld.match("ciImagePanel")||paneld.match("aiImagePanel")||paneld.match("picImagePanel")) { var len = (paneld).split("_").length; - // var MultiWinId = (paneld).split("_")[len - 1]; + var MultiWinId = (paneld).split("_")[len - 1]; var PanelElement= $scope.GetPanelElement(paneld); - var canvasPaintElement = PanelElement.canvasElement; - if (canvasPaintElement == null || canvasPaintElement == undefined) continue; + var canvasElement = PanelElement.canvasElement; + if (canvasElement == null || canvasElement == undefined) continue; + + var canvasPaintElement = PanelElement.canvasElement; var canvasPaintId = canvasPaintElement.id; + $rootScope.isAnnotaionToolBarDrawingModeActive = true; $rootScope.switchCanvasToPaintCanvas(paneld); @@ -3644,6 +3667,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#annotationpainteraser").attr("data-size", parseInt($("#btnBrushSize").val())); $scope.PaintEraseEvent(); + + // remove event listener + $scope.removeOnDrawingCanvas(canvasElement); } } @@ -3680,10 +3706,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data case 'mouseup': $rootScope.UnsaveCurriculum = true; $scope.savePaintAnnotation(this.el.id,this.actions); - - case 'mouseout': - case 'mouseleave': + this.stopPainting(); + break; case 'touchend': + $rootScope.UnsaveCurriculum = true; + $scope.savePaintAnnotation(this.el.id,this.actions); + break; + case 'mouseout': + case 'mouseleave': case 'touchcancel': this.stopPainting(); } @@ -3825,7 +3855,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -3857,9 +3887,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $scope.onDrawingCanvasOnModule(canvasElement); + } - } - } + } + } } $rootScope.DrawArrow = function (e) { @@ -3884,7 +3916,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -3916,9 +3948,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $scope.onDrawingCanvasOnModule(canvasElement); + } - } - } + } + } } $rootScope.DrawText = function () { //clear sketch js event for paint and erase @@ -3942,7 +3976,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -3974,9 +4008,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $scope.onDrawingCanvasOnModule(canvasElement); + } - } - } + } + } } @@ -3999,7 +4035,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var canvasElement = PanelElement.canvasElement; if (canvasElement == null || canvasElement == undefined) continue; var canvasPaintElement = PanelElement.canvasPaintElement; - + var canvasId = canvasElement.id; var canvasPaintId = canvasPaintElement.id; $rootScope.setListManagerZindex = true; @@ -4031,9 +4067,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + $scope.onDrawingCanvasOnModule(canvasElement); + } - } - } + } + } } @@ -4071,16 +4109,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { if ($("#annotationpaintbrushsize").hasClass("activebtncolor") || $("#annotationpainteraser").hasClass("activebtncolor")) { - if ($rootScope.currentBodyViewId == "11") { $("#" + canvasPaintId).css("z-index", MaxZindexVal + 1); } - else { $("#" + canvasPaintId).css("z-index", MaxZindexVal); } + $("#" + canvasPaintId).css("z-index", MaxZindexVal + 1); } - else { - if ($rootScope.currentBodyViewId == "11") { - $("#" + canvasId).css("z-index", MaxZindexVal + 1); - } - else { - $("#" + canvasId).css("z-index", MaxZindexVal); - } + else + { + $("#" + canvasId).css("z-index", MaxZindexVal + 1); } } @@ -4170,6 +4203,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var paneld = modulePanel[index].id; if(paneld.match("daImagePanel")||paneld.match("AAImagePanel")||paneld.match("ciImagePanel")||paneld.match("aiImagePanel")||paneld.match("picImagePanel")) { + var len = (paneld).split("_").length; + var MultiWinId = (paneld).split("_")[len - 1]; + if ($("#annotationpaintbrushsize").hasClass('activebtncolor')) { $("#annotationpaintbrushsize").removeClass('activebtncolor') $rootScope.switchCanvas(paneld); @@ -4235,6 +4271,23 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } + $rootScope.changeWidthManager = function () { + var borderWidth = 2; + var borderColor = "#000"; + borderWidth = $("#borderWidthCanvasElement option:selected").val(); + $rootScope.shapestyleborderWidth = Math.round(borderWidth); + borderColor = $('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color"); + + if (borderColor != null) { + document.getElementById("imgOpacity").parentNode.style.border = borderWidth + "px" + " " + "solid" + " " + borderColor; + //$("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid" + borderColor); + } else { + + // $("#imgOpacity").parent().css("border", borderWidth + "px" + " " + "solid"); + document.getElementById("imgOpacity").parentNode.style.border = borderWidth + "px" + " " + "solid" + " " + borderColor; + + } + } $rootScope.enableAnnotationToolBar = function () { if ($rootScope.disableAnnotationTB == true) { document.getElementById('modelbackground').style.display = "none"; @@ -5174,6 +5227,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('.btnCursor').trigger('click'); $(".btn-annotation").removeClass("activebtncolor"); $('.btnCursor').addClass('activebtncolor'); + } $rootScope.DrawPinOnModuleItem = function (canvasId, PinNumber,shapestyleborderColor, shapestyleborderWidth, offsetX1, offsetY1, x, y) { @@ -6097,12 +6151,13 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data window.addEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp); window.addEventListener("touchend", $rootScope.OnPaintCanvasMouseUp); - + } } $scope.removeOnDrawingCanvas = function (annotationCanvas) { + if (annotationCanvas != null || annotationCanvas != undefined) { //remove old event listener //event code modified .work of only DA,AA,CI,AI,PIC annotationCanvas.removeEventListener("mousedown", $rootScope.OnPaintCanvasMouseDown); @@ -6111,7 +6166,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data annotationCanvas.removeEventListener("touchend", $rootScope.OnPaintCanvasMouseUp); window.removeEventListener('mouseup', $rootScope.OnPaintCanvasMouseUp); window.removeEventListener("touchend", $rootScope.OnPaintCanvasMouseUp); - + + } } @@ -6143,19 +6199,25 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var horizontlScrollPosition = canvasDiv.scrollLeft; var $ua = navigator.userAgent; if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; - $rootScope.offsetX1 = event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; - $rootScope.offsetY1 = event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + if(event.type == 'touchstart' || event.type == 'touchmove' || event.type == 'touchend' || event.type == 'touchcancel'){ + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + var touch = event.touches[0] || event.changedTouches[0]; + var verticalScrollPosition = canvasDiv.scrollTop; + var horizontlScrollPosition = canvasDiv.scrollLeft; + $rootScope.offsetX1 = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; + $rootScope.offsetY1 = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + } + } - else { + else + { $rootScope.offsetX1 = event.offsetX; $rootScope.offsetY1 = event.offsetY; } // ctx.clearRect(0, 0, 2277, 3248); - canvasElement.addEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove); - canvasElement.addEventListener("touchmove", $rootScope.OnPaintCanvasMouseMove); + canvasElement.addEventListener('mousemove', $rootScope.OnPaintCanvasMouseMove,false); + canvasElement.addEventListener("touchmove", $rootScope.OnPaintCanvasMouseMove,false); } } } @@ -6206,9 +6268,21 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; - $rootScope.x =Math.round(event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left); - $rootScope.y =Math.round(event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top); - + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + if(event.type == 'touchstart' || event.type == 'touchmove' || event.type == 'touchend' || event.type == 'touchcancel'){ + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + var touch = event.touches[0] || event.changedTouches[0]; + $rootScope.x = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; + $rootScope.y = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + } + } + else + { + $rootScope.x =Math.round(event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left); + $rootScope.y =Math.round(event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top); + } + if($rootScope.shapeType=="Rectangle"|| $rootScope.shapeType=="Circle"|| $rootScope.shapeType=="TextArea") { //birendra @@ -6235,7 +6309,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } } - + // var ctx = canvasElement.getContext("2d"); // var PaintCanvasctx = canvasPaintElement.getContext("2d"); // activate for unsave curriculum @@ -6323,8 +6397,21 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data currentCanvasId=canvasId; var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; - $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; - $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + var $ua = navigator.userAgent; + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { + if(event.type == 'touchstart' || event.type == 'touchmove' || event.type == 'touchend' || event.type == 'touchcancel'){ + // var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; + var touch = event.touches[0] || event.changedTouches[0]; + $rootScope.MouseMoveXAxis = touch.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; + $rootScope.MouseMoveYAxis = touch.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + } + + } + else + { + $rootScope.MouseMoveXAxis = event.pageX + horizontlScrollPosition - $('#' + canvasDivId).offset().left; + $rootScope.MouseMoveYAxis = event.pageY + verticalScrollPosition - $('#' + canvasDivId).offset().top; + } switch ($rootScope.shapeType) { case "Line": @@ -6455,7 +6542,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.onDrawingCanvasClick = function (event) { - if (event != undefined && (event.target.id).match("canvasDA")) { if ($rootScope.isAnnotaionToolBarDrawingModeActive == false) { @@ -6693,8 +6779,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#listManager').css('display', 'block'); $("#listManager").css("visibility", "visible"); - $('#listManager').draggable(); - + // register event for search list manager $(document).on("mouseover", "#termList option", function (e) { $('#termList option[selected="selected"]').attr("selected", false); @@ -6775,14 +6860,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if(selectedPanel.match("daImagePanel")) { - // $rootScope.$broadcast('dalistManagerEvent', windowviewid); $rootScope.dalistManagerEvent(windowviewid); $("#termList").attr("onclick", "if (typeof(this.selectedIndex) != 'undefined') onListManagerTermSelection(this.options[this.selectedIndex].id, true)"); } else if(selectedPanel.match("AAImagePanel")) { - // $rootScope.$broadcast('aalistManagerEvent', windowviewid); $rootScope.aalistManagerEvent(windowviewid); $("#termList").attr("onclick", "if (typeof(this.selectedIndex) != 'undefined') onSearchItemSelection(this.options[this.selectedIndex].id)"); @@ -6825,8 +6908,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data console.log('listManager closed'); $rootScope.disableAnnotationtoolOnListManager = false; if (paneld.match("daImagePanel") || paneld.match("AAImagePanel")) { - // $("#annotationpaintbrushsize").attr("href", "#" + canvasPaintId); - // $("#annotationpainteraser").attr("href", "#" + canvasPaintId); if ($rootScope.disableAnnotationtoolOnListManager == false) { $('#AnnotaionPopupDiv').find('a,input, textarea, button, select,img,div').removeAttr('disabled', 'disabled'); $('#slider-range-min-2').slider('enable'); @@ -6834,7 +6915,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $("#annotationpainteraser").removeAttr('disabled', 'disabled'); $("#annotationpaintbrushsize").css('pointer-events', 'auto'); $("#annotationpainteraser").css('pointer-events', 'auto'); - if ($(".annotationTollbar").css("display") == "block") { + if ($("#annotationTollbar").css("display") == "block") { $rootScope.switchCanvasToPaintCanvas(paneld); } } @@ -6865,6 +6946,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //setrtings $rootScope.SetSettingActiveTab = function (tabToSet) { $rootScope.SettingsTab = tabToSet; + if (navigator.userAgent.match(/(iPod|iPhone|iPad|android)/i)) { + $("#modal-settings").draggable('disable'); + } }; $rootScope.loadsettings = function () { @@ -7322,13 +7406,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $timeout(function () { - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - - } - else { - SetFrameToPrint(); - } + SetFrameToPrint(); }, 500); }; @@ -7367,14 +7445,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if(pageno==modulePanel.length-1) { $timeout(function () { - - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - - } - else { - SetFrameToPrint(); - } + // working for all device + SetFrameToPrint(); }, pageno * 400+500); @@ -7388,29 +7460,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data function CollectPrintData(canvasDivId, pageno, panelTitle) { // Birendra - // create page to store print image data - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - $("#" + canvasDivId).append(""); - html2canvas($("#" + canvasDivId), { - onrendered: function (canvas) { - var newWindow = window.open(''); - newWindow.document.body.appendChild(canvas); - newWindow.focus(); - newWindow.print(); - $("#" + canvasDivId).children('#exportlogo').remove(); - newWindow.close(); - - //***** old code ********/ - // var imgsrc = canvas.toDataURL("image/png"); - // var printContent = '
    '; - // var newPrintWindow = window.open(); - // $(newPrintWindow.document.body).html(printContent); - // newPrintWindow.print(); - } - }); - } - else { + // create page to store print image data for all devices html2canvas($("#" + canvasDivId), { onrendered: function (canvas) { var dataURL = canvas.toDataURL("image/jpeg"); @@ -7450,10 +7500,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } }); - - - } - } @@ -7518,10 +7564,11 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var curPosture = panelTitle; if (document.getElementById('jsPanel-1')) { + if (dataURL == "" || dataURL == undefined) { setTimeout(function () { - $("#btnPrint").attr("id", canvas.id); + // $("#btnPrint").attr("id", canvas.id.replace("#","")); document.getElementById('imgPortrait').setAttribute('src', dataURL); document.getElementById('imgLandscape').setAttribute('src', dataURL); document.getElementById('spnModulePor').innerHTML = curModule; @@ -7537,7 +7584,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } else { setTimeout(function () { - $("#btnPrint").attr("id", canvas.id); + // $("#btnPrint").attr("id", canvas.id.replace("#","")); document.getElementById('imgPortrait').setAttribute('src', dataURL); document.getElementById('imgLandscape').setAttribute('src', dataURL); @@ -7569,26 +7616,15 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } }); - $timeout(function () { - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - var printContainerWidth = $("#printcontainer").css("width"); - $("#printcontainer").css({ "width": "100%", "min-width": printContainerWidth }); - var jspanelContainerWidth = $("#jsPanel-1 .jsPanel-content").css("width"); - $("#jsPanel-1 .jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth }); - $("#jsPanel-1").css("width", "100%"); - - } - }, 500) }; $scope.printImagePreview = function (event) { - PrintDivContentByID('printBoxPor', event.target.id); + PrintDivContentByID('printBoxPor'); } - function PrintDivContentByID(id, canvasDivId) { + function PrintDivContentByID(id) { if (id == 'printBoxPor') { $("#printPSOptions").val("100%"); ResizeImage(1); @@ -7597,22 +7633,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $(document).ready(function () { contents = document.getElementById(id).innerHTML; }); - - // code for printng in ipads - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - $("#" + canvasDivId).append(""); - html2canvas($("#" + canvasDivId), { - onrendered: function (canvas) { - var imgsrc = canvas.toDataURL("image/png"); - var printContent = '
    '; - var newPrintWindow = window.open(); - $(newPrintWindow.document.body).html(printContent); - newPrintWindow.print(); - } - }); - } - else { var frame1 = $('