Commit 490b4136a4bb94bdeda30b661e03240afc956010

Authored by Birendra Kumar
1 parent d6dbb32a

resolved pin draw issue with cordinate

400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... ... @@ -1041,6 +1041,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1041 1041 "ly": $scope.aaOpenInOtherModules.selectedCallouts[i].ly,
1042 1042 "hx": $scope.aaOpenInOtherModules.selectedCallouts[i].hx,
1043 1043 "lx": $scope.aaOpenInOtherModules.selectedCallouts[i].lx,
  1044 + "pinId": undefined
1044 1045 });
1045 1046  
1046 1047 }
... ... @@ -1104,39 +1105,87 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1104 1105  
1105 1106 var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins');
1106 1107 var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData');
1107   - var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid,'CBselectedpinCordinate');
  1108 + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
1108 1109  
1109   - angular.forEach(clickedPins, function (value, key) {
  1110 + if (CBselectedpinCordinate.length >0)
  1111 + {
  1112 + var pinId = CBselectedpinCordinate[0].pinId;
1110 1113  
1111   - if (aaPinData != null && aaPinData.length > 0) {
1112   -
1113   - var pinData = new jinqJs()
1114   - .from(aaPinData)
1115   - .where("_PinId == " + value.id)
1116   - .select();
1117   -
  1114 + if (pinId == undefined)
  1115 + {
  1116 + angular.forEach(clickedPins, function (value, key) {
1118 1117  
1119   - var headX = (parseInt(pinData[0]._HeadX));
1120   - var headY = (parseInt(pinData[0]._HeadY));
1121   - var pinId = (parseInt(pinData[0]._PinId));
  1118 + if (aaPinData != null && aaPinData.length > 0) {
1122 1119  
1123   - // match pin data by hx and hy CB cordinate to show annotation
1124   - var matchdata=new jinqJs()
1125   - .from(CBselectedpinCordinate)
1126   - .where("hx == " + headX,"hy == " + headY)
1127   - .select();
1128   -
1129   - if(matchdata.length>0)
1130   - {
1131   - $scope.MultiLanguageAnnationArray = [];
1132   -
1133   - $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId,windowviewid);
1134   -
1135   - $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10,matchdata[0].lx,matchdata[0].ly, pinId, false, false, false,windowviewid);
1136   - }
  1120 + var pinData = new jinqJs()
  1121 + .from(aaPinData)
  1122 + .where("_PinId == " + value.id)
  1123 + .select();
  1124 +
  1125 +
  1126 + var headX = (parseInt(pinData[0]._HeadX));
  1127 + var headY = (parseInt(pinData[0]._HeadY));
  1128 + var pinId = (parseInt(pinData[0]._PinId));
  1129 +
  1130 + // match pin data by hx and hy CB cordinate to show annotation
  1131 + var matchdata = new jinqJs()
  1132 + .from(CBselectedpinCordinate)
  1133 + .where("hx == " + headX, "hy == " + headY)
  1134 + .select();
  1135 +
  1136 + if (matchdata.length > 0) {
  1137 +
  1138 + var updatedata = new jinqJs()
  1139 + .from(CBselectedpinCordinate)
  1140 + .update(function (coll, index) { coll[index].pinId = pinId; })
  1141 + .at("hx == " + headX, "hy == " + headY);
  1142 +
  1143 + $scope.MultiLanguageAnnationArray = [];
  1144 +
  1145 + $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId, windowviewid);
  1146 +
  1147 + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, matchdata[0].lx, matchdata[0].ly, pinId, false, false, false, windowviewid);
  1148 + }
  1149 + }
  1150 +
  1151 + });
1137 1152 }
  1153 + else {
  1154 +
  1155 + angular.forEach(clickedPins, function (value, key) {
  1156 +
  1157 + if (aaPinData != null && aaPinData.length > 0) {
  1158 +
  1159 + var pinData = new jinqJs()
  1160 + .from(aaPinData)
  1161 + .where("_PinId == " + value.id)
  1162 + .select();
  1163 +
  1164 +
  1165 + var headX = (parseInt(pinData[0]._HeadX));
  1166 + var headY = (parseInt(pinData[0]._HeadY));
  1167 + var pinId = (parseInt(pinData[0]._PinId));
  1168 +
  1169 + // match pin data by hx and hy CB cordinate to show annotation
  1170 + var matchdata = new jinqJs()
  1171 + .from(CBselectedpinCordinate)
  1172 + .where("pinId == " + pinId)
  1173 + .select();
1138 1174  
1139   - });
  1175 + if (matchdata.length > 0) {
  1176 + $scope.MultiLanguageAnnationArray = [];
  1177 +
  1178 + $scope.GetAnnotationBasedOnActualTermNo(pinData[0]._TermId, windowviewid);
  1179 +
  1180 + $scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10, matchdata[0].lx, matchdata[0].ly, pinId, false, false, false, windowviewid);
  1181 + }
  1182 + }
  1183 +
  1184 + });
  1185 + }
  1186 +
  1187 + }
  1188 +
1140 1189  
1141 1190 $scope.SetAAwindowStoreData(windowviewid,'isShowBodyWithCBPinData',false);
1142 1191 $rootScope.AAWindowLoadComplete=true;
... ... @@ -1796,15 +1845,20 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1796 1845 }
1797 1846  
1798 1847 //Save Cordinate for show annotation as per Pin
1799   - var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
1800   - CBselectedpinCordinate.push(
1801   - {
1802   - "hy": headY,
1803   - "ly": headY,
1804   - "hx": headX,
1805   - "lx": headX,
1806   - "pinId": value._PinId
1807   - });
  1848 +
  1849 + if ($rootScope.isCallFromOtherModule) {
  1850 +
  1851 + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
  1852 + CBselectedpinCordinate.push(
  1853 + {
  1854 + "hy": headY,
  1855 + "ly": headY+10,
  1856 + "hx": headX,
  1857 + "lx": headX+30,
  1858 + "pinId": value._PinId
  1859 + });
  1860 + }
  1861 +
1808 1862 })
1809 1863  
1810 1864 }
... ... @@ -1980,7 +2034,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
1980 2034 var isShowBodyWithCBPinData=$scope.GetAAwindowStoreData(windowviewid,'isShowBodyWithCBPinData');
1981 2035  
1982 2036 var speechBubbleHTML = '<div id="speechBubbleLine' + PinId +'_'+windowviewid+ '" style="position:absolute;height:15px;width:35px;display:none;z-index:13000;border-top:2px solid #000;transform:rotate(40deg);-moz-transform:rotate(40deg);-o-transform:rotate(40deg);-ms-transform:rotate(40deg);-webkit-transform:rotate(40deg);"></div>'
1983   - + '<div id="speechBubble' + PinId +'_'+windowviewid+ '" class="common-drag" style="height:auto!important;z-index:13000;margin-left:25px;border:1px solid #000;padding:5px 10px;position:absolute;color:#fff;text-align:left;font-size:12px;background-color:#19100e;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;-o-border-radius:5px;-ms-border-radius:5px;font-weight:bold;">'
  2037 + + '<div id="speechBubble' + PinId +'_'+windowviewid+ '" class="common-drag" style="height:auto!important;z-index:13000;margin-left:0px;border:1px solid #000;padding:5px 10px;position:absolute;color:#fff;text-align:left;font-size:12px;background-color:#19100e;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;-o-border-radius:5px;-ms-border-radius:5px;font-weight:bold;">'
1984 2038 + '<span style="position:absolute;right:-3px;top:-4px;color:#ffffff;cursor:pointer;">'
1985 2039 + '<img id="closeBtn' + PinId +'_'+windowviewid+ '" class="crossDiv_temp" style="width:18px" src=' + $rootScope.closeBtnImgPath + '></span></div>'
1986 2040  
... ... @@ -2013,51 +2067,6 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2013 2067 if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) {
2014 2068 $("#"+speechbubbleDivId).css("min-width", "auto");
2015 2069 $("#"+speechbubbleDivId).css("white-space", "nowrap");
2016   - // if ($scope.longestAnnotation.length <= 10) {
2017   -
2018   -
2019   - // $("#"+speechbubbleDivId).css("width", "100px");
2020   -
2021   - // }
2022   -
2023   - // else if ($scope.longestAnnotation.length > 10 && $scope.longestAnnotation.length <= 17) {
2024   -
2025   -
2026   -
2027   - // $("#"+speechbubbleDivId).css("width", "140px");
2028   -
2029   - // }
2030   - // else if ($scope.longestAnnotation.length > 17 && $scope.longestAnnotation.length <= 26) {
2031   -
2032   -
2033   - // $("#"+speechbubbleDivId).css("width", "195px");
2034   -
2035   - // }
2036   - // else if ($scope.longestAnnotation.length > 26 && $scope.longestAnnotation.length <= 34) {
2037   -
2038   - // $("#"+speechbubbleDivId).css("width", "248px");
2039   -
2040   - // }
2041   - // else if ($scope.longestAnnotation.length > 34 && $scope.longestAnnotation.length <= 44) {
2042   -
2043   -
2044   - // $("#"+speechbubbleDivId).css("width", "300px");
2045   - // }
2046   -
2047   - // else if ($scope.longestAnnotation.length > 44 && $scope.longestAnnotation.length <= 54) {
2048   -
2049   - // $("#"+speechbubbleDivId).css("width", "370px");
2050   - // }
2051   -
2052   - // else if ($scope.longestAnnotation.length > 54 && $scope.longestAnnotation.length <= 69) {
2053   - // $("#"+speechbubbleDivId).css("width", "450px");
2054   - // }
2055   - // else if ($scope.longestAnnotation.length > 69 && $scope.longestAnnotation.length <= 75) {
2056   - // $("#"+speechbubbleDivId).css("width", "510px");
2057   - // }
2058   - // else {
2059   - // $("#"+speechbubbleDivId).css("width", ($scope.longestAnnotation.length) + "%");
2060   - // }
2061 2070 }
2062 2071 }
2063 2072 var speechBubbleDims = [];
... ... @@ -2084,7 +2093,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2084 2093 "speechBuubleId": speechbubbleDivId,
2085 2094 "speechBubbleLineId": speechBubbleLineDivId,
2086 2095 "currentX": x,
2087   - "currentY": y
  2096 + "currentY": y,
  2097 + "pinId": PinId
2088 2098 });
2089 2099 }
2090 2100  
... ... @@ -2096,7 +2106,8 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2096 2106 "speechBuubleId": speechbubbleDivId,
2097 2107 "speechBubbleLineId": speechBubbleLineDivId,
2098 2108 "currentX": x,
2099   - "currentY": y
  2109 + "currentY": y,
  2110 + "pinId": PinId
2100 2111 });
2101 2112 }
2102 2113  
... ... @@ -2111,7 +2122,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2111 2122 document.getElementById(speechBubbleLineDivId).style.top = ((speechBubbleDims[0].currentY)) + 'px';
2112 2123 }
2113 2124 document.getElementById(speechbubbleDivId).style.display = 'block';
2114   - document.getElementById(speechbubbleDivId).style.left = (speechBubbleDims[0].currentX - 4) + 'px';
  2125 + document.getElementById(speechbubbleDivId).style.left = (speechBubbleDims[0].currentX +20) + 'px';
2115 2126 document.getElementById(speechbubbleDivId).style.top = (speechBubbleDims[0].currentY) + 'px';
2116 2127  
2117 2128 if (isShowBodyWithCBPinData == true) {
... ... @@ -2134,7 +2145,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2134 2145 if (speechBubbleDimaensions[i].speechBuubleId == speechbubbleDivId) {
2135 2146 speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleDraggedLineID;
2136 2147  
2137   - $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, bulleleft+20 , bulletop+20 , true,windowviewid);
  2148 + $scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, bulleleft + 20, bulletop + 20, true,windowviewid);
2138 2149 }
2139 2150 }
2140 2151  
... ... @@ -2162,16 +2173,38 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2162 2173 $("#speechBubbleLine" + sppechBubbleId).css("display", "none");
2163 2174  
2164 2175 var speechBubbleDimaensions=$scope.GetAAwindowStoreData(windowviewid,'speechBubbleDimaensions');
2165   -
  2176 +
2166 2177 for (var i = 0; i <= speechBubbleDimaensions.length - 1; i++) {
2167 2178 if (speechBubbleDimaensions[i].speechBuubleId == clickedSpeechBubbleId) {
2168 2179 speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleDraggedLineID;
2169 2180  
2170   - $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);
  2181 + $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);
2171 2182 }
2172   - }
  2183 + }
2173 2184  
2174 2185 },
  2186 + stop: function (evt) {
  2187 +
  2188 + var clickedSpeechBubbleId = $(this).attr("id");
  2189 + var len = (clickedSpeechBubbleId).split("_").length;
  2190 + var windowviewid = (clickedSpeechBubbleId).split("_")[len - 1];
  2191 + var sppechBubbleId = $(this).attr("id").substring(12);
  2192 + var PinId = sppechBubbleId.split("_")[0];
  2193 +
  2194 + if ($rootScope.isCallFromOtherModule) {
  2195 + $timeout(function () {
  2196 + var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
  2197 + var BubleObj = document.getElementById(clickedSpeechBubbleId);
  2198 + var CBselectedpinCordinate = new jinqJs()
  2199 + .from(CBselectedpinCordinate)
  2200 + .update(function (coll, index) { coll[index].lx = BubleObj.offsetLeft; coll[index].ly = BubleObj.offsetTop; })
  2201 + .at("pinId == " + PinId);
  2202 +
  2203 + }, 100);
  2204 +
  2205 + }
  2206 + }
  2207 +
2175 2208 });
2176 2209  
2177 2210 $('.crossDiv_temp').on('click', function (evt) {
... ... @@ -2184,22 +2217,18 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2184 2217 var pinId = imgDivId.substring(8, imgDivId.length);
2185 2218 $('#speechBubble' + pinId+'_'+windowviewid).remove();
2186 2219 $("#speechBubbleDraggedLine" + pinId+'_'+windowviewid).remove();
2187   - $("#speechBubbleLine" + pinId+'_'+windowviewid).remove();
2188   -
2189   - //make all pin heads grey
2190   - // var pinHeadName = 'PinArc_' + pinId;
2191   - // var radial = $('#aaDetailViewCanvas_'+windowviewid).createGradient({
2192   - // x1: 50, y1: 50,
2193   - // x2: 50, y2: 50,
2194   - // r1: 10, r2: 30,
2195   - // c1: 'rgba(100, 50, 0,0)',
2196   - // c2: 'rgb(216, 216, 216)'
2197   - // });
2198   -
2199   -
2200   - // $('#aaDetailViewCanvas_'+windowviewid).setLayer(pinHeadName, {
2201   - // fillStyle: radial,
2202   - // }).drawLayers();
  2220 + $("#speechBubbleLine" + pinId + '_' + windowviewid).remove();
  2221 +
  2222 + if ($rootScope.isCallFromOtherModule) {
  2223 + var CBselectedpinCordinate = [];
  2224 + CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
  2225 + CBselectedpinCordinate = new jinqJs()
  2226 + .from(CBselectedpinCordinate)
  2227 + .delete().at("pinId == " + pinId).select();
  2228 +
  2229 + $scope.SetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate', CBselectedpinCordinate);
  2230 + }
  2231 +
2203 2232 });
2204 2233  
2205 2234 //make the head green
... ... @@ -2267,7 +2296,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2267 2296 else {
2268 2297 $("#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%' });
2269 2298 }
2270   -
  2299 +
2271 2300 }
2272 2301  
2273 2302  
... ... @@ -2315,6 +2344,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou
2315 2344 if (clickedPin.event.ctrlKey == false) {
2316 2345 $scope.SetAAwindowStoreData(windowviewid, 'clickedPins', []);
2317 2346 $scope.SetAAwindowStoreData(windowviewid, 'selectedPins', []);
  2347 + $scope.SetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate', []);
2318 2348 }
2319 2349 var pinID = (clickedPin.name).substring(7, (clickedPin.name).length);
2320 2350 var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData');
... ...