Commit 818ff616bf96cc93375a56b912c03c1aded5f108

Authored by Birendra
2 parents 14c16dec 282c48b8

merge transparancy box changes

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -5573,19 +5573,35 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
5573 5573 $scope.horizontlScrollPosition = canvasDiv.scrollLeft;
5574 5574  
5575 5575 var currentMousePosition = $scope.getMousePos(e.pageX,e.pageY,windowviewid);
5576   - var move_x = currentMousePosition.x + $scope.horizontlScrollPosition,
5577   - move_y = currentMousePosition.y + $scope.verticalScrollPosition,
5578   -
5579   - width = move_x - $scope.TransparencyBoxStartX,
5580   - height = move_y - $scope.TransparencyBoxStartY,
5581   - new_x, new_y;
  5576 + var move_x = currentMousePosition.x + $scope.horizontlScrollPosition;
  5577 + var move_y = currentMousePosition.y + $scope.verticalScrollPosition;
  5578 + var width = 0;
  5579 + var height = 0;
  5580 + if(move_x < $scope.TransparencyBoxStartX){
  5581 + width = $scope.TransparencyBoxStartX - move_x;
  5582 + }
  5583 + else{
  5584 + width = move_x - $scope.TransparencyBoxStartX;
  5585 + }
  5586 + if (move_y < $scope.TransparencyBoxStartY) {
  5587 + height = $scope.TransparencyBoxStartY - move_y;
  5588 + }
  5589 + else{
  5590 + height = move_y - $scope.TransparencyBoxStartY;
  5591 + }
5582 5592  
5583   - new_x = (move_x < $scope.TransparencyBoxStartX) ? ($scope.TransparencyBoxStartX - width) : $scope.TransparencyBoxStartX;
5584   - new_y = (move_y < $scope.TransparencyBoxStartY) ? ($scope.TransparencyBoxStartY - height) : $scope.TransparencyBoxStartY;
  5593 + var new_x, new_y;
5585 5594  
  5595 + new_x = (move_x < $scope.TransparencyBoxStartX) ? move_x : $scope.TransparencyBoxStartX;
  5596 + new_y = (move_y < $scope.TransparencyBoxStartY) ?move_y : $scope.TransparencyBoxStartY;
  5597 +
5586 5598 $('.rectangle').css({
  5599 + 'position': 'absolute',
  5600 + 'left': new_x,
  5601 + 'top':new_y,
5587 5602 'width': width,
5588 5603 'height': height,
  5604 +
5589 5605 //'background': 'transparent'
5590 5606  
5591 5607 });
... ... @@ -5687,12 +5703,218 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
5687 5703 $scope.transparencyDrawnRegions = [];
5688 5704 $scope.canThirdBRDrawn = false;
5689 5705  
5690   - $scope.CalculateDimensionsAndDrawTBox(windowviewid);
  5706 + var width = 0;
  5707 + var height = 0;
  5708 + if (TransparencyEndX < $scope.TransparencyBoxStartX) {
  5709 + width = $scope.TransparencyBoxStartX - TransparencyEndX;
  5710 + }
  5711 + else {
  5712 + width = TransparencyEndX - $scope.TransparencyBoxStartX;
  5713 + }
  5714 + if (TransparencyBoxEndY < $scope.TransparencyBoxStartY) {
  5715 + height = $scope.TransparencyBoxStartY - TransparencyBoxEndY;
  5716 + }
  5717 + else {
  5718 + height = TransparencyBoxEndY - $scope.TransparencyBoxStartY;
  5719 + }
  5720 +
  5721 +
  5722 + var new_startx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? TransparencyEndX : $scope.TransparencyBoxStartX;
  5723 + var new_starty = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? TransparencyBoxEndY : $scope.TransparencyBoxStartY;
  5724 + var new_endx = (TransparencyEndX < $scope.TransparencyBoxStartX) ? $scope.TransparencyBoxStartX : TransparencyEndX;
  5725 + var new_endy= (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? $scope.TransparencyBoxStartY:TransparencyBoxEndY ;
  5726 +
  5727 + $scope.TransparencyBoxStartX = new_startx;
  5728 + TransparencyEndX = new_endx;
  5729 + $scope.TransparencyBoxStartY = new_starty;
  5730 + TransparencyBoxEndY = new_endy;
  5731 +
  5732 +
  5733 +
  5734 + $.each(BodyRegionDictionary, function (index, value) {
  5735 +
  5736 +
  5737 + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width);
  5738 +
  5739 + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight;
  5740 + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth;
  5741 + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom;
  5742 + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight;
  5743 + var bodyRegionRight = tBoxDimesions.bodyRegionRight;
  5744 + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom;
  5745 + var width = 0;
  5746 + var height = 0;
  5747 + if (TransparencyEndX < $scope.TransparencyBoxStartX) {
  5748 + width = $scope.TransparencyBoxStartX - TransparencyEndX;
  5749 + }
  5750 + else {
  5751 + width = TransparencyEndX - $scope.TransparencyBoxStartX;
  5752 + }
  5753 + if (TransparencyBoxEndY < $scope.TransparencyBoxStartY) {
  5754 + height = $scope.TransparencyBoxStartY - TransparencyBoxEndY;
  5755 + }
  5756 + else {
  5757 + height = TransparencyBoxEndY - $scope.TransparencyBoxStartY;
  5758 + }
  5759 +
  5760 + var new_x, new_y;
  5761 +
  5762 + new_x = (TransparencyEndX < $scope.TransparencyBoxStartX) ? TransparencyEndX : $scope.TransparencyBoxStartX;
  5763 + new_y = (TransparencyBoxEndY < $scope.TransparencyBoxStartY) ? TransparencyBoxEndY : $scope.TransparencyBoxStartY;
  5764 +
  5765 +
  5766 + var transparencyCanvas = document.createElement('canvas');
  5767 + var tBox = document.getElementById('transparencyCanvas_'+ windowviewid);
  5768 + if (tBox == null) {
  5769 +
  5770 + transparencyCanvas.id = 'transparencyCanvas_'+ windowviewid;
  5771 + $scope.transparencyCanvasId = transparencyCanvas.id;
  5772 + transparencyCanvas.height = height;
  5773 + transparencyCanvas.width = width;
  5774 + transparencyCanvas.style.position = "absolute";
  5775 + //transparencyCanvas.style.left = $scope.startX + 'px' // x + "px";
  5776 + //transparencyCanvas.style.top = $scope.startY + "px"//y + "px";
  5777 + transparencyCanvas.style.left = new_x + 'px' // x + "px";
  5778 + transparencyCanvas.style.top = new_y + "px"
  5779 + transparencyCanvas.style.border = "black 1px solid";
  5780 + transparencyCanvas.style.backgroundColor = "transparent";
  5781 + transparencyCanvas.style.zIndex = 200;
  5782 + document.getElementById("canvasDivDA_" + windowviewid).appendChild(transparencyCanvas);
  5783 + $scope.transparencyChangeCounter = 0;
  5784 +
  5785 + $('#transparencyCanvas_' + windowviewid).resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(windowviewid); }, start: function (event, ui) { clearTransCanvas(windowviewid); } });
  5786 +
  5787 + $scope.transparencyCanvasHeight = transparencyCanvas.height;
  5788 + $scope.transparencyCanvasWidth = transparencyCanvas.width;
  5789 +
  5790 + //bind click listener
  5791 + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener);
  5792 +
  5793 + $(".ui-wrapper").css("z-index", $scope.GetwindowStoreData(windowviewid,'UIWrapperZIndex'));
  5794 +
  5795 + }
  5796 + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) {
  5797 +
  5798 + $scope.SetwindowStoreData(windowviewid,'isTBDrawnOnBodyRegion',true);
  5799 +
  5800 + if (value.bodyRegionId == '3') {
  5801 +
  5802 + var BR_SixTBData = new jinqJs()
  5803 + .from($scope.transparencyDrawnRegions)
  5804 + .where('BRID == 6')
  5805 + .select();
  5806 +
  5807 + if (BR_SixTBData != null && BR_SixTBData != undefined && BR_SixTBData.length > 0) {
  5808 +
  5809 + $scope.canThirdBRDrawn = true;
  5810 +
  5811 + }
  5812 +
  5813 +
  5814 + }
  5815 + var bodyVid=$scope.GetwindowStoreData(windowviewid,'voId');
  5816 + if (bodyVid == "9" || bodyVid == "11" || bodyVid == "2" || bodyVid == "3" || bodyVid == "6" || bodyVid == "7") {
  5817 + if (value.bodyRegionId == "6") {
  5818 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5819 + }
  5820 + else {
  5821 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5822 + }
  5823 + }
  5824 + else {
  5825 + if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == true) {
  5826 +
  5827 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5828 + }
  5829 +
  5830 + else {
  5831 +
  5832 + if (value.bodyRegionId == '3' && $scope.canThirdBRDrawn == false) {
  5833 +
  5834 + //1. draw 6th
  5835 + var BRSixData = new jinqJs()
  5836 + .from(BodyRegionDictionary)
  5837 + .where('bodyRegionId == 6')
  5838 + .select();
  5839 + var isMirror = BRSixData[0].IsMirror;
  5840 + if (isMirror == 'Yes') {
  5841 + //draw mirror arm
  5842 + $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'Yes', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5843 + //draw non mirror arm
  5844 + $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'No', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5845 + //draw 3rd BR
  5846 + $timeout(function () {
  5847 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5848 + }, 200);
  5849 + }
  5850 + else {
  5851 + //draw mirror arm
  5852 + $scope.loadTransparencyImage(BRSixData[0].bodyRegionId, BRSixData[0].Height, BRSixData[0].Width, BRSixData[0].X, BRSixData[0].Y, 'No', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5853 + //draw mirror arm
  5854 + $scope.loadTransparencyImage(BRSixData[1].bodyRegionId, BRSixData[1].Height, BRSixData[1].Width, BRSixData[1].X, BRSixData[1].Y, 'Yes', $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5855 + //draw mirror arm
  5856 + $timeout(function () {
  5857 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5858 + }, 200);
  5859 + }
  5860 +
  5861 + }
  5862 + else {
  5863 + var BR_SixTBData = new jinqJs()
  5864 + .from($scope.transparencyDrawnRegions)
  5865 + .where('BRID == 6')
  5866 + .select();
  5867 + if (value.bodyRegionId == "6" && BR_SixTBData != undefined && BR_SixTBData != null && BR_SixTBData.length > 0) { }
  5868 + else
  5869 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false, false, windowviewid);
  5870 + }
  5871 + }
  5872 +
  5873 + }
  5874 +
  5875 + }
  5876 + else {
  5877 + //when user draw TB outside body than no bodyRegion
  5878 + //is covred and nothing is drawn so the function is not called in which we are enabling UI
  5879 + $scope.EnableUI();
  5880 + }
  5881 + })
  5882 +
  5883 + //for modesty
  5884 + var modestyImageInfo=$scope.GetwindowStoreData(windowviewid,'modestyImageInfo');
  5885 + if (modestyImageInfo.length > 0) {
  5886 +
  5887 + $.each(modestyImageInfo, function (index, value) {
  5888 +
  5889 + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width);
  5890 +
  5891 + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight;
  5892 + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth;
  5893 + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom;
  5894 + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight;
  5895 + var bodyRegionRight = tBoxDimesions.bodyRegionRight;
  5896 + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom;
  5897 +
  5898 + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) {
  5899 +
  5900 + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false,false, windowviewid);
  5901 +
  5902 + }
  5903 + })
  5904 + }
  5905 +
5691 5906  
5692 5907 //
5693 5908  
5694 5909 // $('#transparencyScale').modal('show');
5695   -
  5910 + $('#transparencyScale_' + windowviewid).css('position', 'fixed');
  5911 + $('#transparencyScale_' + windowviewid).draggable({ containment: 'window', scroll: false });
  5912 + $('#transparencyScale_' + windowviewid).css('top', $scope.TBDrawStartY - 10)
  5913 + $('#transparencyScale_' + windowviewid).css('left', $scope.TBDrawStartX + 130)
  5914 + $('#transparencyScale_' + windowviewid).css('visibility', 'visible')
  5915 + $('#transparencyScale_' + windowviewid).css("z-index", "100000") //Dated:16-07-2016 Issue#4962:Transparency box should be on top.
  5916 + $("#tbSlider_" + windowviewid + " .ui-slider-range-min").css("width", "100%");
  5917 + $("#tbSlider_" + windowviewid + " .ui-slider-handle").css("left", "100%");
5696 5918 }
5697 5919 }
5698 5920  
... ...