From 490b4136a4bb94bdeda30b661e03240afc956010 Mon Sep 17 00:00:00 2001 From: birendra.kumar Date: Thu, 5 Mar 2020 13:01:17 +0530 Subject: [PATCH] resolved pin draw issue with cordinate --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------- 1 file changed, 136 insertions(+), 106 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js index b0a6bb8..acf94c2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js @@ -1041,6 +1041,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou "ly": $scope.aaOpenInOtherModules.selectedCallouts[i].ly, "hx": $scope.aaOpenInOtherModules.selectedCallouts[i].hx, "lx": $scope.aaOpenInOtherModules.selectedCallouts[i].lx, + "pinId": undefined }); } @@ -1104,39 +1105,87 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins'); var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData'); - var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid,'CBselectedpinCordinate'); + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate'); - angular.forEach(clickedPins, function (value, key) { + if (CBselectedpinCordinate.length >0) + { + var pinId = CBselectedpinCordinate[0].pinId; - if (aaPinData != null && aaPinData.length > 0) { - - var pinData = new jinqJs() - .from(aaPinData) - .where("_PinId == " + value.id) - .select(); - + if (pinId == undefined) + { + angular.forEach(clickedPins, function (value, key) { - var headX = (parseInt(pinData[0]._HeadX)); - var headY = (parseInt(pinData[0]._HeadY)); - var pinId = (parseInt(pinData[0]._PinId)); + if (aaPinData != null && aaPinData.length > 0) { - // match pin data by hx and hy CB cordinate to show annotation - var matchdata=new jinqJs() - .from(CBselectedpinCordinate) - .where("hx == " + headX,"hy == " + headY) - .select(); - - if(matchdata.length>0) - { - $scope.MultiLanguageAnnationArray = []; - - $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId,windowviewid); - - $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10,matchdata[0].lx,matchdata[0].ly, pinId, false, false, false,windowviewid); - } + var pinData = new jinqJs() + .from(aaPinData) + .where("_PinId == " + value.id) + .select(); + + + var headX = (parseInt(pinData[0]._HeadX)); + var headY = (parseInt(pinData[0]._HeadY)); + var pinId = (parseInt(pinData[0]._PinId)); + + // match pin data by hx and hy CB cordinate to show annotation + var matchdata = new jinqJs() + .from(CBselectedpinCordinate) + .where("hx == " + headX, "hy == " + headY) + .select(); + + if (matchdata.length > 0) { + + var updatedata = new jinqJs() + .from(CBselectedpinCordinate) + .update(function (coll, index) { coll[index].pinId = pinId; }) + .at("hx == " + headX, "hy == " + headY); + + $scope.MultiLanguageAnnationArray = []; + + $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId, windowviewid); + + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, matchdata[0].lx, matchdata[0].ly, pinId, false, false, false, windowviewid); + } + } + + }); } + else { + + angular.forEach(clickedPins, function (value, key) { + + if (aaPinData != null && aaPinData.length > 0) { + + var pinData = new jinqJs() + .from(aaPinData) + .where("_PinId == " + value.id) + .select(); + + + var headX = (parseInt(pinData[0]._HeadX)); + var headY = (parseInt(pinData[0]._HeadY)); + var pinId = (parseInt(pinData[0]._PinId)); + + // match pin data by hx and hy CB cordinate to show annotation + var matchdata = new jinqJs() + .from(CBselectedpinCordinate) + .where("pinId == " + pinId) + .select(); - }); + if (matchdata.length > 0) { + $scope.MultiLanguageAnnationArray = []; + + $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId, windowviewid); + + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, matchdata[0].lx, matchdata[0].ly, pinId, false, false, false, windowviewid); + } + } + + }); + } + + } + $scope.SetAAwindowStoreData(windowviewid,'isShowBodyWithCBPinData',false); $rootScope.AAWindowLoadComplete=true; @@ -1796,15 +1845,20 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou } //Save Cordinate for show annotation as per Pin - var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate'); - CBselectedpinCordinate.push( - { - "hy": headY, - "ly": headY, - "hx": headX, - "lx": headX, - "pinId": value._PinId - }); + + if ($rootScope.isCallFromOtherModule) { + + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate'); + CBselectedpinCordinate.push( + { + "hy": headY, + "ly": headY+10, + "hx": headX, + "lx": headX+30, + "pinId": value._PinId + }); + } + }) } @@ -1980,7 +2034,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou var isShowBodyWithCBPinData=$scope.GetAAwindowStoreData(windowviewid,'isShowBodyWithCBPinData'); var speechBubbleHTML = '' - + '
' + + '
' + '' + '
' @@ -2013,51 +2067,6 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) { $("#"+speechbubbleDivId).css("min-width", "auto"); $("#"+speechbubbleDivId).css("white-space", "nowrap"); - // if ($scope.longestAnnotation.length <= 10) { - - - // $("#"+speechbubbleDivId).css("width", "100px"); - - // } - - // else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) { - - - - // $("#"+speechbubbleDivId).css("width", "140px"); - - // } - // else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) { - - - // $("#"+speechbubbleDivId).css("width", "195px"); - - // } - // else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) { - - // $("#"+speechbubbleDivId).css("width", "248px"); - - // } - // else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) { - - - // $("#"+speechbubbleDivId).css("width", "300px"); - // } - - // else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) { - - // $("#"+speechbubbleDivId).css("width", "370px"); - // } - - // else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) { - // $("#"+speechbubbleDivId).css("width", "450px"); - // } - // else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) { - // $("#"+speechbubbleDivId).css("width", "510px"); - // } - // else { - // $("#"+speechbubbleDivId).css("width", ($scope.longestAnnotation.length) + "%"); - // } } } var speechBubbleDims = []; @@ -2084,7 +2093,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou "speechBuubleId": speechbubbleDivId, "speechBubbleLineId": speechBubbleLineDivId, "currentX": x, - "currentY": y + "currentY": y, + "pinId": PinId }); } @@ -2096,7 +2106,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou "speechBuubleId": speechbubbleDivId, "speechBubbleLineId": speechBubbleLineDivId, "currentX": x, - "currentY": y + "currentY": y, + "pinId": PinId }); } @@ -2111,7 +2122,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou document.getElementById(speechBubbleLineDivId).style.top = ((speechBubbleDims[0].currentY)) + 'px'; } document.getElementById(speechbubbleDivId).style.display = 'block'; - document.getElementById(speechbubbleDivId).style.left = (speechBubbleDims[0].currentX - 4) + 'px'; + document.getElementById(speechbubbleDivId).style.left = (speechBubbleDims[0].currentX +20) + 'px'; document.getElementById(speechbubbleDivId).style.top = (speechBubbleDims[0].currentY) + 'px'; if (isShowBodyWithCBPinData == true) { @@ -2134,7 +2145,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou if (speechBubbleDimaensions[i].speechBuubleId == speechbubbleDivId) { speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleDraggedLineID; - $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, bulleleft+20 , bulletop+20 , true,windowviewid); + $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, bulleleft + 20, bulletop + 20, true,windowviewid); } } @@ -2162,16 +2173,38 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou $("#speechBubbleLine" + sppechBubbleId).css("display", "none"); var speechBubbleDimaensions=$scope.GetAAwindowStoreData(windowviewid,'speechBubbleDimaensions'); - + for (var i = 0; i <= speechBubbleDimaensions.length - 1; i++) { if (speechBubbleDimaensions[i].speechBuubleId == clickedSpeechBubbleId) { speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleDraggedLineID; - $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, evt.pageX + horizontlScrollPosition - $('#canvasAADiv_'+windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasAADiv_'+windowviewid).offset().top, true,windowviewid); + $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, evt.pageX + horizontlScrollPosition - $('#canvasAADiv_' + windowviewid).offset().left, evt.pageY + verticalScrollPosition - $('#canvasAADiv_' + windowviewid).offset().top, true, windowviewid); } - } + } }, + stop: function (evt) { + + var clickedSpeechBubbleId = $(this).attr("id"); + var len = (clickedSpeechBubbleId).split("_").length; + var windowviewid = (clickedSpeechBubbleId).split("_")[len - 1]; + var sppechBubbleId = $(this).attr("id").substring(12); + var PinId = sppechBubbleId.split("_")[0]; + + if ($rootScope.isCallFromOtherModule) { + $timeout(function () { + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate'); + var BubleObj = document.getElementById(clickedSpeechBubbleId); + var CBselectedpinCordinate = new jinqJs() + .from(CBselectedpinCordinate) + .update(function (coll, index) { coll[index].lx = BubleObj.offsetLeft; coll[index].ly = BubleObj.offsetTop; }) + .at("pinId == " + PinId); + + }, 100); + + } + } + }); $('.crossDiv_temp').on('click', function (evt) { @@ -2184,22 +2217,18 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou var pinId = imgDivId.substring(8, imgDivId.length); $('#speechBubble' + pinId+'_'+windowviewid).remove(); $("#speechBubbleDraggedLine" + pinId+'_'+windowviewid).remove(); - $("#speechBubbleLine" + pinId+'_'+windowviewid).remove(); - - //make all pin heads grey - // var pinHeadName = 'PinArc_' + pinId; - // var radial = $('#aaDetailViewCanvas_'+windowviewid).createGradient({ - // x1: 50, y1: 50, - // x2: 50, y2: 50, - // r1: 10, r2: 30, - // c1: 'rgba(100, 50, 0,0)', - // c2: 'rgb(216, 216, 216)' - // }); - - - // $('#aaDetailViewCanvas_'+windowviewid).setLayer(pinHeadName, { - // fillStyle: radial, - // }).drawLayers(); + $("#speechBubbleLine" + pinId + '_' + windowviewid).remove(); + + if ($rootScope.isCallFromOtherModule) { + var CBselectedpinCordinate = []; + CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate'); + CBselectedpinCordinate = new jinqJs() + .from(CBselectedpinCordinate) + .delete().at("pinId == " + pinId).select(); + + $scope.SetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate', CBselectedpinCordinate); + } + }); //make the head green @@ -2267,7 +2296,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou else { $("#bord_annotation").css({ 'display': 'block', 'width': d + 'px', 'top': e + 'px', 'left': f + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' }); } - + } @@ -2315,6 +2344,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou if (clickedPin.event.ctrlKey == false) { $scope.SetAAwindowStoreData(windowviewid, 'clickedPins', []); $scope.SetAAwindowStoreData(windowviewid, 'selectedPins', []); + $scope.SetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate', []); } var pinID = (clickedPin.name).substring(7, (clickedPin.name).length); var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData'); -- libgit2 0.21.4