Commit 6932568c5992af07e6d56e7527041473bd500bf5

Authored by Nikita Kulshreshtha
1 parent a671eef9

now getting exact transparencybox on zoom-in/out but need to see layer number,re…

…size and layerchange for tbox
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -148,7 +148,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
148 148 'maximised': false,
149 149 'id': 0,
150 150 'moduleName': '',
151   - 'mode': ''
  151 + 'mode': '',
152 152  
153 153 });
154 154  
... ... @@ -2803,6 +2803,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
2803 2803 // var isTBACtive = $scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated');
2804 2804 if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) {
2805 2805  
  2806 + $scope.DrawTransparencyBox(windowviewid);
  2807 +
2806 2808 }
2807 2809 else if ($scope.GetwindowStoreData(windowviewid, 'isExtract') == true) {
2808 2810 $rootScope.isLoading = true;
... ... @@ -3278,8 +3280,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
3278 3280 var isViewChange = $scope.GetwindowStoreData(windowviewid,'isViewChange');
3279 3281 var isHighlightBodyByBodySystem=$scope.GetwindowStoreData(windowviewid,'isHighlightBodyByBodySystem');
3280 3282 var isExtract= $scope.GetwindowStoreData(windowviewid,'isExtract')
3281   - var isListManagerSelected=$scope.GetwindowStoreData(windowviewid,'isListManagerSelected');
3282   - if (isExtract == true) {
  3283 + var isListManagerSelected = $scope.GetwindowStoreData(windowviewid, 'isListManagerSelected');
  3284 + if ($scope.GetwindowStoreData(windowviewid, 'isTransparencyActivated')) {
  3285 +
  3286 + $scope.DrawTransparencyBox(windowviewid);
  3287 +
  3288 + }
  3289 + else if (isExtract == true) {
3283 3290 $rootScope.isLoading = true;
3284 3291 $('#spinner').css('visibility', 'visible');
3285 3292 $scope.DisableUI();
... ... @@ -4517,6 +4524,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
4517 4524 //layer change function
4518 4525 $scope.LayerChange = function (windowviewid) {
4519 4526  
  4527 +
4520 4528 $scope.DisableUI();
4521 4529 $rootScope.CloseListManager();
4522 4530 $scope.isLayerChange = true;
... ... @@ -5681,24 +5689,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
5681 5689 $scope.SetwindowStoreData(windowviewid, 'layerNumberBeforeTBDraw', parseInt($('#txtLayerNumberDA_' + windowviewid).val()));
5682 5690 // $scope.layerNumberBeforeTBDraw = parseInt($('#txtLayerNumberDA_' + windowviewid).val());
5683 5691  
5684   - //draw temp box to store the canvas data with original transparecy
5685   - if (document.getElementById('tempCanvas_' + windowviewid) != null) {
5686   - $('#tempCanvas_' + windowviewid).remove();
5687   - }
5688   - if (document.getElementById('tempCanvas_' + windowviewid) == null || document.getElementById('tempCanvas_' + windowviewid) == undefined) {
5689   - var tempCanvas = document.createElement('canvas');
5690   - tempCanvas.id = 'tempCanvas_' + windowviewid;
5691   - tempCanvas.height = TransparencyBoxEndY - $scope.startY;
5692   - tempCanvas.width = TransparencyEndX - $scope.startX;
5693   - tempCanvas.style.position = "absolute";
5694   - tempCanvas.style.left = 200 + 'px';
5695   - tempCanvas.style.top = 200 + 'px';
5696   - tempCanvas.style.backgroundColor = "transparent";
5697   - tempCanvas.style.visibility = 'hidden';
5698   - tempCanvas.style.border = "black 1px solid";
5699   - document.getElementById("canvasDivDA_" + windowviewid).appendChild(tempCanvas);
5700   - }
5701   -
  5692 +
5702 5693  
5703 5694 $scope.SetwindowStoreData(windowviewid, 'isTransparencyBtnClicked', false);
5704 5695  
... ... @@ -5738,7 +5729,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
5738 5729 $scope.TBHeight = height;
5739 5730 $scope.TBWidth = width;
5740 5731  
5741   - $scope.abc($scope.TransparencyBoxStart, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEnd, windowviewid);
  5732 + $scope.DrawTransparencyBox(windowviewid);
5742 5733 }
5743 5734  
5744 5735 document.getElementById("canvasDivDA_" + windowviewid).removeEventListener("mousedown", mouseDownListener);
... ... @@ -5813,8 +5804,79 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
5813 5804 }
5814 5805 }
5815 5806  
5816   - $scope.abc = function (TransparencyBoxStart, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEnd, windowviewid) {
5817   - var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid, 'BodyRegionCordinatesData');
  5807 +// $scope.DrawTransparencyBox = function (TransparencyBoxStartX, TransparencyEndX, TransparencyBoxStartY, TransparencyBoxEndY, windowviewid) {
  5808 +
  5809 + $scope.DrawTransparencyBox = function (windowviewid) {
  5810 + var newDimes = null;
  5811 + // if ($scope.GetwindowStoreData(windowviewid, 'zoomInOut') == 25) {
  5812 + if ($scope.GetwindowStoreData(windowviewid, 'isZoomed') == true) {
  5813 + alert("ZOOM");
  5814 + newDimes = $scope.scaleTransparencyBox(windowviewid);
  5815 +
  5816 + $scope.TransparencyBoxStartX = newDimes.scaledX1;
  5817 + TransparencyEndX = newDimes.scaledX2;
  5818 + $scope.TransparencyBoxStartY = newDimes.scaledY1
  5819 + TransparencyBoxEndY = newDimes.scaledY2;
  5820 + $scope.TBoxEndX = newDimes.scaledX2;
  5821 + $scope.TBoxEndY = newDimes.scaledY2;
  5822 + $scope.TBHeight = newDimes.scaledHeight;
  5823 + $scope.TBWidth = newDimes.scaledWidth;
  5824 + }
  5825 + var TransparencyBoxStartX = newDimes != null ? newDimes.scaledX1 : $scope.TransparencyBoxStartX, TransparencyEndX = newDimes != null ? newDimes.scaledX2 : $scope.TBoxEndX, TransparencyBoxStartY = newDimes != null ? newDimes.scaledY1 : $scope.TransparencyBoxStartY, TransparencyBoxEndY = newDimes != null ? newDimes.scaledY2 : $scope.TBoxEndY;
  5826 + //draw temp box to store the canvas data with original transparecy
  5827 + if (document.getElementById('tempCanvas_' + windowviewid) != null) {
  5828 + $('#tempCanvas_' + windowviewid).remove();
  5829 + }
  5830 + if (document.getElementById('tempCanvas_' + windowviewid) == null || document.getElementById('tempCanvas_' + windowviewid) == undefined) {
  5831 + var tempCanvas = document.createElement('canvas');
  5832 + tempCanvas.id = 'tempCanvas_' + windowviewid;
  5833 + tempCanvas.height = TransparencyBoxEndY - TransparencyBoxStartY;
  5834 + tempCanvas.width = TransparencyEndX - TransparencyBoxStartX;
  5835 + tempCanvas.style.position = "absolute";
  5836 + tempCanvas.style.left = 200 + 'px';
  5837 + tempCanvas.style.top = 200 + 'px';
  5838 + tempCanvas.style.backgroundColor = "transparent";
  5839 + tempCanvas.style.visibility = 'hidden';
  5840 + tempCanvas.style.border = "black 1px solid";
  5841 + document.getElementById("canvasDivDA_" + windowviewid).appendChild(tempCanvas);
  5842 + }
  5843 + var transparencyCanvas = document.createElement('canvas');
  5844 + var tBox = document.getElementById('transparencyCanvas_' + windowviewid);
  5845 +
  5846 + if (document.getElementById('transparencyCanvas_' + windowviewid) != null) {
  5847 + $('#transparencyCanvas_' + windowviewid).remove();
  5848 + $('#transparencyCanvas_' + windowviewid).parent().remove();
  5849 + }
  5850 + if (document.getElementById('transparencyCanvas_' + windowviewid) == null) {
  5851 +
  5852 + transparencyCanvas.id = 'transparencyCanvas_' + windowviewid;
  5853 + $scope.transparencyCanvasId = transparencyCanvas.id;
  5854 + transparencyCanvas.height = TransparencyBoxEndY - TransparencyBoxStartY;;
  5855 + transparencyCanvas.width = TransparencyEndX - TransparencyBoxStartX;
  5856 + transparencyCanvas.style.position = "absolute";
  5857 + //transparencyCanvas.style.left = $scope.startX + 'px' // x + "px";
  5858 + //transparencyCanvas.style.top = $scope.startY + "px"//y + "px";
  5859 + transparencyCanvas.style.left = TransparencyBoxStartX + 'px'//new_x + 'px' // x + "px";
  5860 + transparencyCanvas.style.top = TransparencyBoxStartY + 'px'// + "px"
  5861 + transparencyCanvas.style.border = "black 1px solid";
  5862 + transparencyCanvas.style.backgroundColor = "transparent";
  5863 + transparencyCanvas.style.zIndex = 200;
  5864 + document.getElementById("canvasDivDA_" + windowviewid).appendChild(transparencyCanvas);
  5865 + $scope.transparencyChangeCounter = 0;
  5866 +
  5867 + $('#transparencyCanvas_' + windowviewid).resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(windowviewid); }, start: function (event, ui) { clearTransCanvas(windowviewid); } });
  5868 +
  5869 + $scope.transparencyCanvasHeight = transparencyCanvas.height;
  5870 + $scope.transparencyCanvasWidth = transparencyCanvas.width;
  5871 +
  5872 + //bind click listener
  5873 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
  5874 +
  5875 + $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex'));
  5876 +
  5877 + }
  5878 +
  5879 + var BodyRegionDictionary = $scope.GetwindowStoreData(windowviewid, 'BodyRegionCordinatesData');
5818 5880 $.each(BodyRegionDictionary, function (index, value) {
5819 5881  
5820 5882  
... ... @@ -5828,36 +5890,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
5828 5890 var bodyRegionBottom = tBoxDimesions.bodyRegionBottom;
5829 5891  
5830 5892  
5831   - var transparencyCanvas = document.createElement('canvas');
5832   - var tBox = document.getElementById('transparencyCanvas_' + windowviewid);
5833   - if (tBox == null) {
5834   -
5835   - transparencyCanvas.id = 'transparencyCanvas_' + windowviewid;
5836   - $scope.transparencyCanvasId = transparencyCanvas.id;
5837   - transparencyCanvas.height = height;
5838   - transparencyCanvas.width = width;
5839   - transparencyCanvas.style.position = "absolute";
5840   - //transparencyCanvas.style.left = $scope.startX + 'px' // x + "px";
5841   - //transparencyCanvas.style.top = $scope.startY + "px"//y + "px";
5842   - transparencyCanvas.style.left = TransparencyBoxStartX + 'px'//new_x + 'px' // x + "px";
5843   - transparencyCanvas.style.top = TransparencyBoxStartY + 'px'// + "px"
5844   - transparencyCanvas.style.border = "black 1px solid";
5845   - transparencyCanvas.style.backgroundColor = "transparent";
5846   - transparencyCanvas.style.zIndex = 200;
5847   - document.getElementById("canvasDivDA_" + windowviewid).appendChild(transparencyCanvas);
5848   - $scope.transparencyChangeCounter = 0;
5849   -
5850   - $('#transparencyCanvas_' + windowviewid).resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(windowviewid); }, start: function (event, ui) { clearTransCanvas(windowviewid); } });
5851   -
5852   - $scope.transparencyCanvasHeight = transparencyCanvas.height;
5853   - $scope.transparencyCanvasWidth = transparencyCanvas.width;
5854   -
5855   - //bind click listener
5856   - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
5857   -
5858   - $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid, 'UIWrapperZIndex'));
5859   -
5860   - }
  5893 +
5861 5894 if (TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
5862 5895  
5863 5896 $scope.SetwindowStoreData(windowviewid, 'isTBDrawnOnBodyRegion', true);
... ... @@ -5986,16 +6019,22 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
5986 6019 }
5987 6020  
5988 6021  
5989   - function scaleTransparencyBox(windowviewid, x, y, height, width) {
5990   - var nzoom = 25;//$scope.GetwindowStoreData(windowviewid, 'zoomInOut');
5991   - var existingZoon = 100;
5992   -
  6022 + $scope.scaleTransparencyBox = function(windowviewid) {
  6023 + var nzoom = $scope.GetwindowStoreData(windowviewid, 'zoomInOut');
  6024 + var existingZoon=0;
  6025 + if (nzoom == 25) {
  6026 + existingZoon = 75;
  6027 + }
  6028 + else {
  6029 + existingZoon = 25;
  6030 + }
  6031 + alert( 'nzoom = '+nzoom+',existingZoon= '+existingZoon )
5993 6032 var X = 0;
5994 6033 var scaledY = 0;
5995 6034 var scaledHeight = 0;
5996 6035 var scaledWidth = 0;
5997 6036  
5998   - $scope.TransparencyBoxStartX = new_startx;
  6037 + /* $scope.TransparencyBoxStartX = new_startx;
5999 6038 TransparencyEndX = new_endx;
6000 6039 $scope.TransparencyBoxStartY = new_starty;
6001 6040 TransparencyBoxEndY = new_endy;
... ... @@ -6003,7 +6042,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
6003 6042 $scope.TBoxEndY = TransparencyBoxEndY;
6004 6043 $scope.TBHeight = height;
6005 6044 $scope.TBWidth = width;
6006   -
  6045 + */
6007 6046 //if (mirrorValue != 0) {
6008 6047 // var mirroredX = parseInt(mirrorValue) + parseInt(x);
6009 6048 // var newX = (mirroredX * nzoom);
... ... @@ -6021,7 +6060,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
6021 6060 var Y1 = (newStatY / existingZoon);
6022 6061  
6023 6062 var newEndY = ($scope.TBoxEndY * nzoom);
6024   - var Y2 = (newStatY / existingZoon);
  6063 + var Y2 = (newEndY / existingZoon);
6025 6064  
6026 6065 var newHeight = ($scope.TBHeight * nzoom);
6027 6066 var ht = (newHeight / existingZoon);
... ... @@ -8321,9 +8360,11 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8321 8360  
8322 8361 $scope.enableZoom = function (event) {
8323 8362  
8324   - var len= (event.currentTarget.id).split("_").length;
  8363 +
  8364 + var len = (event.currentTarget.id).split("_").length;
8325 8365 var windowviewid = (event.currentTarget.id).split("_")[len-1];
8326 8366  
  8367 +
8327 8368 $("#OnIdentify").removeClass("annotationtoolbartab");
8328 8369 $("#DrawMode").removeClass("annotationtoolbartab");
8329 8370 $('.btnCursor').removeClass('activebtncolor');
... ... @@ -8562,6 +8603,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8562 8603 $scope.SetwindowStoreData(windowviewid, 'mode', "NORMAL");
8563 8604 $scope.SetwindowStoreData(windowviewid, 'isNormalBtnClicked', true);
8564 8605  
  8606 +
8565 8607 $scope.SetwindowStoreData(windowviewid, 'previousHighlightList', []);
8566 8608  
8567 8609 $('#btnTranparency_' + windowviewid).removeClass("disabled");
... ... @@ -8683,6 +8725,7 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8683 8725  
8684 8726 $scope.enableExtract = function (isCalledFromButton,windowviewid) {
8685 8727 $scope.SetwindowStoreData(windowviewid, 'mode', "EXTRACT");
  8728 +
8686 8729 $scope.DisableUI();
8687 8730  
8688 8731 console.log('isCalledFromButton= ' + isCalledFromButton);
... ...