Commit ad1243e3aad1f0c2104b7a4fa4ad350587f71472

Authored by Amrita Vishnoi
1 parent ce674f5c

Navigator man is integrated in all body views

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -73,6 +73,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
73 73 $rootScope.isNormalMode = false;
74 74 $rootScope.isZoomed = false;
75 75  
  76 + //navigator man functionality
  77 + $scope.NavOrientationdata;
  78 + $scope.NavigatorData;
  79 + $scope.navimgsrc;
  80 +
  81 + $scope.dragdivleft = 0;
  82 + $scope.dragdivtop = 0;
  83 +
  84 + $scope.dragdivposition = {
  85 + "left": $scope.dragdivleft,
  86 + "top": $scope.dragdivtop
  87 + };
  88 +
  89 +
76 90 //array for bodyviewid correspoing to male female(used for gender change)
77 91 $scope.correspondingBodyViewIds = {
78 92 '1': '5',
... ... @@ -463,9 +477,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
463 477 // debugger
464 478 if ($scope.isBodylayerdataLoaded) {
465 479 $timeout(function () {
466   - //this is for showing termlist on da-view
  480 +
  481 + //1.this is for showing termlist on da-view
467 482 $scope.isVisibleTermddl = false;
  483 +
  484 + //2. Load Canvas Image
468 485 $scope.LoadDefaultLayerImage();
  486 +
  487 + //3. Load Navigator Image
  488 + $scope.LoadBodyViewNavigatorImage();
  489 +
469 490 }, 350);
470 491 }
471 492 },
... ... @@ -492,6 +513,51 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
492 513  
493 514 })
494 515  
  516 + //Code for displaying NavigatorImage for BodyView
  517 + $scope.LoadBodyViewNavigatorImage = function () {
  518 + //load json containing navigator images
  519 + $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_orient_image.json' }).success(function (data) {
  520 + $scope.NavigatorData = data;
  521 +
  522 + $scope.skinTone = DA[0].ethnicity;
  523 +
  524 + var navdtlOrient = new jinqJs()
  525 + .from($scope.NavigatorData.Navigtor.ViewOrientation)
  526 + .where("_ViewOrientationId == " + $rootScope.currentBodyViewId)
  527 + .select();
  528 + console.log(navdtlOrient);
  529 + console.log(navdtlOrient[0].ImageInfo);
  530 + var navOrientationdata = new jinqJs()
  531 + .from(navdtlOrient[0].ImageInfo)
  532 + .where("_Ethnicity == " + $scope.skinTone)
  533 + .select();
  534 + //console.log(navOrientationdata);
  535 +
  536 + $scope.NavOrientationdata = navOrientationdata;
  537 + console.log("$scope.NavOrientationdata: ");
  538 + console.log($scope.NavOrientationdata);
  539 +
  540 + var navimagemodesty;
  541 +
  542 + angular.forEach($scope.NavOrientationdata, function (value, key) {
  543 + if (value._HaveModesty === DA[0].modesty) {
  544 + navimagemodesty = value._ImageName;
  545 + }
  546 + })
  547 + if (typeof (navimagemodesty) === "undefined" || navimagemodesty === null) {
  548 +
  549 + navimagemodesty = $scope.NavOrientationdata[0]._ImageName;
  550 +
  551 + }
  552 +
  553 + $scope.navimgsrc = "~/../content/images/DA/ethnicity/body-views/" + $scope.voId + '/' + $scope.skinTone + '/navigator_images/' + navimagemodesty;
  554 +
  555 + })
  556 + .error(function (data, status, headers, config) {
  557 + console.log(data);
  558 + });
  559 + }
  560 +
495 561  
496 562 $scope.LoadDefaultLayerImage = function () {
497 563 // debugger;
... ... @@ -805,6 +871,37 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
805 871 // #4976 :While changing gender male to female scroll bar is going on top.
806 872 var canvasDiv = document.getElementById('canvasDiv');
807 873 canvasDiv.scrollTop = 0;
  874 +
  875 + //Navigator Code for dynamically calculating the height and width of Dragable Div on Navigator Image
  876 +
  877 + var dragdivh = Math.floor(($('#canvasDiv').height() / $('#canvasDiv')[0].scrollHeight) * 119) //119px is the height of the image
  878 +
  879 + if ($('#canvasDiv')[0].scrollWidth > $('#canvasDiv')[0].clientWidth) {
  880 +
  881 + var dragdivw = 42
  882 + $scope.dragdivleft = 21;
  883 + $scope.dragdivtop = 0;
  884 +
  885 + $scope.dragdivposition = {
  886 + "left": 21,
  887 + "top": 0
  888 + };
  889 + }
  890 + else {
  891 + var dragdivw = 83;
  892 +
  893 + $scope.dragdivleft = 0;
  894 + $scope.dragdivtop = 0;
  895 +
  896 + $scope.dragdivposition = {
  897 + "left": 0,
  898 + "top": 0
  899 +
  900 + };
  901 + }
  902 +
  903 + $('#draggable').css('width', dragdivw);
  904 + $('#draggable').css('height', dragdivh)
808 905 }
809 906  
810 907 function scaleRectangle(x, y, height, width, mirrorValue) {
... ... @@ -4974,6 +5071,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
4974 5071  
4975 5072 }
4976 5073  
  5074 + //Function to set the vertical and horizontal scroll position of CanvasDiv as per the Navigator
  5075 + $scope.ScrollCanvasDiv = function () {
  5076 +
  5077 + var x = $("#draggable").position();
  5078 + var can = $('#canvasDiv');
  5079 + var canheight = can[0].scrollHeight;
  5080 + var canwidth = can[0].scrollWidth;
  5081 +
  5082 + var scrolly = (x.top / ($('#containment-wrapper').height())) * (canheight);
  5083 +
  5084 + var scrollx = (x.left / $('#containment-wrapper').width()) * (canwidth);
  5085 +
  5086 + $("#canvasDiv").scrollTop(scrolly);
  5087 + $("#canvasDiv").scrollLeft(scrollx);
  5088 +
  5089 + $timeout(function () { $scope.HighlightBodyByTermList(systemMatchedTermList) }, 100);
  5090 +
  5091 + }
  5092 +
4977 5093 //list manager
4978 5094 $scope.$on('listManagerEvent', function (event, data) {
4979 5095 // debugger;
... ...