diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 91331af..79f4701 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -315,6 +315,30 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $('#spinner').css('visibility', 'hidden'); } + //fixing for mac os now + $scope.getOS = function () { + var userAgent = window.navigator.userAgent, + platform = window.navigator.platform, + macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], + windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], + iosPlatforms = ['iPhone', 'iPad', 'iPod'], + os = null; + + if (macosPlatforms.indexOf(platform) !== -1) { + os = 'MacOS'; + } else if (iosPlatforms.indexOf(platform) !== -1) { + os = 'iOS'; + } else if (windowsPlatforms.indexOf(platform) !== -1) { + os = 'Windows'; + } else if (/Android/.test(userAgent)) { + os = 'Android'; + } else if (!os && /Linux/.test(platform)) { + os = 'Linux'; + } + + return os; + } + $scope.openView = function ($event) { $rootScope.disableAnnotationTB = false; @@ -1697,7 +1721,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.isLayerChange = false; } - if (evt.ctrlKey) { + // for mac os Command key use for multi selection + if (evt.ctrlKey || evt.metaKey) { $rootScope.multiAnnotationIsON = true; //document.getElementById("btnZoom").setAttribute('disabled', 'disabled'); @@ -1728,9 +1753,19 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = Math.round(canvasDiv.scrollTop)-1; - var horizontlScrollPosition = Math.round(canvasDiv.scrollLeft)-1; - + //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); @@ -2116,8 +2151,9 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if ($scope.isLayerChange == true) { $scope.isLayerChange = false; } - - if (evt.ctrlKey) { + //birendra + // for mac os Command key use for multi selection + if (evt.ctrlKey || evt.metaKey) { $rootScope.multiAnnotationIsON = true; //$("#btnZoom").addClass('disabled'); @@ -2158,13 +2194,23 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // alert(mousePos.x + ',' + mousePos.y); var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; - + //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 + Math.round(horizontlScrollPosition)-1; - var actualY = mousePos.y + Math.round(verticalScrollPosition)-1; + var actulalX = mousePos.x + horizontlScrollPosition; + var actualY = mousePos.y + verticalScrollPosition; var RGBColor = $scope.GetRGBColor(maskCanvasContext, actulalX, actualY, x, y); @@ -3870,7 +3916,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // we decide the size of speech bubble //2. - if (event.ctrlKey) { + if (event.ctrlKey || event.metaKey) { console.log('ctrl pressed'); $scope.multiAnnotationIsON = true; //2.1 create unique speech bubbles @@ -3896,7 +3942,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if ($scope.speechbubbleList != null || $scope.speechbubbleList != undefined) { for (var m = 0; m <= $scope.speechbubbleList.length - 1; m++) { if ($scope.speechbubbleList[m].ids == sub_id1) { - $scope.angle1($scope.speechbubbleList[m].xaxis-0.5, $scope.speechbubbleList[m].yaxis-0.5, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id); + $scope.angle1($scope.speechbubbleList[m].xaxis, $scope.speechbubbleList[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id); break; } } @@ -3926,7 +3972,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#dot").css("visibility", "hidden"); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; - $scope.angle(x-0.5, y-0.5, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, true); }, }); $('.crossDiv_temp').on('click', function (evt) { @@ -3939,7 +3985,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l else { $scope.longest_annotationT1 = $scope.annotationTextArrayT1.reduce(function (a, b) { return a.length > b.length ? a : b; }); $scope.longest_annotationT2 = $scope.annotationTextArrayT2.reduce(function (a, b) { return a.length > b.length ? a : b; }); - if (event.ctrlKey) { + if (event.ctrlKey || event.metaKey) { $scope.j = $scope.j + 1; var sub_id_annotation = "black_annotation" + $scope.j; var pointClicked_annotation = parseInt(x) + parseInt(y); @@ -3956,7 +4002,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l if ($scope.speachBubbleArrayAnnotation != null || $scope.speachBubbleArrayAnnotation != undefined) { for (var m = 0; m <= $scope.speachBubbleArrayAnnotation.length - 1; m++) { if ($scope.speachBubbleArrayAnnotation[m].ids == sub_id1_anno) { - $scope.angle1($scope.speachBubbleArrayAnnotation[m].xaxis-0.5, $scope.speachBubbleArrayAnnotation[m].yaxis-0.5, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id_anno); + $scope.angle1($scope.speachBubbleArrayAnnotation[m].xaxis, $scope.speachBubbleArrayAnnotation[m].yaxis, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, bor_id_anno); break; } } @@ -3979,7 +4025,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $("#dot_annotation").remove(); var verticalScrollPosition = canvasDiv.scrollTop; var horizontlScrollPosition = canvasDiv.scrollLeft; - $scope.angle(x-0.5, y-0.5, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); + $scope.angle(x, y, evt.pageX + horizontlScrollPosition - $('#canvasDiv').offset().left, evt.pageY + verticalScrollPosition - $('#canvasDiv').offset().top, false); }, }); $('.crossDiv_temp_annotation').on('click', function (evt) { @@ -4030,7 +4076,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } $scope.createSpeechBubbleBasedOnAnnotationLength = function (pointClicked, x, y, id) { - var sppechBubbleHTML = "
"; + var os=$scope.getOS(); + if(os=='MacOS') + { + var sppechBubbleHTML = "
"; + } + else + { + var sppechBubbleHTML = "
"; + } //Issue #7286 :Undefined annotation should not appear for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) { var annotation = $scope.MultiLanguageAnnationArray[i]; @@ -4162,22 +4216,46 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } var Globe = []; Globe.push({ currentX: x, currentY: y }); + //changing for mac os now + var os=$scope.getOS(); + if(os=='MacOS') + { document.getElementById('dot').style.display = 'block'; - document.getElementById('dot').style.left = ((Globe[0].currentX) - 5) + 'px'; - document.getElementById('dot').style.top = ((Globe[0].currentY) + 10) + 'px'; + document.getElementById('dot').style.left = ((Globe[0].currentX) - 4) + 'px'; + document.getElementById('dot').style.top = ((Globe[0].currentY) + 10.5) + 'px'; document.getElementById('bord').style.display = 'block'; - document.getElementById('bord').style.left = ((Globe[0].currentX) - 1) + 'px'; + document.getElementById('bord').style.left = ((Globe[0].currentX) + 0.5) + 'px'; document.getElementById('bord').style.top = ((Globe[0].currentY) + 0) + 'px'; document.getElementById('sppeachBubble').style.display = 'block'; - document.getElementById('sppeachBubble').style.left = (Globe[0].currentX) + 'px'; - document.getElementById('sppeachBubble').style.top = (Globe[0].currentY) + 'px'; - - + document.getElementById('sppeachBubble').style.left = ((Globe[0].currentX) - 1) + 'px'; + document.getElementById('sppeachBubble').style.top = ((Globe[0].currentY)+0) + 'px'; + } + else + { + document.getElementById('dot').style.display = 'block'; + document.getElementById('dot').style.left = ((Globe[0].currentX) - 4) + 'px'; + document.getElementById('dot').style.top = ((Globe[0].currentY) + 11.5) + 'px'; + document.getElementById('bord').style.display = 'block'; + document.getElementById('bord').style.left = ((Globe[0].currentX) + 0.5) + 'px'; + document.getElementById('bord').style.top = ((Globe[0].currentY) + 1) + 'px'; + document.getElementById('sppeachBubble').style.display = 'block'; + document.getElementById('sppeachBubble').style.left = ((Globe[0].currentX) - 1) + 'px'; + document.getElementById('sppeachBubble').style.top = ((Globe[0].currentY)-1) + 'px'; + } + } $scope.createSpeechBubbleBasedOnTransparencyWithCtrl = function (pointClicked_annotation, Exists_annotation, x, y, sub_id_annotation) { - - var sppechBubbleHTML_annotation = "
"; + var os=$scope.getOS(); + if(os=='MacOS') + { + var sppechBubbleHTML_annotation = "
"; + } + else + { + var sppechBubbleHTML_annotation = "
"; + } + if ($scope.longest_annotationT1.length > $scope.longest_annotationT2.length) { if (Exists_annotation == 0) { $("#canvasDiv").append(sppechBubbleHTML_annotation); @@ -4363,15 +4441,34 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } var Globe = []; Globe.push({ currentX: x, currentY: y }); - document.getElementById('dot_annotation').style.display = 'block'; - document.getElementById('dot_annotation').style.left = ((Globe[0].currentX) - 5) + 'px'; - document.getElementById('dot_annotation').style.top = ((Globe[0].currentY) + 10) + 'px'; - document.getElementById('bord_annotation').style.display = 'block'; - document.getElementById('bord_annotation').style.left = ((Globe[0].currentX) - 1) + 'px'; - document.getElementById('bord_annotation').style.top = ((Globe[0].currentY) + 0) + 'px'; - document.getElementById('sppeachBubble_annotation').style.display = 'block'; - document.getElementById('sppeachBubble_annotation').style.left = (Globe[0].currentX) + 'px'; - document.getElementById('sppeachBubble_annotation').style.top = (Globe[0].currentY) + 'px'; + //changing for mac os now + var os=$scope.getOS(); + if(os=='MacOS') + { + document.getElementById('dot_annotation').style.display = 'block'; + document.getElementById('dot_annotation').style.left = ((Globe[0].currentX) - 4) + 'px'; + document.getElementById('dot_annotation').style.top = ((Globe[0].currentY) + 10.5) + 'px'; + document.getElementById('bord_annotation').style.display = 'block'; + document.getElementById('bord_annotation').style.left = ((Globe[0].currentX) + 0.5) + 'px'; + document.getElementById('bord_annotation').style.top = ((Globe[0].currentY) + 0) + 'px'; + document.getElementById('sppeachBubble_annotation').style.display = 'block'; + document.getElementById('sppeachBubble_annotation').style.left = (Globe[0].currentX - 1) + 'px'; + document.getElementById('sppeachBubble_annotation').style.top = ((Globe[0].currentY) + 0) + 'px'; + + } + else + { + document.getElementById('dot_annotation').style.display = 'block'; + document.getElementById('dot_annotation').style.left = ((Globe[0].currentX) - 4) + 'px'; + document.getElementById('dot_annotation').style.top = ((Globe[0].currentY) + 11.5) + 'px'; + document.getElementById('bord_annotation').style.display = 'block'; + document.getElementById('bord_annotation').style.left = ((Globe[0].currentX) + 0.5) + 'px'; + document.getElementById('bord_annotation').style.top = ((Globe[0].currentY) + 1) + 'px'; + document.getElementById('sppeachBubble_annotation').style.display = 'block'; + document.getElementById('sppeachBubble_annotation').style.left = (Globe[0].currentX - 1) + 'px'; + document.getElementById('sppeachBubble_annotation').style.top = ((Globe[0].currentY) - 1) + 'px'; + + } } @@ -6146,13 +6243,22 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l // alert(mousePos.x + ',' + mousePos.y); var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; - + //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 + Math.round(horizontlScrollPosition)-1; - var actualY = mousePos.y + Math.round(verticalScrollPosition)-1; //- 135; //+ tomenuBarheight + titleBarheight + searchComboheight; + var actulalX = mousePos.x + horizontlScrollPosition; + var actualY = mousePos.y + verticalScrollPosition; //- 135; //+ tomenuBarheight + titleBarheight + searchComboheight; var clickedBodyRegion; var x; var y; @@ -6354,9 +6460,19 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l var tCanvasTotalHeight = parseInt(tCanvasTopAftrSplit[0]) + parseInt(tCanvasHeightAftrSplit[0]); var mousePos = $scope.getMousePos(evt); var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; - + //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 actulalX = mousePos.x + horizontlScrollPosition; var actualY = mousePos.y + verticalScrollPosition; @@ -6455,9 +6571,19 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l function getAnnotationAndCraeteSpeechBubble(mirrorCanvasX, mirrorCanvasWidth, mousePos, maskCanvasContexttrans, clickedBodyRegion, x, y, evt) { var canvasDiv = document.getElementById('canvasDiv'); - var verticalScrollPosition = canvasDiv.scrollTop; - var horizontlScrollPosition = canvasDiv.scrollLeft; - + //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(maskCanvasContexttrans.canvas.offsetLeft) + parseInt(distanceXOnMirrorImage);