Commit 96414ebd34922c0ffd9d73bc1515d54e358729c5

Authored by Nikita Kulshreshtha
1 parent 4cc0f451

issue in transaprency scale position and in lateral arm transparency.

Identity button functionality is implemented.
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -26,22 +26,22 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
26 26 $scope.isBodyRegionDataLoaded = false;
27 27 $scope.showme = false;
28 28 $scope.IsVisible = function () {
29   - $scope.scroll();
  29 + $scope.scroll();
30 30  
31   - }
  31 + }
32 32  
33   - $scope.scroll = function () {
34   - // $window.scrollTo(0, 0);
35   - $("html,body").scrollTop(0);
36   - //alert("scroll");
  33 + $scope.scroll = function () {
  34 + // $window.scrollTo(0, 0);
  35 + $("html,body").scrollTop(0);
  36 + //alert("scroll");
37 37 }
38 38  
39 39  
40 40 //get the DA body view list based on selected gender
41   - //get the DA body view list based on selected gender
  41 + //get the DA body view list based on selected gender
42 42 $scope.getDAViewList = function ($event) {
43 43  
44   - // debugger;
  44 + // debugger;
45 45 if ($('#MainImage') != null) {
46 46 $('#MainImage').remove();
47 47 }
... ... @@ -120,7 +120,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
120 120  
121 121  
122 122 $scope.openView = function ($event) {
123   - // debugger;
  123 + // debugger;
124 124 $rootScope.currentBodyViewId = $event.currentTarget.id;
125 125 $rootScope.ViewTitle = $event.currentTarget.textContent;
126 126  
... ... @@ -152,8 +152,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
152 152 });
153 153  
154 154  
155   - // $('#daLoaderLabel').css('visibility', 'hidden')
156   - $rootScope.isLoading = false;
  155 + // $('#daLoaderLabel').css('visibility', 'hidden')
  156 + $rootScope.isLoading = false;
157 157  
158 158 $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) {
159 159 $scope.TermNumberData = data;
... ... @@ -209,7 +209,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
209 209 //}
210 210 //else
211 211 //{
212   - layerJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
  212 + layerJsonPath = '~/../content/data/json/da/bodyView/' + currentBodyViewId + '/da_dat_layer_' + currentBodyViewId + '.json';
213 213 //}
214 214  
215 215  
... ... @@ -236,13 +236,13 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
236 236  
237 237 //load vocabterm data
238 238 //$http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) {
239   - $http({ method: 'GET', url: path }).success(function (data){
  239 + $http({ method: 'GET', url: path }).success(function (data){
240 240  
241   - $scope.VocabTermData = data;
  241 + $scope.VocabTermData = data;
242 242 })
243   - .error(function (data, status, headers, config) {
244   - console.log(data);
245   - });
  243 + .error(function (data, status, headers, config) {
  244 + console.log(data);
  245 + });
246 246  
247 247 var openViews;
248 248  
... ... @@ -384,30 +384,30 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
384 384 $scope.viewOrientationId = 6;
385 385 }
386 386  
387   - // debugger;
  387 + // debugger;
388 388 var bgArtJsonPath = '';
389 389  
390   - bgArtJsonPath = '~/../content/data/json/da/da_dat_bgart.json';
  390 + bgArtJsonPath = '~/../content/data/json/da/da_dat_bgart.json';
391 391  
392   - var bgartdata = DataService.getJson(bgArtJsonPath)
393   - bgartdata.then(
394   - function (result) {
395   - //debugger;
396   - $scope.bgartData = result;
397   - $scope.CalculateImageCordinates($scope.viewOrientationId);
  392 + var bgartdata = DataService.getJson(bgArtJsonPath)
  393 + bgartdata.then(
  394 + function (result) {
  395 + //debugger;
  396 + $scope.bgartData = result;
  397 + $scope.CalculateImageCordinates($scope.viewOrientationId);
398 398  
399   - },
400   - function (error) {
401   - // handle errors here
402   - console.log(' $scope.bgartData = ' + error.statusText);
403   - });
404   - };
  399 + },
  400 + function (error) {
  401 + // handle errors here
  402 + console.log(' $scope.bgartData = ' + error.statusText);
  403 + });
  404 + };
405 405  
406 406  
407 407 //calculate coordinates for body region images
408 408 $scope.CalculateImageCordinates = function (viewOrientationId) {
409 409  
410   - // debugger;
  410 + // debugger;
411 411  
412 412 //set height of canvas div and left tool bar as per window size
413 413 $scope.BodyRegionCordinatesData = []; // create an empty array
... ... @@ -421,7 +421,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
421 421  
422 422 //calculate image coordinates and draw image
423 423 var bodyRegionCoordinates = $scope.BodyRegionData.BodyRegionViews;
424   - // var viewOrientationId = String($scope.voId);
  424 + // var viewOrientationId = String($scope.voId);
425 425  
426 426  
427 427 $scope.bodyRegionCoordinates = new jinqJs()
... ... @@ -429,12 +429,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
429 429 .where('_ViewOrientationId == '+viewOrientationId)
430 430 .select();
431 431  
432   - // if ($scope.voId == 9 || $scope.voId == 11) {
  432 + // if ($scope.voId == 9 || $scope.voId == 11) {
433 433  
434   - $scope.bagartDetails = new jinqJs()
435   - .from($scope.bgartData.BackgroundArts.BackgroundArtDetail)
436   - .where('_ViewOrientationId == ' + viewOrientationId)
437   - .select();
  434 + $scope.bagartDetails = new jinqJs()
  435 + .from($scope.bgartData.BackgroundArts.BackgroundArtDetail)
  436 + .where('_ViewOrientationId == ' + viewOrientationId)
  437 + .select();
438 438 //}
439 439  
440 440 angular.forEach($scope.bodyRegionCoordinates, function (value, key) {
... ... @@ -492,88 +492,88 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
492 492 //Draw body region which don't have mirror image
493 493  
494 494  
495   - //0.Scaling as per default zoom
496   - var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  495 + //0.Scaling as per default zoom
  496 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
497 497  
498   - //1.Get image source
499   - if (value._IsPrimary == 'N') {
500   - var src = $scope.GetBackgroundImgSource(value._BodyRegionId);
501   - $scope.imageSource = src;
502   - }
503   - else {
504   - var src = $scope.GetImageSource(value._BodyRegionId);
505   - $scope.imageSource = src;
506   - }
507   - //2.Draw body region which don't have mirror image
508   - $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
  498 + //1.Get image source
  499 + if (value._IsPrimary == 'N') {
  500 + var src = $scope.GetBackgroundImgSource(value._BodyRegionId);
  501 + $scope.imageSource = src;
  502 + }
  503 + else {
  504 + var src = $scope.GetImageSource(value._BodyRegionId);
  505 + $scope.imageSource = src;
  506 + }
  507 + //2.Draw body region which don't have mirror image
  508 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), src, value._BodyRegionId, 'N');
509 509  
510   - $scope.BodyRegionCordinatesData.push(
511   - {
512   - "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth),
513   - "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No'
514   - }
515   - );
  510 + $scope.BodyRegionCordinatesData.push(
  511 + {
  512 + "bodyRegionId": value._BodyRegionId, "Height": Math.round(rectangle.scaledHeight), "Width": Math.round(rectangle.scaledWidth),
  513 + "X": Math.round(rectangle.scaledX), "Y": Math.round(rectangle.scaledY), "IsMirror": 'No'
  514 + }
  515 + );
516 516  
517   - //3.GetMaskImageSource
518   - var maskSRC = $scope.GetMaskImageSource($scope.imageSource);
  517 + //3.GetMaskImageSource
  518 + var maskSRC = $scope.GetMaskImageSource($scope.imageSource);
519 519  
520   - //4.Draw body region for mask image
521   - $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), maskSRC, value._BodyRegionId, 'Y');
  520 + //4.Draw body region for mask image
  521 + $scope.DrawImage(Math.round(rectangle.scaledHeight), Math.round(rectangle.scaledWidth), Math.round(rectangle.scaledX), Math.round(rectangle.scaledY), maskSRC, value._BodyRegionId, 'Y');
522 522  
523 523  
524 524 //draw figLeaf for modesty
525 525  
526   - $scope.figLaefImageName;
527   - $scope.figLaefX;
528   - $scope.figLaefY;
529   - var gender;
530   - if (localStorage.getItem("genderId") == 'Female') {
531   - gender = 'F';
  526 + $scope.figLaefImageName;
  527 + $scope.figLaefX;
  528 + $scope.figLaefY;
  529 + var gender;
  530 + if (localStorage.getItem("genderId") == 'Female') {
  531 + gender = 'F';
532 532  
533   - }
534   - else {
535   - gender = 'M';
536   - }
537   - if (((localStorage.getItem("genderId") == 'Female') && (value._BodyRegionId == 2)) || (value._BodyRegionId == 3)) {
538   -
539   - var dtlOfBr = new jinqJs()
540   - .from($scope.bagartDetails)
541   - .where('_BodyRegionId == ' + value._BodyRegionId)
542   - .select();
543   -
544   -
545   - // debugger
546   -
547   - var dtlOfGender = new jinqJs()
548   - .from(dtlOfBr)
549   - .where('_Gender == ' + gender)
550   - .select();
551   - var dtlOfSktn = new jinqJs()
552   - .from(dtlOfGender)
553   - .where('_Skintone == +' )
554   - .select();
555   - //multiple conditions are not working in where clause of JinQ so need multiple filtered variables
556   - if (dtlOfSktn.length > 0) {
  533 + }
  534 + else {
  535 + gender = 'M';
  536 + }
  537 + if (((localStorage.getItem("genderId") == 'Female') && (value._BodyRegionId == 2)) || (value._BodyRegionId == 3)) {
  538 +
  539 + var dtlOfBr = new jinqJs()
  540 + .from($scope.bagartDetails)
  541 + .where('_BodyRegionId == ' + value._BodyRegionId)
  542 + .select();
  543 +
  544 +
  545 + // debugger
  546 +
  547 + var dtlOfGender = new jinqJs()
  548 + .from(dtlOfBr)
  549 + .where('_Gender == ' + gender)
  550 + .select();
  551 + var dtlOfSktn = new jinqJs()
  552 + .from(dtlOfGender)
  553 + .where('_Skintone == +' )
  554 + .select();
  555 + //multiple conditions are not working in where clause of JinQ so need multiple filtered variables
  556 + if (dtlOfSktn.length > 0) {
557 557  
558   - if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) >= parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
559   - $scope.figLaefImageName = dtlOfSktn[0]._ImageId;
560   - //$scope.figLaefX = filtereddata[0]._X;
561   - //$scope.figLaefY = filtereddata[0]._Y;
  558 + if ((parseInt(dtlOfSktn[0]._lns) <= parseInt($scope.layerNumber)) && (parseInt(dtlOfSktn[0]._lne) >= parseInt($scope.layerNumber)) && (dtlOfSktn[0]._isfr == 'Y')) {
  559 + $scope.figLaefImageName = dtlOfSktn[0]._ImageId;
  560 + //$scope.figLaefX = filtereddata[0]._X;
  561 + //$scope.figLaefY = filtereddata[0]._Y;
562 562  
563   - var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
  563 + var rectangle = scaleRectangle(value._X, value._Y, value._Height, value._Width, value._MirrorValue);
564 564  
565 565  
566   - var src = "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
  566 + var src = "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + value._BodyRegionId + "/" + $scope.figLaefImageName;
567 567  
568   - $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
  568 + $scope.DrawImage(rectangle.scaledHeight, rectangle.scaledWidth, rectangle.scaledX, rectangle.scaledY, src, 'modestyImg' + value._BodyRegionId, 'N')
569 569  
570   - }
571   - }
  570 + }
  571 + }
572 572  
573   - }
  573 + }
574 574  
575 575  
576   - }
  576 + }
577 577  
578 578  
579 579 });
... ... @@ -584,12 +584,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
584 584 }
585 585 }
586 586 //set scrollbars on canvas and hide loading label
587   - // debugger;
  587 + // debugger;
588 588 // var isiOSSafari = (navigator.userAgent.match(/like Mac OS X/i)) ? true : false;
589 589 var isiOSSafari = (navigator.userAgent.match(/iPad/i)) ? true : false;
590 590  
591 591 //set scrollbars on canvas and hide loading label
592   - // $('#daLoaderLabel').css('visibility', 'hidden')
  592 + // $('#daLoaderLabel').css('visibility', 'hidden')
593 593  
594 594 $('#canvasDiv').css('overflow', 'scroll')
595 595 if (isiOSSafari) {
... ... @@ -604,7 +604,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
604 604 var abc = $scope.BodyRegionCordinatesData;
605 605 // debugger;
606 606 $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber));
607   - // $('#spinner').css('visibility', 'hidden');
  607 + // $('#spinner').css('visibility', 'hidden');
608 608 $rootScope.isLoading = false;
609 609  
610 610 }
... ... @@ -686,7 +686,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
686 686  
687 687 if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) {
688 688  
689   - return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  689 + return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
690 690 }
691 691 }
692 692 }
... ... @@ -698,17 +698,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
698 698 {
699 699 var bodyRegion = SelectedLayerData.BodyRegion._BodyRegionId;
700 700  
701   - return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName;
  701 + return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion.Image._ImageName;
702 702  
703   - }
  703 + }
704 704 else // it is for other body view which have multiple body regions and layer no > 0
705 705 {
706   - // debugger;
  706 + // debugger;
707 707 for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) {
708 708 var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId;
709 709 if (bodyRegion == bodyRegionId) {
710 710  
711   - return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
  711 + return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName;
712 712  
713 713 }
714 714 }
... ... @@ -717,7 +717,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
717 717 }
718 718  
719 719 $scope.GetBackgroundImgSource = function (bodyRegionId) {
720   - // debugger;
  720 + // debugger;
721 721  
722 722 var selectedGender;
723 723 if (localStorage.getItem("genderId") == "Male") {
... ... @@ -752,7 +752,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
752 752 return "content/images/DA/BodyViews/" + $scope.voId + "/layers/0/" + bodyRegionId + "/" + $scope.skinTone + "/" + $scope.bagartDetailsOnSktn[0]._ImageId;
753 753  
754 754 }
755   - }
  755 + }
756 756  
757 757  
758 758  
... ... @@ -907,7 +907,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
907 907  
908 908 $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) {
909 909  
910   - // debugger;
  910 + // debugger;
911 911 var imgCanvas = document.createElement('canvas');
912 912 // imgCanvas.style.backgroundColor = 'red';
913 913 imgCanvas.height = h;
... ... @@ -937,7 +937,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
937 937 imgCanvas.className = 'modestyImg'
938 938 imgCanvas.style.visibility = 'hidden'
939 939 //set z index to make leaf canvas on top of hip canavs
940   - imgCanvas.style.zIndex = "2000";
  940 + imgCanvas.style.zIndex = "2000";
941 941 }
942 942 if ($scope.voId == 11 && bodyRegionId == 6) {
943 943 imgCanvas.style.zIndex = "5000";
... ... @@ -991,9 +991,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
991 991 // y = $('#imageCanvas6_mci').top;
992 992 //}
993 993 //else {
994   - bodyRegionId = maskCanvasId.slice(-1);
995   - maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
996   - // }
  994 + bodyRegionId = maskCanvasId.slice(-1);
  995 + maskCanvasId = 'imageCanvas' + bodyRegionId + '_mci';
  996 + // }
997 997 var maskCanvas = document.getElementById(maskCanvasId);
998 998 var canvasContextForRGB = maskCanvas.getContext("2d");
999 999 RGBColor = $scope.GetRGBColor(canvasContextForRGB, actulalX, actualY,x,y);
... ... @@ -1041,12 +1041,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1041 1041  
1042 1042  
1043 1043 function start() {
1044   - // debugger;
  1044 + // debugger;
1045 1045 context.drawImage(img, 0, 0);
1046 1046 };
1047   - // $('#daLoaderLabel').css('visibility', 'visible')
  1047 + // $('#daLoaderLabel').css('visibility', 'visible')
1048 1048  
1049   - // $rootScope.isLoading = true;
  1049 + // $rootScope.isLoading = true;
1050 1050  
1051 1051 document.getElementById('canvasDiv').appendChild(imgCanvas);
1052 1052  
... ... @@ -1091,7 +1091,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1091 1091  
1092 1092 //get annotation from term number
1093 1093 $scope.GetAnnotationText = function (termNumber) {
1094   - //debugger;
  1094 + //debugger;
1095 1095  
1096 1096 var annotationText;
1097 1097 //0
... ... @@ -1221,25 +1221,25 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1221 1221  
1222 1222 $rootScope.isLoading = true;
1223 1223 $('#spinner').css('visibility', 'visible');
1224   - var canDiv = document.getElementById('canvasDiv');
1225   - var canDivChildCount = canDiv.childElementCount;
1226   - if (canDivChildCount > 0) {
1227   - canDiv.innerHTML = '';
1228   - }
  1224 + var canDiv = document.getElementById('canvasDiv');
  1225 + var canDivChildCount = canDiv.childElementCount;
  1226 + if (canDivChildCount > 0) {
  1227 + canDiv.innerHTML = '';
  1228 + }
1229 1229  
1230   - $scope.CalculateImageCordinates ($scope.viewOrientationId );
  1230 + $scope.CalculateImageCordinates ($scope.viewOrientationId );
1231 1231  
1232   - $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
1233   - $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition)
  1232 + $('#canvasDiv').scrollLeft($scope.imageHorizontlScrollPosition)
  1233 + $('#canvasDiv').scrollTop($scope.imageVerticalScrollPosition)
1234 1234  
1235   - $timeout(function () { $scope.DisableProgressBar() }, 1000);
1236   - }
  1235 + $timeout(function () { $scope.DisableProgressBar() }, 1000);
  1236 + }
1237 1237  
1238 1238 }
1239 1239  
1240 1240 $scope.DisableProgressBar = function () {
1241 1241  
1242   - // alert('Disabled wait cursor is called');
  1242 + // alert('Disabled wait cursor is called');
1243 1243 $rootScope.isLoading = false;
1244 1244 $('#spinner').css('visibility', 'hidden');
1245 1245  
... ... @@ -1333,8 +1333,32 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1333 1333  
1334 1334  
1335 1335 $scope.createTransparencyBox = function () {
1336   - // debugger
1337   - // alert('transparency clcked')
  1336 + // debugger
  1337 + // alert('transparency clcked')
  1338 +
  1339 +
  1340 +
  1341 + $scope.isTransparencyActivated = true;
  1342 + // alert('transparencyClicked' + $scope.isTransparencyActivated)
  1343 + $('#btnTranparency').addClass('tButtonActive');
  1344 + $('#btnIdentity').removeClass(' btn-primary');
  1345 + $('#btnIdentity').addClass('btn-black');
  1346 +
  1347 + var canvasDiv = document.getElementById('canvasDiv');
  1348 + $scope.verticalScrollPosition = canvasDiv.scrollTop;
  1349 + $scope.horizontlScrollPosition = canvasDiv.scrollLeft;
  1350 +
  1351 + var canvasDiv = document.getElementById('canvasDiv');
  1352 + canvasDiv.addEventListener("mousedown", mouseDownListener);
  1353 +
  1354 + canvasDiv.addEventListener("mousemove", mouseMoveListener);
  1355 +
  1356 + canvasDiv.addEventListener("mouseup", mouseUpListener)
  1357 +
  1358 + }
  1359 +
  1360 + function mouseDownListener(e) {
  1361 +
1338 1362 var $container = document.getElementById('canvasDiv');
1339 1363 var $selection = $('<div>').addClass('rectangle');
1340 1364 document.getElementById("DAView")
... ... @@ -1344,83 +1368,62 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1344 1368 'border': '1px dotted #000'
1345 1369 });
1346 1370  
1347   -
1348   - $scope.isTransparencyActivated = true;
1349   - // alert('transparencyClicked' + $scope.isTransparencyActivated)
1350   - $('#btnTranparency').addClass('tButtonActive');
1351   - var canvasDiv = document.getElementById('canvasDiv');
1352   - var verticalScrollPosition = canvasDiv.scrollTop;
1353   - var horizontlScrollPosition = canvasDiv.scrollLeft;
1354   -
1355   -
1356   - canvasDiv.addEventListener("mousedown", function (e) {
1357   -
1358   - // debugger;
1359   - var currentMousePosition = $scope.getMousePos(e);
1360   -
1361   - var actulalX = currentMousePosition.x + horizontlScrollPosition
1362   - var actualY = currentMousePosition.y + verticalScrollPosition
1363   -
1364   - //alert('$scope.TransparencyBoxStartX in mouseDown: ' + $scope.TransparencyBoxStartX + ' & Y= ' + $scope.TransparencyBoxStartY);
1365   - $scope.TransparencyBoxStartX = actulalX;
1366   - $scope.TransparencyBoxStartY = actualY
1367   - $scope.startX = actulalX;
1368   - $scope.startY = actualY;
1369   - var tBox = document.getElementById('transparencyCanvas');
1370   -
1371   - if (tBox == null) {
1372   - //// canvasDiv.style.cursor = "crosshair";
1373   - $selection.css({
1374   - 'top': actualY,
1375   - 'left': actulalX,
1376   - 'width': 0,
1377   - 'height': 0,
1378   - //'background': 'transparent',
1379   - });
1380   - $selection.appendTo($container);
1381   - }
1382   -
1383   - // this.removeEventListener('mousedown', arguments.callee);
1384   - }, false);
  1371 + var currentMousePosition = $scope.getMousePos(e);
1385 1372  
  1373 + var actulalX = currentMousePosition.x + $scope.horizontlScrollPosition
  1374 + var actualY = currentMousePosition.y + $scope.verticalScrollPosition
1386 1375  
  1376 + //alert('$scope.TransparencyBoxStartX in mouseDown: ' + $scope.TransparencyBoxStartX + ' & Y= ' + $scope.TransparencyBoxStartY);
  1377 + $scope.TransparencyBoxStartX = actulalX;
  1378 + $scope.TransparencyBoxStartY = actualY
  1379 + $scope.startX = actulalX;
  1380 + $scope.startY = actualY;
  1381 + var tBox = document.getElementById('transparencyCanvas');
1387 1382  
1388   - var canvasDiv = document.getElementById('canvasDiv');
  1383 + if (tBox == null) {
  1384 + //// canvasDiv.style.cursor = "crosshair";
  1385 + $selection.css({
  1386 + 'top': actualY,
  1387 + 'left': actulalX,
  1388 + 'width': 0,
  1389 + 'height': 0,
  1390 + //'background': 'transparent',
  1391 + });
  1392 + $selection.appendTo($container);
  1393 + }
1389 1394  
1390   - document.getElementById('canvasDiv').addEventListener("mousemove", function (e) {
  1395 + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseDownListener);
1391 1396  
1392   - var currentMousePosition = $scope.getMousePos(e);
1393   - var move_x = currentMousePosition.x + horizontlScrollPosition,
1394   - move_y = currentMousePosition.y + verticalScrollPosition,
  1397 + }
1395 1398  
1396   - width = move_x - $scope.TransparencyBoxStartX,
1397   - height = move_y - $scope.TransparencyBoxStartY,
1398   - new_x, new_y;
  1399 + function mouseMoveListener(e) {
1399 1400  
1400   - new_x = (move_x < $scope.TransparencyBoxStartX) ? ($scope.TransparencyBoxStartX - width) : $scope.TransparencyBoxStartX;
1401   - new_y = (move_y < $scope.TransparencyBoxStartY) ? ($scope.TransparencyBoxStartY - height) : $scope.TransparencyBoxStartY;
  1401 + var currentMousePosition = $scope.getMousePos(e);
  1402 + var move_x = currentMousePosition.x + $scope.horizontlScrollPosition,
  1403 + move_y = currentMousePosition.y + $scope.verticalScrollPosition,
1402 1404  
1403   - $selection.css({
1404   - 'width': width,
1405   - 'height': height,
1406   - //'background': 'transparent'
  1405 + width = move_x - $scope.TransparencyBoxStartX,
  1406 + height = move_y - $scope.TransparencyBoxStartY,
  1407 + new_x, new_y;
1407 1408  
1408   - });
  1409 + new_x = (move_x < $scope.TransparencyBoxStartX) ? ($scope.TransparencyBoxStartX - width) : $scope.TransparencyBoxStartX;
  1410 + new_y = (move_y < $scope.TransparencyBoxStartY) ? ($scope.TransparencyBoxStartY - height) : $scope.TransparencyBoxStartY;
1409 1411  
1410   -
  1412 + $('.rectangle').css({
  1413 + 'width': width,
  1414 + 'height': height,
  1415 + //'background': 'transparent'
1411 1416  
1412   - }, false);
  1417 + });
1413 1418  
  1419 +
1414 1420  
1415   - var canvasDiv = document.getElementById('canvasDiv');
1416   - canvasDiv.addEventListener("mouseup", mouseUpListener)
1417   -
1418 1421 }
1419 1422  
1420 1423  
1421 1424 function mouseUpListener(e) {
1422 1425 // $selection.remove();
1423   - // debugger;
  1426 + // debugger;
1424 1427  
1425 1428 $('.rectangle').remove();
1426 1429  
... ... @@ -1514,9 +1517,31 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1514 1517 }
1515 1518 if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
1516 1519  
  1520 + //if ($scope.voId != "9") {
  1521 + // if ($scope.voId != "11") {
  1522 + // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  1523 +
  1524 + // }
1517 1525  
1518   - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  1526 + //}
  1527 +
  1528 + //else {
  1529 + // if (value.bodyRegionId == "6") {
  1530 + // $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  1531 + // }
  1532 + //}
  1533 + if (($scope.voId == "9" || $scope.voId == "11")) {
  1534 + if (value.bodyRegionId == "6") {
  1535 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
  1536 + }
  1537 + else {
  1538 +
  1539 + }
  1540 + }
  1541 + else {
  1542 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false);
1519 1543  
  1544 + }
1520 1545 }
1521 1546 })
1522 1547  
... ... @@ -1529,15 +1554,18 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1529 1554  
1530 1555  
1531 1556  
  1557 + document.getElementById('canvasDiv').removeEventListener("mousedown", mouseUpListener);
  1558 + document.getElementById('canvasDiv').removeEventListener("mousemove", mouseUpListener);
1532 1559  
1533 1560 document.getElementById('canvasDiv').removeEventListener("mouseup", mouseUpListener);
  1561 + // document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener);
1534 1562 $('#btnTranparency').removeClass('btn-black');
1535 1563  
1536 1564 $('#btnTranparency').addClass('tButtonActive');
1537 1565 }
1538 1566  
1539 1567 $scope.loadTransparencyImage = function(bodyRegionId, Height, Width, X, Y, IsMirror, TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, scope, isLayerChanged, isTransparencyChanged) {
1540   - // debugger;
  1568 + // debugger;
1541 1569 var scope1 = angular.element(document.getElementById("DAView")).scope();
1542 1570 var transparencyCanvas = document.getElementById('transparencyCanvas');
1543 1571  
... ... @@ -1648,7 +1676,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1648 1676 //data on tras canvas irrespective of the trans number, so we can chnage the transparnecy of original data not the manipulated)
1649 1677 if (isTransparencyChanged == true) {
1650 1678  
1651   - // var txtTransparencyChange = document.getElementById("txtTransparencyChange");
  1679 + // var txtTransparencyChange = document.getElementById("txtTransparencyChange");
1652 1680  
1653 1681 var transNumber = $scope.transNumber;
1654 1682  
... ... @@ -1664,7 +1692,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1664 1692 imageData[i] = ((255) * (parseInt(transNumber))) / 100;
1665 1693 }
1666 1694 // after the manipulation, reset the data
1667   - // imageDa.data = imageData;
  1695 + // imageDa.data = imageData;
1668 1696 // and put the imagedata back to the canvas
1669 1697 ctx.putImageData(imageDa, XforTransImage, YforTransImage);
1670 1698  
... ... @@ -1739,7 +1767,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1739 1767 transparencyTempCanvas.style.top = Y + "px"//y + "px";
1740 1768 transparencyTempCanvas.style.visibility = 'hidden';
1741 1769 //transparencyTempCanvas.style.visibility = 'visible';
1742   - // transparencyCanvas.style.zIndex = 4000;
  1770 + // transparencyCanvas.style.zIndex = 4000;
1743 1771 document.getElementById('canvasDiv').appendChild(transparencyTempCanvas);
1744 1772  
1745 1773 //create temp mask canvas
... ... @@ -1759,7 +1787,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1759 1787  
1760 1788  
1761 1789 tempImg.onload = function () {
1762   - // debugger;
  1790 + debugger;
1763 1791 var tempCtx = transparencyTempCanvas.getContext('2d');
1764 1792  
1765 1793 if (IsMirror == 'Yes') {
... ... @@ -1836,9 +1864,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1836 1864 imageData[i] = ((255) * (parseInt(transNumber))) / 100;
1837 1865 }
1838 1866  
1839   - // imageD.data = imageData;
  1867 + // imageD.data = imageData;
1840 1868 // and put the imagedata back to the canvas
1841   - // debugger
  1869 + // debugger
1842 1870 tempCtx.putImageData(imageD, 0, 0);
1843 1871  
1844 1872 }
... ... @@ -1879,7 +1907,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1879 1907 var tranparencyMaskImgSrc = $scope.GetMaskImageSource(tranparencyImgSrc);
1880 1908 tempMaskImg.src = tranparencyMaskImgSrc;//"http://localhost/AIAHtml5/" + tranparencyMaskImgSrc;
1881 1909 tempMaskImg.onload = function () {
1882   - // debugger;
  1910 + // debugger;
1883 1911 var tempmaskCtx = transparencyTempcanavsMask.getContext('2d');
1884 1912  
1885 1913 if (IsMirror == 'Yes') {
... ... @@ -1938,89 +1966,89 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
1938 1966 }
1939 1967  
1940 1968  
1941   - $scope.isResized = true;
  1969 + $scope.isResized = true;
1942 1970  
1943 1971  
1944   - if (tCanvasHeight != $scope.transparencyCanvasHeight || tCanvasWidth != $scope.transparencyCanvasWidth) {
  1972 + if (tCanvasHeight != $scope.transparencyCanvasHeight || tCanvasWidth != $scope.transparencyCanvasWidth) {
1945 1973  
1946 1974  
1947   - var transparencyCanvas = document.createElement('canvas');
1948   - transparencyCanvas.id = 'transparencyCanvas';
1949   - $scope.transparencyCanvas = tCanvas.id;
1950   - transparencyCanvas.height = tCanvasHeight;
1951   - transparencyCanvas.width = tCanvasWidth;
1952   - transparencyCanvas.style.position = "absolute";
1953   - transparencyCanvas.style.left = tCanvas.style.left; // x + "px";
1954   - transparencyCanvas.style.top = tCanvas.style.top//y + "px";
1955   - transparencyCanvas.style.border = "black 1px solid";
1956   - document.getElementById('canvasDiv').appendChild(transparencyCanvas);
  1975 + var transparencyCanvas = document.createElement('canvas');
  1976 + transparencyCanvas.id = 'transparencyCanvas';
  1977 + $scope.transparencyCanvas = tCanvas.id;
  1978 + transparencyCanvas.height = tCanvasHeight;
  1979 + transparencyCanvas.width = tCanvasWidth;
  1980 + transparencyCanvas.style.position = "absolute";
  1981 + transparencyCanvas.style.left = tCanvas.style.left; // x + "px";
  1982 + transparencyCanvas.style.top = tCanvas.style.top//y + "px";
  1983 + transparencyCanvas.style.border = "black 1px solid";
  1984 + document.getElementById('canvasDiv').appendChild(transparencyCanvas);
1957 1985  
1958   - $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
  1986 + $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeCanvas(); }, start: function (event, ui) { clearTransCanvas(); } });
1959 1987  
1960   - }
1961   - $scope.transparencyCanvasHeight = tCanvasHeight;
1962   - $scope.transparencyCanvasWidth = tCanvasWidth;
  1988 + }
  1989 + $scope.transparencyCanvasHeight = tCanvasHeight;
  1990 + $scope.transparencyCanvasWidth = tCanvasWidth;
1963 1991  
1964   - // debugger;
1965   - //create temp cavas to retain the original anavs data for use in transparency change as
1966   - //if u use original canvas data for transprency change then at 0 transparency all data will become transparent and if u increase transparency with this data then the canavs will be blank
1967   - if (document.getElementById('tempCanvas') != null) {
1968   - $('#tempCanvas').remove();
1969   - }
1970   - var tempCanvas = document.createElement('canvas');
1971   - tempCanvas.id = 'tempCanvas';
1972   - $scope.tempCanvas = tempCanvas.id;
1973   - tempCanvas.height = $scope.transparencyCanvasHeight;
1974   - tempCanvas.width = $scope.transparencyCanvasWidth;
1975   - tempCanvas.style.position = "absolute";
1976   - tempCanvas.style.left = 200 + 'px';
1977   - tempCanvas.style.backgroundColor = "transparent";
1978   - tempCanvas.style.visibility = 'hidden';
1979   - // tempCanvas.style.border = "black 1px solid";
  1992 + // debugger;
  1993 + //create temp cavas to retain the original anavs data for use in transparency change as
  1994 + //if u use original canvas data for transprency change then at 0 transparency all data will become transparent and if u increase transparency with this data then the canavs will be blank
  1995 + if (document.getElementById('tempCanvas') != null) {
  1996 + $('#tempCanvas').remove();
  1997 + }
  1998 + var tempCanvas = document.createElement('canvas');
  1999 + tempCanvas.id = 'tempCanvas';
  2000 + $scope.tempCanvas = tempCanvas.id;
  2001 + tempCanvas.height = $scope.transparencyCanvasHeight;
  2002 + tempCanvas.width = $scope.transparencyCanvasWidth;
  2003 + tempCanvas.style.position = "absolute";
  2004 + tempCanvas.style.left = 200 + 'px';
  2005 + tempCanvas.style.backgroundColor = "transparent";
  2006 + tempCanvas.style.visibility = 'hidden';
  2007 + // tempCanvas.style.border = "black 1px solid";
1980 2008  
1981   - document.getElementById('canvasDiv').appendChild(tempCanvas);
  2009 + document.getElementById('canvasDiv').appendChild(tempCanvas);
1982 2010  
1983 2011  
1984   - var BodyRegionDictionary = $scope.BodyRegionCordinatesData;
  2012 + var BodyRegionDictionary = $scope.BodyRegionCordinatesData;
1985 2013  
1986   - $scope.IncludedBodyRegions = [];
1987   - // $scope.layerNo = parseInt(document.getElementById(''))
1988   - var counter = 0;
1989   - $.each(BodyRegionDictionary, function (index, value) {
  2014 + $scope.IncludedBodyRegions = [];
  2015 + // $scope.layerNo = parseInt(document.getElementById(''))
  2016 + var counter = 0;
  2017 + $.each(BodyRegionDictionary, function (index, value) {
1990 2018  
1991   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
1992   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
1993   - var TBRight = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.width).replace('px', ''));
1994   - var TBBottom = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.height).replace('px', ''));
1995   - var TBStartX = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', ''));
1996   - var TBStartY = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', ''));
  2019 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  2020 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  2021 + var TBRight = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.width).replace('px', ''));
  2022 + var TBBottom = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', '')) + parseInt((document.getElementById('transparencyCanvas').style.height).replace('px', ''));
  2023 + var TBStartX = parseInt((document.getElementById('transparencyCanvas').style.left).replace('px', ''));
  2024 + var TBStartY = parseInt((document.getElementById('transparencyCanvas').style.top).replace('px', ''));
1997 2025  
1998 2026  
1999 2027  
2000 2028  
2001   - if (TBStartX <= bodyRegionRight && value.X <= TBRight && TBStartY <= bodyRegionBottom && value.Y <= TBBottom) {
  2029 + if (TBStartX <= bodyRegionRight && value.X <= TBRight && TBStartY <= bodyRegionBottom && value.Y <= TBBottom) {
2002 2030  
2003 2031  
2004   - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, false);
  2032 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, false);
2005 2033  
2006   - }
  2034 + }
2007 2035  
2008 2036  
2009   - })
2010   - //bind click listener
2011   - //bind click listener
2012   - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
  2037 + })
  2038 + //bind click listener
  2039 + //bind click listener
  2040 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
2013 2041  
2014 2042  
2015 2043  
2016   - // });
2017   - $(".ui-wrapper").css("z-index", "6000");
  2044 + // });
  2045 + $(".ui-wrapper").css("z-index", "6000");
2018 2046 $scope.isResized = false;
2019 2047 }
2020 2048  
2021 2049 function TransparencyCanvasClickListener(evt) {
2022 2050 //alert('tb clicked')
2023   - // debugger;
  2051 + // debugger;
2024 2052 var pixelData;
2025 2053 var pixelDataTrans;
2026 2054 var mousePos = $scope.getMousePos(evt);
... ... @@ -2133,8 +2161,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2133 2161  
2134 2162 //trans layer image data
2135 2163 pixelDataTrans = maskCanvasContexttrans.getImageData(imgX, imgY, 1, 1);
2136   - // console.log('at the time' + pixelData.data[0])
2137   - // debugger;
  2164 + // console.log('at the time' + pixelData.data[0])
  2165 + // debugger;
2138 2166 var annotations = $scope.getAnnotationForTransparencyBox(pixelData, pixelDataTrans, $scope);
2139 2167 if ($('#speechBubble').length > 0)
2140 2168 $('#speechBubble').remove();
... ... @@ -2281,9 +2309,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2281 2309  
2282 2310  
2283 2311 $scope.onTransparencyChange = function(ev, ui){
2284   - //debugger;
2285   - // alert('t change')
2286   - $scope.transNumber = ui.value;
  2312 + //debugger;
  2313 + // alert('t change')
  2314 + $scope.transNumber = ui.value;
2287 2315  
2288 2316 var tCanvas = document.getElementById('transparencyCanvas');
2289 2317 var tCanvasContext = tCanvas.getContext('2d');
... ... @@ -2301,41 +2329,41 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2301 2329  
2302 2330 //var scope = angular.element(document.getElementById("DAView")).scope();
2303 2331 //scope.$apply(function () {
2304   - var arr = [];
2305   - $scope.transparencyChangeCounter++;
2306   - //before changing the transparency of first canvas, hold the orignal canvas data on temp canvas
  2332 + var arr = [];
  2333 + $scope.transparencyChangeCounter++;
  2334 + //before changing the transparency of first canvas, hold the orignal canvas data on temp canvas
2307 2335  
2308   - //put original data on transcanvas so that it can be used to change transparency properly
2309   - var tempCanavs = document.getElementById('tempCanvas');
2310   - var tempCanvasContext = tempCanavs.getContext('2d');
  2336 + //put original data on transcanvas so that it can be used to change transparency properly
  2337 + var tempCanavs = document.getElementById('tempCanvas');
  2338 + var tempCanvasContext = tempCanavs.getContext('2d');
2311 2339  
2312   - var originalTransparencyData = tempCanvasContext.getImageData(0, 0, $scope.transparencyCanvasWidth, $scope.transparencyCanvasHeight);
2313   - var ctx = document.getElementById('transparencyCanvas').getContext('2d');
2314   - ctx.putImageData(originalTransparencyData, 0, 0);
  2340 + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, $scope.transparencyCanvasWidth, $scope.transparencyCanvasHeight);
  2341 + var ctx = document.getElementById('transparencyCanvas').getContext('2d');
  2342 + ctx.putImageData(originalTransparencyData, 0, 0);
2315 2343  
2316 2344  
2317   - var BodyRegionDictionary = $scope.BodyRegionCordinatesData;
  2345 + var BodyRegionDictionary = $scope.BodyRegionCordinatesData;
2318 2346  
2319   - $scope.IncludedBodyRegions = [];
2320   - var counter = 0;
2321   - $.each(BodyRegionDictionary, function (index, value) {
  2347 + $scope.IncludedBodyRegions = [];
  2348 + var counter = 0;
  2349 + $.each(BodyRegionDictionary, function (index, value) {
2322 2350  
2323   - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
2324   - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
  2351 + var bodyRegionRight = parseInt(value.X) + parseInt(value.Width);
  2352 + var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height);
2325 2353  
2326 2354  
2327 2355  
2328   - if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  2356 + if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
2329 2357  
2330   - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, true);
  2358 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, $scope.TransparencyEndX, $scope.TransparencyBoxStartY, $scope.TransparencyBoxEndY, $scope, false, true);
2331 2359  
2332   - }
  2360 + }
2333 2361  
2334   - });
  2362 + });
2335 2363  
2336 2364  
2337 2365  
2338   - // });
  2366 + // });
2339 2367 }
2340 2368  
2341 2369 $scope.CloseTransparencyBox = function () {
... ... @@ -2361,16 +2389,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2361 2389 }
2362 2390 //var scope = angular.element(document.getElementById("DAView")).scope();
2363 2391 //scope.$apply(function () {
2364   - $scope.layerNumber = 0;
2365   - $scope.isTransparencyActivated = false;
  2392 + $scope.layerNumber = 0;
  2393 + $scope.isTransparencyActivated = false;
2366 2394 //})
2367 2395 }
2368 2396 $('#transparencyScale').css('visibility', 'hidden')
2369   -
  2397 + $scope.isTransparencyActivated = false;
2370 2398 // document.getElementById('btnTranparency').className = 't-transparency'
2371 2399 $('#btnTranparency').removeClass('tButtonActive');
2372 2400 $('#btnTranparency').addClass('btn-black');
2373   - document.getElementById('btnTranparency').removeEventListener("click", onTransparencyButtonClick);
  2401 + $('#btnIdentity').removeClass('btn-black');
  2402 +
  2403 + $('#btnIdentity').addClass('btn-primary');
  2404 +
  2405 + document.getElementById('btnTranparency').removeEventListener("click", $scope.createTransparencyBox);
2374 2406  
2375 2407 }
2376 2408  
... ... @@ -2417,6 +2449,26 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
2417 2449 };
2418 2450  
2419 2451  
  2452 + $scope.OnIdentityClick = function () {
  2453 +
  2454 + // $('#btnIdentity').addClass('btn-primary');
  2455 +
  2456 + if ($scope.isTransparencyActivated == true) {
  2457 +
  2458 + $scope.isTransparencyActivated = false;
  2459 +
  2460 + var canvasDiv = document.getElementById('canvasDiv');
  2461 + canvasDiv.removeEventListener("mousedown", mouseDownListener);
  2462 +
  2463 + canvasDiv.removeEventListener("mousemove", mouseMoveListener);
  2464 +
  2465 + canvasDiv.removeEventListener("mouseup", mouseUpListener)
  2466 + $('#btnTranparency').removeClass('tButtonActive');
  2467 + $('#btnTranparency').addClass('btn-black');
  2468 + }
  2469 +
  2470 + }
  2471 +
2420 2472  
2421 2473 }]
2422 2474  
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/da/da-view.html
... ... @@ -18,7 +18,7 @@
18 18 <div class="toggle-icon toggleBar toggleHeadingButton" title="Show/Hide Sidebar" style="top:20px;"></div>
19 19 <div class="" style="top:20px">
20 20 <div class="col-sm-6" title="Identify">
21   - <button class="btn btn-primary btn-sm" ng-click="changeLayer()"> <img src="content/images/icon-identity.png" alt="" title=""></button>
  21 + <button id="btnIdentity" class="btn btn-primary btn-sm" ng-click="OnIdentityClick()"> <img src="content/images/icon-identity.png" alt="" title=""></button>
22 22 </div>
23 23 <div class="col-sm-6 pull-right" title="Zoom-in/Zoom-out">
24 24 <button class="btn btn-black btn-sm pull-right"><img src="content/images/icon-zoom.png" alt="" title=""></button>
... ... @@ -117,7 +117,7 @@
117 117 <div class=" canavsParent col-sm-12 " id="cp">
118 118 <div class="container-fluid">
119 119 <div class="row">
120   - <div id="canvasDiv" class="col-sm-12 img-thumbnail" align="center"></div>
  120 + <div id="canvasDiv" class="col-sm-12 img-thumbnail" align="center" ></div>
121 121 <!--<div id="canvasDiv" style=" width: 95% !important;top:0px;overflow:scroll;background-color:white;">-->
122 122 <!--<div id="daLoaderLabel">Loading....</div>-->
123 123  
... ...