From 748db360929a6f4e4bec8e918662ef6f9fc963b8 Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 11 Nov 2016 11:18:55 +0530 Subject: [PATCH] spinner lasts till the process finish. removed commented code. --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js | 107 ++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index ceeae57..14bfaac 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -735,6 +735,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //calculate coordinates for body region images $scope.CalculateImageCordinates = function (viewOrientationId) { + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + // annotation toolbar canvas if ($("#canvasDiv").find("canvas[id='canvasPaint']").length == 0) { @@ -744,6 +747,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } + + $scope.terminateCurrentlyRunningWPs(); var drawnBodyRegionCount = []; @@ -948,8 +953,8 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo }); - $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + //$rootScope.isLoading = false; + //$('#spinner').css('visibility', 'hidden'); } if (($rootScope.globalSetting.modesty == 'Y')) { @@ -1205,6 +1210,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.DrawMirroredImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + var FlipedImgCanvas = document.createElement('canvas'); FlipedImgCanvas.height = h; FlipedImgCanvas.width = w; @@ -1532,6 +1540,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //}, 500); } } + else { + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + } } // console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); @@ -1564,6 +1576,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.DrawImage = function (h, w, x, y, src, bodyRegionId, isMaskImage) { + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + var imgCanvas = document.createElement('canvas'); imgCanvas.height = h; @@ -1895,6 +1910,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } + else { + $rootScope.isLoading = false; + $('#spinner').css('visibility', 'hidden'); + } } console.log('ColoredImageSRC. pushed and length: ' + $scope.ColoredImageSRC.length); @@ -2165,7 +2184,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.aligneCanvasWithTerm() } - $timeout(function () { $scope.DisableProgressBar() }, 1000); + // $timeout(function () { $scope.DisableProgressBar() }, 1000); @@ -2399,16 +2418,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($scope.doAligneCanvasWithTerm == true) { - if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true) + if ($rootScope.isListManagerSelected == true) + $scope.aligneCanvasWithTerm(); + + else if ($rootScope.isHighlightBodyByBodySystem == true || $rootScope.isListManagerSelected == true) { $rootScope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + $('#spinner').css('visibility', 'hidden'); + } // $rootScope.isHighlightBodyByBodySystem = false; - if ($rootScope.isListManagerSelected == true) - $scope.aligneCanvasWithTerm(); + } } // @@ -5018,56 +5040,10 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $scope.flushCanvas = function () { - //if ($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined) { - // angular.forEach($scope.ColoredImageSRC, function (value, key) { - - // var id; - // var maskId; - // if (value.haveMirror == 'true') { - // id = 'imageCanvas' + value.bodyRegionId + '_MR'; - // maskId = 'imageCanvas' + value.bodyRegionId + '_MR_mci' - // } - // else { - // id = 'imageCanvas' + value.bodyRegionId; - // maskId = 'imageCanvas' + value.bodyRegionId + '_mci'; - // } - // var canvas = document.getElementById(id); - // if (canvas != null || canvas != undefined) { - // document.getElementById('canvasDiv').removeChild(canvas); - // } - - // var maskcanvas = document.getElementById(maskId); - // if (maskcanvas != null || maskcanvas != undefined) { - // document.getElementById('canvasDiv').removeChild(maskcanvas); + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); - // } - // if (i == 4 || i == 5 || i == 6) { - // id = 'imageCanvas' + i + '_MR'; - // maskId = 'imageCanvas' + i + '_MR_mci'; - - // var canvas = document.getElementById(id); - // if (canvas != null || canvas != undefined) - // document.getElementById('canvasDiv').removeChild(canvas); - - // var maskcanvas = document.getElementById(maskId); - // if (maskcanvas != null || maskcanvas != undefined) - // document.getElementById('canvasDiv').removeChild(maskcanvas); - // } - - // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - // for (var i = 0; i < modestyCanvases.length; i++) { - // modestyCanvases[i].remove(); - // } - // }); - // //remove modesty canavs - // var modestyCanvases = $("canvas[id*='imageCanvasmodestyImg']"); - // if (modestyCanvases != null || modestyCanvases != undefined && modestyCanvases.length > 0) { - // for (var j = 0; j < modestyCanvases.length; j++) { - // modestyCanvases[j].remove(); - // } - // } - //} var endIndex = 0; var startIndex = 0; if (($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) { @@ -5625,9 +5601,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo if ($scope.isEligibleForHighlightBodyByTermList == true) { //DISABLE PROGERSS BAR FOR GENDER OR VIEW CHANGE // if ($rootScope.isGenderChnage == true || $rootScope.isViewChange == true) { - $scope.isLoading = false; + //$scope.isLoading = false; - $('#spinner').css('visibility', 'hidden'); + //$('#spinner').css('visibility', 'hidden'); //} if (($rootScope.isHighlightBodyByBodySystem == true) && ($scope.systemMatchedTermList != null || $scope.systemMatchedTermList != undefined)) { @@ -7003,6 +6979,12 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo $('#spinner').css('visibility', 'hidden'); } else { + + $rootScope.isLoading = true; + + $('#spinner').css('visibility', 'visible'); + + $rootScope.prevId = event.currentTarget.id; $("#termList").find("option").attr('selected', false); $("#termList").find("option").css({ "background-color": "#ffffff", "color": "#000000" }); @@ -7025,10 +7007,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo } } //--- - $rootScope.isLoading = true; - - $('#spinner').css('visibility', 'visible'); - + $rootScope.isHighlightBodyByBodySystem = false; //1. @@ -7134,8 +7113,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //8.remove current layer canavses $scope.flushCanvas(); - - + //9. $timeout(function () { @@ -7150,6 +7128,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo //DA > Annotation's Line should not displayed. $("#bord").css("display", "none"); + $rootScope.isLoading = true; + $('#spinner').css('visibility', 'visible'); + //redraw body of respective layer $scope.CalculateImageCordinates($rootScope.viewOrientationId) }, 500); -- libgit2 0.21.4