No illustration found for the selected search criteria!
');
}
$timeout(function () {
$scope.EnableUI();
$scope.ResetGridListLength();
}, 500);
},
function (error) {
$timeout(function () { $scope.EnableUI(); }, 500);
console.log(' error: ' + error.statusText);
}
)
}
$scope.ResetGridListLength=function()
{
var $ua = navigator.userAgent;
if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {
if(screen.height<=768)
{
$('#ListViewDiv').css({"height":"300","overflow":"scroll"});
$('#grid-view').css({"height":"535","overflow":"scroll"});
}
else if(screen.height<=1024)
{
$('#ListViewDiv').css({"height":"460","overflow":"scroll"});
$('#grid-view').css({"height":"720","overflow":"scroll"});
}
else
{
$('#ListViewDiv').css({"height":"880","overflow":"scroll"});
$('#grid-view').css({"height":"950","overflow":"scroll"});
}
}
else
{
$('#ListViewDiv').css({"height":"490","overflow":"scroll"});
$('#grid-view').css({"height":"720","overflow":"scroll"});
}
}
$scope.Reset = function (moduleId, query,windowviewid) {
$scope.DisableUI();
if(windowviewid==undefined) // call from also home controller list manager
windowviewid= $rootScope.MULTI_VIEW_ID;
query.selectedbodyregion = "";
query.selectedbodysystem = "";
query.selectedorientation = "";
query.selectedimagetype = "";
query.selectedspecialty = "";
//set localstorage values
localStorage.setItem("CurrentBodyRegion", '');
localStorage.setItem("CurrentBodySystem", '');
localStorage.setItem("CurrentOrientation", '');
localStorage.setItem("CurrentImageType", '');
if ($('.selected').hasClass("selected")) { $('.selected').removeClass("selected"); }
$('#ListViewDiv').scrollTop(0);
if ($('#demoView').length > 0)
$('#demoView').remove();
$scope.filterstring = false;
setTimeout(function(){
$scope.FilterSearch(1, query,windowviewid)
},200)
}
$scope.showSelectedSystemPins = function (event,windowviewid) {
if (typeof event == "object") {
var len= (event.target.parentElement.parentElement.id).split("_").length;
var windowviewid = (event.target.parentElement.parentElement.id).split("_")[len-1];
if (event.currentTarget.title == $("#bodySystemList_" + windowviewid + " li.activeAASystemSelect a").attr("title")) {
}
else {
$rootScope.UnsaveCurriculum =true;
var id = event.currentTarget.id;
$scope.SetAAwindowStoreData(windowviewid,'typeOfEvent',typeof event);
var SelectedSystemID = event.currentTarget.id;
var SelectedSystemTitle = event.currentTarget.title;
if (event.currentTarget.title == "Current Structure") {
$scope.SetAAwindowStoreData(windowviewid, 'SelectedSystemID', 0);
}
else {
$scope.SetAAwindowStoreData(windowviewid,'clickedPins',[]);
$scope.SetAAwindowStoreData(windowviewid, 'activePinArray', []);
$scope.SetAAwindowStoreData(windowviewid, 'selectedPins', []);
$scope.SetAAwindowStoreData(windowviewid, 'SelectedSystemID', id);
}
var isHidePinBtnClicked=$scope.GetAAwindowStoreData(windowviewid,'isHidePinBtnClicked');
$scope.SetAAwindowStoreData(windowviewid,'isBodySystemSelected',true);
var bodySystemListObj = document.getElementById("bodySystemList_" + windowviewid ).getElementsByTagName("a");
var bodySystemListlength = bodySystemListObj.length;
for (var i = 0; i < bodySystemListlength; i++) {
$(bodySystemListObj[i].parentElement).removeClass("activeAASystemSelect");
//add class for selected element
if(i==SelectedSystemID)
{
$(bodySystemListObj[i].parentElement).addClass("activeAASystemSelect");
}
}
$scope.DisableUI();
$scope.removeSpeechBubble(windowviewid);
if (SelectedSystemID == "0") {
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemName',null);
if (isHidePinBtnClicked) {
$scope.showAllPinsAfterHide(windowviewid);
}
else {
//#30499 : Atlas Anatomy > All Pins are not appeared on the body system even after selecting the Body System: All
$('#aaDetailViewCanvas_'+windowviewid).removeLayers();
$scope.showAllPins(windowviewid);
}
}
else {
var selectedSystemName = SelectedSystemTitle;
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemName',selectedSystemName);
//on gettng all required data, draw pins
var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData');
if (aaPinData != null && aaPinData.length > 0) {
var selectedSystemPinData = new jinqJs()
.from(aaPinData)
.where("_BodySystemName == " + selectedSystemName)
.select();
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemPinData',selectedSystemPinData);
if (isHidePinBtnClicked) {
$scope.showAllPinsAfterHide(windowviewid);
}
else {
//remove other system pins
if (selectedSystemPinData != null && selectedSystemPinData.length > 0) {
angular.forEach(aaPinData, function (aaPinDataValue, aaPinDataKey) {
if (aaPinDataValue._BodySystemName != selectedSystemName) {
$scope.removePin('aaDetailViewCanvas_'+windowviewid, aaPinDataValue._PinId,windowviewid);
}
})
angular.forEach(selectedSystemPinData, function (value, key) {
$scope.drawStaticPinsOnImage('aaDetailViewCanvas_'+windowviewid, value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY,windowviewid)
});
// make all pin heads grey
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).setLayers({
fillStyle: radial,
}).drawLayers();
//show annotation on first pin of the sysyem
$scope.showAnnotation(selectedSystemPinData, false, false, false,false,windowviewid);
var annotationTopPos = $(".common-drag").css("top").split("p");
$("#canvasAADiv_" + windowviewid).scrollTop(annotationTopPos[0]);
}
}
}
}
}
}
else {
var SelectedSystemID = event;
$scope.SetAAwindowStoreData(windowviewid,'typeOfEvent',typeof event);
var bodySystemListObj = document.getElementById("bodySystemList_" + windowviewid ).getElementsByTagName("a");
var bodySystemListlength = bodySystemListObj.length;
for (var i = 0; i < bodySystemListlength; i++) {
$(bodySystemListObj[i].parentElement).removeClass("activeAASystemSelect");
//add class for selected element
if(i==SelectedSystemID)
{
$(bodySystemListObj[i].parentElement).addClass("activeAASystemSelect");
}
}
var SelectedSystemTitle = $("#bodySystemList_" + windowviewid + " li.activeAASystemSelect a").attr("title");
$scope.DisableUI();
var isHidePinBtnClicked=$scope.GetAAwindowStoreData(windowviewid,'isHidePinBtnClicked');
$scope.removeSpeechBubble(windowviewid);
if (SelectedSystemID == "0") {
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemName',null);
if (isHidePinBtnClicked) {
$scope.showAllPinsAfterHide(windowviewid);
}
else {
$scope.showAllPins(windowviewid);
}
}
else {
var selectedSystemName = SelectedSystemTitle;
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemName',selectedSystemName);
//on gettng all required data, draw pins
var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData');
if (aaPinData != null && aaPinData.length > 0) {
var selectedSystemPinData = new jinqJs()
.from(aaPinData)
.where("_BodySystemName == " + selectedSystemName)
.select();
var oldSelectedSystemId = $scope.GetAAwindowStoreData(windowviewid, 'SelectedSystemID');
if(oldSelectedSystemId!=SelectedSystemID)
{
$scope.SetAAwindowStoreData(windowviewid,'clickedPins',[]);
$scope.SetAAwindowStoreData(windowviewid, 'activePinArray', []);
$scope.SetAAwindowStoreData(windowviewid, 'selectedPins', []);
$scope.SetAAwindowStoreData(windowviewid, 'SelectedSystemID', SelectedSystemID);
}
var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins');
if(clickedPins.length>0)
{
var pintToshowSelected = new jinqJs()
.from(selectedSystemPinData)
.where("_PinId == " + clickedPins[0].id)
.select();
}
else{
var pintToshowSelected=selectedSystemPinData;
}
$scope.SetAAwindowStoreData(windowviewid,'selectedSystemPinData',selectedSystemPinData);
if (isHidePinBtnClicked) {
$scope.showAllPinsAfterHide(windowviewid);
}
else {
//remove other system pins
if (selectedSystemPinData != null && selectedSystemPinData.length > 0) {
angular.forEach(aaPinData, function (aaPinDataValue, aaPinDataKey) {
if (aaPinDataValue._BodySystemName != selectedSystemName)
$scope.removePin('aaDetailViewCanvas_'+windowviewid, aaPinDataValue._PinId,windowviewid);
})
angular.forEach(selectedSystemPinData, function (value, key) {
$scope.drawStaticPinsOnImage('aaDetailViewCanvas_'+windowviewid, value._PinId, value._PinX, value._PinY, value._HeadX, value._HeadY,windowviewid)
});
// make all pin heads grey
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).setLayers({
fillStyle: radial,
}).drawLayers();
//show annotation on first pin of the sysyem
$scope.showAnnotation(pintToshowSelected, false, false, false,true,windowviewid);
}
}
}
}
}
}
$scope.showAnnotation = function (selectedPinData, isCtrlPressed, isPinClicked, isItemSearched,isResize,windowviewid) {
var isSameTermWithMultiPin = false;
var firstPinId = selectedPinData[0]._PinId;
var pinTermNumber = selectedPinData[0]._TermId;
var isBodySystemSelected= $scope.GetAAwindowStoreData(windowviewid,'isBodySystemSelected');
//check if other pin have same termNumber
var aaPinData = $scope.GetAAwindowStoreData(windowviewid,'aaPinData');
if (aaPinData != null && aaPinData.length > 0) {
var pinDataWithFirstTermNumber = new jinqJs()
.from(aaPinData)
.where("_TermId == " + pinTermNumber)
.select();
var activePinArray=$scope.GetAAwindowStoreData(windowviewid,'activePinArray');
for (var i = 0; i <= pinDataWithFirstTermNumber.length - 1; i++) {
var pinvalue='PinArc_' + pinDataWithFirstTermNumber[i]._PinId;
var isFound = jQuery.inArray(pinvalue, activePinArray)
if (isFound == -1) {
activePinArray.push('PinArc_' + pinDataWithFirstTermNumber[i]._PinId);
}
}
$scope.MultiLanguageAnnationArray = [];
$scope.GetAnnotationBasedOnActualTermNo(pinTermNumber,windowviewid);
if (isCtrlPressed) {
}
else {
if (isPinClicked || isItemSearched) {
var existingSpeechBubble = $("div[id*='speechBubble']");
for (var i = 0; i < existingSpeechBubble.length; i++) {
var len= (existingSpeechBubble[i].id).split("_").length;
var winid = (existingSpeechBubble[i].id).split("_")[len-1];
if(winid==windowviewid)
{
existingSpeechBubble[i].parentNode.removeChild(existingSpeechBubble[i]);
//make all pin heads grey
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).setLayers({
fillStyle: radial,
}).drawLayers();
}
}
var existingSpeechBubbleLine = $("div[id*='speechBubbleLine']");
for (var i = 0; i < existingSpeechBubbleLine.length; i++) {
var len= (existingSpeechBubbleLine[i].id).split("_").length;
var winid = (existingSpeechBubbleLine[i].id).split("_")[len-1];
if(winid==windowviewid)
{
existingSpeechBubbleLine[i].parentNode.removeChild(existingSpeechBubbleLine[i]);
}
}
var speechBubbleDraggedLine = $("div[id*='speechBubbleDraggedLine']");
for (var i = 0; i < speechBubbleDraggedLine.length; i++) {
var len= (speechBubbleDraggedLine[i].id).split("_").length;
var winid = (speechBubbleDraggedLine[i].id).split("_")[len-1];
if(winid==windowviewid)
{
speechBubbleDraggedLine[i].parentNode.removeChild(speechBubbleDraggedLine[i]);
}
}
}
}
if (pinDataWithFirstTermNumber.length > 1) {
isSameTermWithMultiPin = true;
}
var selectedPins=$scope.GetAAwindowStoreData(windowviewid,'selectedPins');
var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins');
angular.forEach(pinDataWithFirstTermNumber, function (value, key) {
if (isBodySystemSelected == true) {
clickedPins.push({ 'id': value._PinId });
//selectedPins.push(value._PinId);
$scope.SetAAwindowStoreData(windowviewid,'isBodySystemSelected',false);
}
var headX = (parseInt(value._HeadX));
var headY = (parseInt(value._HeadY));
$scope.createSpeechBubble(parseInt(headX) + 10, parseInt(headY) + 10,0,0, value._PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin,windowviewid);
// remove annotation/speechBubble while resize
if(isResize)
{
$scope.removeSpeechBubble(windowviewid);
}
//Save Cordinate for show annotation as per Pin
if ($rootScope.isCallFromOtherModule) {
var CBselectedpinCordinate = $scope.GetAAwindowStoreData(windowviewid, 'CBselectedpinCordinate');
CBselectedpinCordinate.push(
{
"hy": headY,
"ly": headY+10,
"hx": headX,
"lx": headX+30,
"pinId": value._PinId
});
}
})
}
$scope.EnableUI();
}
$scope.removeSpeechBubble = function (windowviewid) {
//clear speech bubbles
var speechBubbles = $("div[id*='speechBubble']");
if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
for (var j = 0; j < speechBubbles.length; j++) {
var len= (speechBubbles[j].id).split("_").length;
var winid = (speechBubbles[j].id).split("_")[len-1];
if(winid==windowviewid)
{
speechBubbles[j].parentNode.removeChild(speechBubbles[j]);
}
}
}
var speechBubbleLines = $("div[id*='speechBubbleLine']");
if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
for (var j = 0; j < speechBubbleLines.length; j++) {
var len= (speechBubbleLines[j].id).split("_").length;
var winid = (speechBubbleLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
speechBubbleLines[j].parentNode.removeChild(speechBubbleLines[j]);
}
}
}
var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
var len= (speechBubbleDraggedLines[j].id).split("_").length;
var winid = (speechBubbleDraggedLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
speechBubbleDraggedLines[j].parentNode.removeChild(speechBubbleDraggedLines[j]);
}
}
}
};
$scope.showSpeechBubble = function (windowviewid) {
//clear speech bubbles
var speechBubbles = $("div[id*='speechBubble']");
if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
for (var j = 0; j < speechBubbles.length; j++) {
var len= (speechBubbles[j].id).split("_").length;
var winid = (speechBubbles[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbles[j].id).style.visibility = 'visible';
}
}
}
var speechBubbleLines = $("div[id*='speechBubbleLine']");
if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
for (var j = 0; j < speechBubbleLines.length; j++) {
var len= (speechBubbleLines[j].id).split("_").length;
var winid = (speechBubbleLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbleLines[j].id).style.visibility = 'visible';
}
}
}
var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
var len= (speechBubbleDraggedLines[j].id).split("_").length;
var winid = (speechBubbleDraggedLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbleDraggedLines[j].id).style.visibility = 'visible';
}
}
}
};
$scope.hideSpeechBubble = function (windowviewid) {
//clear speech bubbles
var speechBubbles = $("div[id*='speechBubble']");
if (speechBubbles != null || speechBubbles != undefined && speechBubbles.length > 0) {
for (var j = 0; j < speechBubbles.length; j++) {
var len= (speechBubbles[j].id).split("_").length;
var winid = (speechBubbles[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbles[j].id).style.visibility = 'hidden';
}
}
}
var speechBubbleLines = $("div[id*='speechBubbleLine']");
if (speechBubbleLines != null || speechBubbleLines != undefined && speechBubbleLines.length > 0) {
for (var j = 0; j < speechBubbleLines.length; j++) {
var len= (speechBubbleLines[j].id).split("_").length;
var winid = (speechBubbleLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbleLines[j].id).style.visibility = 'hidden';
}
}
}
var speechBubbleDraggedLines = $("div[id*='speechBubbleDraggedLine']");
if (speechBubbleDraggedLines != null || speechBubbleDraggedLines != undefined && speechBubbleDraggedLines.length > 0) {
for (var j = 0; j < speechBubbleDraggedLines.length; j++) {
var len= (speechBubbleDraggedLines[j].id).split("_").length;
var winid = (speechBubbleDraggedLines[j].id).split("_")[len-1];
if(winid==windowviewid)
{
document.getElementById(speechBubbleDraggedLines[j].id).style.visibility = 'hidden';
}
}
}
};
$scope.createSpeechBubble = function (x, y,lx,ly, PinId, isCtrlPressed, isPinClicked, isSameTermWithMultiPin,windowviewid) {
$scope.longestAnnotation = $scope.MultiLanguageAnnationArray.reduce(function (firstAnnotation, seconAnnotation) { return firstAnnotation.length > seconAnnotation.length ? firstAnnotation : seconAnnotation; });
$scope.createSpeechBubbleBasedOnAnnotationLength(x, y,lx,ly, PinId,windowviewid);
// birendra
//
$scope.ShowHideAnnotationText(windowviewid);
}
$scope.createSpeechBubbleBasedOnAnnotationLength = function (x, y, lx, ly, PinId, windowviewid) {
var prctValue = $scope.GetAAwindowStoreData(windowviewid,'sliderPercentValue');
x = x * prctValue;
y = y * prctValue;
if ($("#canvasAADiv_" + windowviewid).find("div").length > 0) {
$("#canvasAADiv_" + windowviewid).find("div").each(function () {
var str = $(this).attr("id");
if (str.substr(0, 16) == "speechBubbleLine") {
str = (str).split("_")[0];
var res = str.substr(16);
if (res == PinId) {
$scope.isAnnotationDivAlreadyPresent = false;
}
else {
$scope.isAnnotationDivAlreadyPresent = true;
}
}
});
}
else {
$scope.isAnnotationDivAlreadyPresent = true;
}
if ($scope.isAnnotationDivAlreadyPresent == true) {
var isShowBodyWithCBPinData=$scope.GetAAwindowStoreData(windowviewid,'isShowBodyWithCBPinData');
var speechBubbleHTML = ''
+ '
'
+ ''
+ '
'
+ '
'
+ '
';
//Issue #7286 :Undefined annotation should not appear
var speechbubbleDivId="speechBubble" + PinId +'_'+windowviewid;
var speechBubbleLineDivId="speechBubbleLine" + PinId +'_'+windowviewid ;
for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
var MultipleLanguage = $scope.MultiLanguageAnnationArray[i];
}
if (MultipleLanguage == undefined) {
console.log("No text is found");
} else {
$("#canvasAADiv_" + windowviewid).append(speechBubbleHTML);
if ($scope.MultiLanguageAnnationArray.length > 0) {
for (var i = 0; i <= $scope.MultiLanguageAnnationArray.length - 1; i++) {
var MultipleLanguage = $scope.MultiLanguageAnnationArray[i];
$("#"+speechbubbleDivId).append("
" + MultipleLanguage + "
");
}
}
else {
console.log('MultiLanguageAnnationArray.length is :' + $scope.MultiLanguageAnnationArray.length)
}
if ($scope.longestAnnotation != null || $scope.longestAnnotation != undefined) {
$("#"+speechbubbleDivId).css("min-width", "auto");
$("#"+speechbubbleDivId).css("white-space", "nowrap");
}
}
var speechBubbleDims = [];
var speechBubbleDimaensions=$scope.GetAAwindowStoreData(windowviewid,'speechBubbleDimaensions');
if(speechBubbleDimaensions.length>0)
{
var ismatch=false;
for (var i = 0; i <= speechBubbleDimaensions.length - 1; i++) {
if (speechBubbleDimaensions[i].speechBuubleId == speechbubbleDivId) {
speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleLineDivId;
speechBubbleDimaensions[i].currentX =x;
speechBubbleDimaensions[i].currentY =y;
ismatch=true;
}
}
if(ismatch==false)
{
speechBubbleDimaensions.push(
{
"speechBuubleId": speechbubbleDivId,
"speechBubbleLineId": speechBubbleLineDivId,
"currentX": x,
"currentY": y,
"pinId": PinId
});
}
}
else
{
speechBubbleDimaensions.push(
{
"speechBuubleId": speechbubbleDivId,
"speechBubbleLineId": speechBubbleLineDivId,
"currentX": x,
"currentY": y,
"pinId": PinId
});
}
speechBubbleDims.push({ currentX: x, currentY: y });
document.getElementById(speechBubbleLineDivId).style.display = 'block';
document.getElementById(speechBubbleLineDivId).style.left = ((speechBubbleDims[0].currentX - 12)) + 'px';
var sliderVal=$scope.GetAAwindowStoreData(windowviewid,'sliderVal');
if (sliderVal == 25) {
document.getElementById(speechBubbleLineDivId).style.top = ((speechBubbleDims[0].currentY + 5)) + 'px';
}
else {
document.getElementById(speechBubbleLineDivId).style.top = ((speechBubbleDims[0].currentY)) + 'px';
}
document.getElementById(speechbubbleDivId).style.display = 'block';
document.getElementById(speechbubbleDivId).style.left = (speechBubbleDims[0].currentX +20) + 'px';
document.getElementById(speechbubbleDivId).style.top = (speechBubbleDims[0].currentY) + 'px';
if (isShowBodyWithCBPinData == true) {
document.getElementById(speechbubbleDivId).style.left = (lx) + 'px';
document.getElementById(speechbubbleDivId).style.top = (ly) + 'px';
var bubble = document.getElementById(speechbubbleDivId);
var bulleleft=bubble.offsetLeft;
var bulletop=bubble.offsetTop;
var sppechBubbleId = PinId +'_'+windowviewid;
var speechBubbleDraggedLineID = "speechBubbleDraggedLine" + sppechBubbleId;
$("#speechBubbleLine" + sppechBubbleId).css("visibility", "hidden");
$("#speechBubbleLine" + sppechBubbleId).css("display", "none");
for (var i = 0; i <= speechBubbleDimaensions.length - 1; i++) {
if (speechBubbleDimaensions[i].speechBuubleId == speechbubbleDivId) {
speechBubbleDimaensions[i].speechBubbleLineId =speechBubbleDraggedLineID;
$scope.angle(speechBubbleDraggedLineID, speechBubbleDimaensions[i].currentX, speechBubbleDimaensions[i].currentY, bulleleft + 20, bulletop + 20, true,windowviewid);
}
}
}
}
$('.common-drag').draggable(
{
containment: '#canvasAADiv_' + windowviewid,
drag: function (evt) {
//stop: function (evt) {
var clickedSpeechBubbleId = $(this).attr("id");
var len= (clickedSpeechBubbleId).split("_").length;
var windowviewid = (clickedSpeechBubbleId).split("_")[len-1];
var verticalScrollPosition = document.getElementById('canvasAADiv_'+windowviewid).scrollTop;
var horizontlScrollPosition = document.getElementById('canvasAADiv_' + windowviewid).scrollLeft;
var leftpos=evt.pageX + horizontlScrollPosition - $('#canvasAADiv_' + windowviewid).offset().left;
var toptpos=evt.pageY + verticalScrollPosition - $('#canvasAADiv_' + windowviewid).offset().top;
if(leftpos<5 || toptpos<5)
{
evt.preventDefault();
}
//Calling Method to save ScrollPosition for Save CB
$scope.SetAAwindowStoreData(windowviewid, 'verticalScroll', verticalScrollPosition);
$scope.SetAAwindowStoreData(windowviewid, 'horizontalScroll', horizontlScrollPosition);
var sppechBubbleId = $(this).attr("id").substring(12);
var speechBubbleDraggedLineID = "speechBubbleDraggedLine" + sppechBubbleId;
$("#speechBubbleLine" + sppechBubbleId).css("visibility", "hidden");
$("#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, leftpos,toptpos, 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) {
$rootScope.UnsaveCurriculum = true;
$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) {
var imgId = $(this).attr("id");
var len= (imgId).split("_").length;
var windowviewid = (imgId).split("_")[len-1];
var imgDivId=(imgId).split("_")[0];
var pinId = imgDivId.substring(8, imgDivId.length);
$('#speechBubble' + pinId+'_'+windowviewid).remove();
$("#speechBubbleDraggedLine" + pinId+'_'+windowviewid).remove();
$("#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);
$rootScope.UnsaveCurriculum = true;
}
});
//make the head green
var radialAfterClick = $('#aaDetailViewCanvas_'+windowviewid).createGradient({
x1: 50, y1: 50,
x2: 50, y2: 50,
r1: 10, r2: 30,
c1: 'rgba(100, 50, 0,0)',
c2: 'rgb(126, 187, 83)'
});
var pinHeadName = 'PinArc_' + PinId;
$('#aaDetailViewCanvas_'+windowviewid).setLayer(pinHeadName, {
fillStyle: radialAfterClick,
}).drawLayers();
var typeOfEvent=$scope.GetAAwindowStoreData(windowviewid,'typeOfEvent');
if (typeOfEvent == "string") {
var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins');
for (var i = 0; i <= clickedPins.length - 1; i++) {
var pinHeadName = 'PinArc_' + clickedPins[i].id;
$('#aaDetailViewCanvas_'+windowviewid).setLayer(pinHeadName, {
fillStyle: radialAfterClick,
}).drawLayers();
}
}
}
$scope.angle = function (dragLineId, cx, cy, ex, ey, BoolValues,windowviewid) {
var dy = ey - cy;
var dx = ex - cx;
var theta = 0;
if (dx < 0) {
theta = Math.atan(dy / dx) * (180 / Math.PI);
theta = theta + 180;
}
else if (dy < 0) {
theta = Math.atan(dy / dx) * (180 / Math.PI);
theta = theta + 360;
}
else {
theta = Math.atan(dy / dx) * (180 / Math.PI);
}
var d = Math.sqrt((cx - ex) * (cx - ex) + (cy - ey) * (cy - ey));
var e = cy;
var f = cx;
if (BoolValues == true) {
var sliderVal=$scope.GetAAwindowStoreData(windowviewid,'sliderVal');
if (sliderVal == 40) {
$("#" + dragLineId).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 5) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
}
else if (sliderVal == 25) {
$("#" + dragLineId).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 2) + 'px', 'left': (f - 2) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
}
else {
$("#" + dragLineId).css({ 'display': 'block', 'width': d + 'px', 'top': (e - 10) + 'px', 'left': (f - 5) + 'px', 'transform': 'rotate(' + theta + 'deg)', '-moz-transform': 'rotate(' + theta + 'deg)', '-webkit-transform': 'rotate(' + theta + 'deg)', 'transform-origin': '0% 0%' });
}
}
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%' });
}
}
$scope.drawStaticPinsOnImage = function (canvasId, PinId, offsetX1, offsetY1, x, y,windowviewid) {
var slidpercentValue= $scope.GetAAwindowStoreData(windowviewid,'sliderPercentValue');
var multipliedByValue = 5;
var $ua = navigator.userAgent;
if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {
multipliedByValue = 10;
}
console.log('isSliderrChange')
var radial = $('#' + canvasId).createGradient({
x1: 50, y1: 50,
x2: 50, y2: 50,
r1: 10, r2: 30,
c1: 'rgba(100, 50, 0,0)',
c2: 'rgb(216, 216, 216)'
});
$('#' + canvasId).drawLine({
layer: true,
name: "Pin_" + PinId,
groups: ["Pin_" + PinId],
strokeStyle: '#565656',
strokeWidth: 2,
visible: true,
x1: offsetX1 * slidpercentValue, y1: offsetY1 * slidpercentValue,
x2: x * slidpercentValue, y2: y * slidpercentValue,
}).drawArc({
name: "PinArc_" + PinId,
layer: true,
groups: ["Pin_" + PinId],
strokeStyle: 'grey',
strokeWidth: 2,
visible: true,
fillStyle: radial,
x: x * slidpercentValue, y: y * slidpercentValue,
radius: 10,
click: function (clickedPin) {
$rootScope.UnsaveCurriculum =true;
//birendra
// for mac os Command key use for multi selection
if (clickedPin.event.ctrlKey == false && clickedPin.event.metaKey == 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');
var pinData = new jinqJs()
.from(aaPinData)
.where("_PinId == " + pinID)
.select();
var pinTermNumber = pinData[0]._TermId;
var pinWithSameTerm = new jinqJs()
.from(aaPinData)
.where("_TermId == " + pinTermNumber)
.select();
if (pinWithSameTerm != undefined && pinWithSameTerm != null && pinWithSameTerm.length > 0) {
var selectedPins = $scope.GetAAwindowStoreData(windowviewid, 'selectedPins');
var clickedPins=$scope.GetAAwindowStoreData(windowviewid,'clickedPins');
for (var i = 0; i < pinWithSameTerm.length; i++) {
clickedPins.push({ 'id': pinWithSameTerm[i]._PinId });
selectedPins.push(pinWithSameTerm[i]._PinId);
}
}
$scope.SetAAwindowStoreData(windowviewid,'isSelectedPinBtnClickedAftrSliderCange',false);
var selectedPinData = new jinqJs()
.from(aaPinData)
.where("_PinId == " + pinID)
.select();
var activePinArray=$scope.GetAAwindowStoreData(windowviewid,'activePinArray');
if (clickedPin.event.ctrlKey == true||clickedPin.event.metaKey == true) {
var isFound = jQuery.inArray(clickedPin.name, activePinArray)
if (isFound == -1) {
activePinArray.push(clickedPin.name);
}
var radialAfterClick = $('#aaDetailViewCanvas_' + windowviewid).createGradient({
x1: 50, y1: 50,
x2: 50, y2: 50,
r1: 10, r2: 30,
c1: 'rgba(100, 50, 0,0)',
c2: 'rgb(126, 187, 83)'
});
clickedPin.fillStyle = radialAfterClick;
$scope.showAnnotation(selectedPinData, true, true, false,false, windowviewid);
}
else {
$scope.SetAAwindowStoreData(windowviewid,'activePinArray',[]);
var activePin = [];
activePin.push(clickedPin.name);
$scope.SetAAwindowStoreData(windowviewid,'activePinArray',activePin);
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).setLayers({
fillStyle: radial,
}).drawLayers();
//change the head color to green
var radialAfterClick = $('#aaDetailViewCanvas_' + windowviewid).createGradient({
x1: 50, y1: 50,
x2: 50, y2: 50,
r1: 10, r2: 30,
c1: 'rgba(100, 50, 0,0)',
c2: 'rgb(126, 187, 83)'
});
clickedPin.fillStyle = radialAfterClick;
$scope.showAnnotation(selectedPinData, false, true, false,false, windowviewid);
}
}
}).drawLayers();
}
$scope.getMousePos = function (evt) {
return {
x: Math.round(evt.pageX - $('#canvasDiv').offset().left),
y: Math.round(evt.pageY - $('#canvasDiv').offset().top)
}
}
$scope.removePin = function (canvasId, pinId,windowviewid) {
var pinName = 'Pin_' + pinId;
var pinArcName = 'PinArc_' + pinId;
$('#' + canvasId).removeLayer(pinName).drawLayers();
$('#' + canvasId).removeLayer(pinArcName).drawLayers();
$scope.removeSpeechBubble(windowviewid);
}
$rootScope.aaAnnotationToolEvent = function (windowviewid) {
$('#editstylebackgroundcolor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(255,255,255)")
$('#editstylebackgroundcolor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
$('#outlineColor .minicolors >.minicolors-swatch > .minicolors-swatch-color').css("background-color", "rgb(0,0,0)")
$('#outlineColor .minicolors >.minicolors-panel > .minicolors-grid >.minicolors-picker').css({ "top": "145px", "left": "4px" });
$('#canvasAA_'+windowviewid).css("display", "block");
$('#canvasPaintAA_'+windowviewid).css("display", "block");
}
$rootScope.aaloadSearchData = function (windowviewid) {
var imageId= $scope.GetAAwindowStoreData(windowviewid,'imageId');
var promise = ModuleService.getTermTextDataForAAImage(imageId)
.then(
function (response) {
var AAPinTermData = response.data.PinTermData.TermData;
$scope.SetAAwindowStoreData(windowviewid,'AAPinTermData',AAPinTermData)
$scope.EnableUI();
$scope.SetAAwindowStoreData(windowviewid,'pinTermData',[]);
var primaryLexicon = $rootScope.lexiconLanguageArray[0].id;
var matchedLanguageTermData = new jinqJs()
.from(AAPinTermData)
.where('_LanguageId == ' + primaryLexicon)
.select();
var sortedTermTextArray = [];
for (var i = 0; i < matchedLanguageTermData.length; i++) {
sortedTermTextArray.push(matchedLanguageTermData[i]._TermText);
sortedTermTextArray.sort();
}
var pinTermData=$scope.GetAAwindowStoreData(windowviewid,'pinTermData');
for (var i = 0; i <= sortedTermTextArray.length - 1; i++) {
for (var j = 0; j <= matchedLanguageTermData.length - 1; j++) {
if (matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) {
pinTermData.push({ "LanguageId": matchedLanguageTermData[j]._LanguageId, "TermNumber": matchedLanguageTermData[j]._TermNumber, "TermTxt": matchedLanguageTermData[j]._TermText });
break;
}
}
}
$("#AABodySystems").empty();
$("#bodySystems").css("display", "none");
$("#AABodySystems").css("display", "block");
$("#bodySystemList_" + windowviewid + " li a").each(function (key, value) {
var sysid= $(this).attr('id') + '_' +windowviewid;
if ($(this).parent().hasClass("disabledSelectedSystem")) {
var $systemOptions = $('').appendTo("#AABodySystems")
$compile($systemOptions)($scope);
}
else{
var $systemOptions = $('').appendTo("#AABodySystems")
$compile($systemOptions)($scope);
}
});
$scope.$watch('pinTermData', function (newValue, oldValue, scope) {
$('#termlistfilter_' + windowviewid).empty();
if (pinTermData.length > 0) {
$timeout(function () {
console.log('pinTermData= ' + pinTermData.length);
$('#termList').empty();
$('#termlistfilter_' + windowviewid).empty();
for (var j = 0; j < pinTermData.length; j++) {
var $el = $('