diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index ea05c83..ff75a92 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -3922,6 +3922,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.TBDrawStartX = currentMousePosition.x; $scope.TBDrawStartY = currentMousePosition.y; + var canvasDiv = document.getElementById('canvasDiv'); + $scope.verticalScrollPosition = canvasDiv.scrollTop; + $scope.horizontlScrollPosition = canvasDiv.scrollLeft; var actulalX = currentMousePosition.x + $scope.horizontlScrollPosition var actualY = currentMousePosition.y + $scope.verticalScrollPosition @@ -3955,6 +3958,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo function mouseMoveListener(e) { + var canvasDiv = document.getElementById('canvasDiv'); + $scope.verticalScrollPosition = canvasDiv.scrollTop; + $scope.horizontlScrollPosition = canvasDiv.scrollLeft; + var currentMousePosition = $scope.getMousePos(e); var move_x = currentMousePosition.x + $scope.horizontlScrollPosition, move_y = currentMousePosition.y + $scope.verticalScrollPosition, @@ -3987,6 +3994,11 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#bord').remove(); $('#sppeachBubble').remove(); + + var previewRectangleWidth = $('.rectangle').width(); + var previewRectangleHeight = $('.rectangle').height() + + $scope.currentLayerNumber = parseInt($('#txtlayerNumber').val()); $('.rectangle').remove(); @@ -4005,126 +4017,137 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.TransparencyEndX = TransparencyEndX; $scope.TransparencyBoxEndY = TransparencyBoxEndY; - $scope.layerNumberBeforeTBDraw = parseInt($('#txtlayerNumber').val()); + if ($scope.TransparencyBoxStartX == $scope.TransparencyEndX && $scope.TransparencyBoxStartY == $scope.TransparencyBoxEndY) { + // $('#transparencyScale').css('visibility', 'hidden'); + } else { - //draw temp box to store the canvas data with original transparecy - if (document.getElementById('tempCanvas') != null) { - $('#tempCanvas').remove(); - } - if (document.getElementById('tempCanvas') == null || document.getElementById('tempCanvas') == undefined) { - var tempCanvas = document.createElement('canvas'); - tempCanvas.id = 'tempCanvas'; - // $scope.tempCanvas = transparencyCanvas.id; - tempCanvas.height = TransparencyBoxEndY - $scope.startY; - tempCanvas.width = TransparencyEndX - $scope.startX; - tempCanvas.style.position = "absolute"; - tempCanvas.style.left = 200 + 'px'; - tempCanvas.style.top = 200 + 'px'; - tempCanvas.style.backgroundColor = "transparent"; - tempCanvas.style.visibility = 'hidden'; - tempCanvas.style.border = "black 1px solid"; - document.getElementById('canvasDiv').appendChild(tempCanvas); - } + if (previewRectangleWidth == 0 && previewRectangleHeight == 0) { + } + else { + $scope.layerNumberBeforeTBDraw = parseInt($('#txtlayerNumber').val()); - $scope.isTransparencyActivated = true; + //draw temp box to store the canvas data with original transparecy + if (document.getElementById('tempCanvas') != null) { + $('#tempCanvas').remove(); + } + if (document.getElementById('tempCanvas') == null || document.getElementById('tempCanvas') == undefined) { + var tempCanvas = document.createElement('canvas'); + tempCanvas.id = 'tempCanvas'; + // $scope.tempCanvas = transparencyCanvas.id; + tempCanvas.height = TransparencyBoxEndY - $scope.startY; + tempCanvas.width = TransparencyEndX - $scope.startX; + tempCanvas.style.position = "absolute"; + tempCanvas.style.left = 200 + 'px'; + tempCanvas.style.top = 200 + 'px'; + tempCanvas.style.backgroundColor = "transparent"; + tempCanvas.style.visibility = 'hidden'; + tempCanvas.style.border = "black 1px solid"; + document.getElementById('canvasDiv').appendChild(tempCanvas); + } - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - $scope.IncludedBodyRegions = []; - $scope.transparencyDrawnRegions = []; + $scope.isTransparencyActivated = true; - $.each(BodyRegionDictionary, function (index, value) { - + var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width); + $scope.IncludedBodyRegions = []; + $scope.transparencyDrawnRegions = []; - var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; - var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; - var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; - var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; - var bodyRegionRight = tBoxDimesions.bodyRegionRight; - var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; + $.each(BodyRegionDictionary, function (index, value) { - var transparencyCanvas = document.createElement('canvas'); - var tBox = document.getElementById('transparencyCanvas'); - if (tBox == null) { - transparencyCanvas.id = 'transparencyCanvas'; - $scope.transparencyCanvasId = transparencyCanvas.id; - transparencyCanvas.height = TransparencyBoxEndY - $scope.startY; - transparencyCanvas.width = TransparencyEndX - $scope.startX; - transparencyCanvas.style.position = "absolute"; - transparencyCanvas.style.left = $scope.startX + 'px' // x + "px"; - transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; - transparencyCanvas.style.border = "black 1px solid"; - transparencyCanvas.style.backgroundColor = "transparent"; - transparencyCanvas.style.zIndex = 200; - document.getElementById('canvasDiv').appendChild(transparencyCanvas); - $scope.transparencyChangeCounter = 0; + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.X, value.Y, value.Height, value.Width); - $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(); }, start: function (event, ui) { clearTransCanvas(); } }); + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; + var bodyRegionRight = tBoxDimesions.bodyRegionRight; + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; - $scope.transparencyCanvasHeight = transparencyCanvas.height; - $scope.transparencyCanvasWidth = transparencyCanvas.width; + var transparencyCanvas = document.createElement('canvas'); + var tBox = document.getElementById('transparencyCanvas'); + if (tBox == null) { - //bind click listener - transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + transparencyCanvas.id = 'transparencyCanvas'; + $scope.transparencyCanvasId = transparencyCanvas.id; + transparencyCanvas.height = TransparencyBoxEndY - $scope.startY; + transparencyCanvas.width = TransparencyEndX - $scope.startX; + transparencyCanvas.style.position = "absolute"; + transparencyCanvas.style.left = $scope.startX + 'px' // x + "px"; + transparencyCanvas.style.top = $scope.startY + "px"//y + "px"; + transparencyCanvas.style.border = "black 1px solid"; + transparencyCanvas.style.backgroundColor = "transparent"; + transparencyCanvas.style.zIndex = 200; + document.getElementById('canvasDiv').appendChild(transparencyCanvas); + $scope.transparencyChangeCounter = 0; - $(".ui-wrapper").css("z-index", "600"); + $('#transparencyCanvas').resizable({ handles: "e,s,se,w,n,ne,nw,sw", stop: function (event, ui) { resizeTransparencyBox(); }, start: function (event, ui) { clearTransCanvas(); } }); - } - if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + $scope.transparencyCanvasHeight = transparencyCanvas.height; + $scope.transparencyCanvasWidth = transparencyCanvas.width; - $scope.isTBDrawnOnBodyRegion = true; + //bind click listener + transparencyCanvas.addEventListener('click', TransparencyCanvasClickListener); + + $(".ui-wrapper").css("z-index", "600"); - if (($rootScope.voId == "9" || $rootScope.voId == "11")) { - if (value.bodyRegionId == "6") { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); } - else { + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + + $scope.isTBDrawnOnBodyRegion = true; + + if (($rootScope.voId == "9" || $rootScope.voId == "11")) { + if (value.bodyRegionId == "6") { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + } + else { + + } + } + else { + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + } } - } - else { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.X, value.Y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + }) - } - } - }) + //for modesty + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { + $.each($scope.modestyImageInfo, function (index, value) { - //for modesty - if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { - $.each($scope.modestyImageInfo, function (index, value) { - - var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width); + var tBoxDimesions = $scope.getTBoxDimesions($scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, value.x, value.y, value.Height, value.Width); - var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; - var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; - var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; - var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; - var bodyRegionRight = tBoxDimesions.bodyRegionRight; - var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; + var transparencyBoxHeight = tBoxDimesions.transparencyBoxHeight; + var transparencyBoxWidth = tBoxDimesions.transparencyBoxWidth; + var transparencyBoxBottom = tBoxDimesions.transparencyBoxBottom; + var transparencyBoxRight = tBoxDimesions.transparencyBoxRight; + var bodyRegionRight = tBoxDimesions.bodyRegionRight; + var bodyRegionBottom = tBoxDimesions.bodyRegionBottom; - if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { + if ($scope.TransparencyBoxStartX <= bodyRegionRight && value.x <= transparencyBoxRight && $scope.TransparencyBoxStartY <= bodyRegionBottom && value.y <= transparencyBoxBottom) { - $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + $scope.loadTransparencyImage(value.bodyRegionId, value.Height, value.Width, value.x, value.y, value.IsMirror, $scope.TransparencyBoxStartX, TransparencyEndX, $scope.TransparencyBoxStartY, TransparencyBoxEndY, $scope, false, false); + } + }) } - }) - } - // - // $('#transparencyScale').modal('show'); - $('#transparencyScale').css('position', 'fixed') - $('#transparencyScale').css('top', $scope.TBDrawStartY - 10) - $('#transparencyScale').css('left', $scope.TBDrawStartX + 130) - $('#transparencyScale').css('visibility', 'visible') - $('#transparencyScale').css("z-index", "100000") //Dated:16-07-2016 Issue#4962:Transparency box should be on top. + // + // $('#transparencyScale').modal('show'); + $('#transparencyScale').css('position', 'fixed') + $('#transparencyScale').css('top', $scope.TBDrawStartY - 10) + $('#transparencyScale').css('left', $scope.TBDrawStartX + 130) + $('#transparencyScale').css('visibility', 'visible') + $('#transparencyScale').css("z-index", "100000") //Dated:16-07-2016 Issue#4962:Transparency box should be on top. + + } + } document.getElementById('canvasDiv').removeEventListener("mousedown", mouseDownListener); document.getElementById('canvasDiv').removeEventListener("mousemove", mouseMoveListener);