diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index eab1cd9..3c3e811 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -964,7 +964,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if (($rootScope.globalSetting.modesty == 'Y')) { if ($('.modestyImg') != null) { - // $('.modestyImg').css('visibility', 'visible'); + $('.modestyImg').css('visibility', 'visible'); } } //set scrollbars on canvas and hide loading label @@ -4298,7 +4298,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo tempImg.onload = function () { - debugger; var tempCtx = transparencyTempCanvas.getContext('2d'); if (IsMirror == 'Yes') { @@ -4330,7 +4329,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //check if transparency is activated - var transNumber = 50;//$scope.transNumber;//txtTransparencyChange.value; + var transNumber = $scope.transNumber;//txtTransparencyChange.value; // debugger; //this changes the transparency when transparency is already activated and user resizes or chage the layer @@ -4484,18 +4483,51 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo // if (isTransparencyChanged == true) { // var txtTransparencyChange = document.getElementById("txtTransparencyChange"); - //var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); - //if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { - // debugger - // for (var j = 0; j < modestyTransCanvases.length; j++) { - // var ctx = document.getElementById(modestyTransCanvases[j]).getContext('2d'); - // var ImgData = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); - // //modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]); - // } - //} var transNumber = $scope.transNumber; + var modestyTransCanvases = $("canvas[id*='modestyTransCanavs']"); + var modestyTemCanvas = $("canvas[id*='tempCanvasModesty_']"); + if (modestyTransCanvases != null || modestyTransCanvases != undefined && modestyTransCanvases.length > 0) { + + for (var j = 0; j < modestyTransCanvases.length; j++) { + var ctx = document.getElementById(modestyTransCanvases[j].id).getContext('2d'); + var imageDa = ctx.getImageData(0, 0, modestyTransCanvases[j].width, modestyTransCanvases[j].height); + //modestyTransCanvases[j].parentNode.removeChild(modestyTransCanvases[j]); + + var imageData = imageDa.data; + var length = imageData.length; + // set every fourth value to 50 + for (var i = 3; i < length; i += 4) { + //NIKITA + if ($scope.voId == "9" || $scope.voId == "11") { + + if (imageData[i] == 0) { + + } + else { + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + } + else { + if (imageData[i] == 0) { + + } + else + imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + + // imageData[i] = ((255) * (parseInt(transNumber))) / 100; + } + // after the manipulation, reset the data + // imageDa.data = imageData; + // and put the imagedata back to the canvas + //ctx.putImageData(imageDa, XforTransImage, YforTransImage); + ctx.putImageData(imageDa, 0, 0); + } + } + + var ctx = document.getElementById('transparencyCanvas').getContext('2d'); // var imageDa = ctx.getImageData(XforTransImage, YforTransImage, WidthforTransImage, HeightforTransImage); @@ -5043,25 +5075,24 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo ctx.putImageData(originalTransparencyData, 0, 0); - var BodyRegionDictionary = $rootScope.BodyRegionCordinatesData; - - $scope.IncludedBodyRegions = []; - var counter = 0; - $.each(BodyRegionDictionary, function (index, value) { - - var bodyRegionRight = parseInt(value.X) + parseInt(value.Width); - var bodyRegionBottom = parseInt(value.Y) + parseInt(value.Height); - - - - if (tBoxStartX <= bodyRegionRight && value.X <= transparencyBoxRight && tBoxStartY <= bodyRegionBottom && value.Y <= transparencyBoxBottom) { + //for modesty - $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); + //for modesty + if ($rootScope.isModestyOn == true && $scope.modestyImageInfo.length > 0) { + $.each($scope.modestyImageInfo, function (index, value) { - } + var brId = value.bodyRegionId; - }); + var modestyTransTempCanvasId = 'tempCanvasModesty_' + brId; + var modestyTransCanvasId = 'modestyTransCanavs_' + brId; + var tempCanvasContext = document.getElementById(modestyTransTempCanvasId).getContext('2d'); + var originalTransparencyData = tempCanvasContext.getImageData(0, 0, value.Width, value.Height); + var ctx = document.getElementById(modestyTransCanvasId).getContext('2d'); + ctx.putImageData(originalTransparencyData, 0, 0); + }) + } + $scope.changeTransparency(); // });