Commit aa3440da323eb9d7ff07e6f4a690e7df125cba8f
1 parent
43643a29
handled null checks.
Showing
1 changed file
with
25 additions
and
17 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -1470,14 +1470,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -1470,14 +1470,16 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
1470 | 1470 | ||
1471 | var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId + '_MR'); | 1471 | var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId + '_MR'); |
1472 | 1472 | ||
1473 | - var width = imageCanvas.width; | ||
1474 | - var ht = imageCanvas.height; | 1473 | + if (imageCanvas != null || imageCanvas != undefined) { |
1474 | + var width = imageCanvas.width; | ||
1475 | + var ht = imageCanvas.height; | ||
1476 | + | ||
1477 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | ||
1478 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | ||
1479 | + var coloredImageDataVar = coloredImageData; | ||
1475 | 1480 | ||
1476 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | ||
1477 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | ||
1478 | - var coloredImageDataVar = coloredImageData; | ||
1479 | - | ||
1480 | $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)] = coloredImageDataVar; | 1481 | $rootScope.coloredImageMRCanvasList[parseInt(bodyRegionId)] = coloredImageDataVar; |
1482 | + } | ||
1481 | 1483 | ||
1482 | 1484 | ||
1483 | 1485 | ||
@@ -1831,15 +1833,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -1831,15 +1833,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
1831 | 1833 | ||
1832 | var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId); | 1834 | var imageCanvas = document.getElementById('imageCanvas' + bodyRegionId); |
1833 | 1835 | ||
1834 | - var width = imageCanvas.width; | ||
1835 | - var ht = imageCanvas.height; | 1836 | + if (imageCanvas != null || imageCanvas != undefined) { |
1837 | + var width = imageCanvas.width; | ||
1838 | + var ht = imageCanvas.height; | ||
1839 | + | ||
1840 | + var coloredCanvasContext = imageCanvas.getContext("2d"); | ||
1841 | + var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | ||
1842 | + var coloredImageDataVar = coloredImageData; | ||
1836 | 1843 | ||
1837 | - var coloredCanvasContext = imageCanvas.getContext("2d"); | ||
1838 | - var coloredImageData = coloredCanvasContext.getImageData(0, 0, width, ht); | ||
1839 | - var coloredImageDataVar = coloredImageData; | ||
1840 | - | ||
1841 | 1844 | ||
1842 | - $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)] = coloredImageDataVar; | 1845 | + $rootScope.coloredImageCanvasList[parseInt(bodyRegionId - 1)] = coloredImageDataVar; |
1846 | + } | ||
1843 | // | 1847 | // |
1844 | 1848 | ||
1845 | if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { | 1849 | if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { |
@@ -4896,10 +4900,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | @@ -4896,10 +4900,14 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo | ||
4896 | $scope.CalculateImageCordinates($rootScope.viewOrientationId); | 4900 | $scope.CalculateImageCordinates($rootScope.viewOrientationId); |
4897 | 4901 | ||
4898 | //3. | 4902 | //3. |
4899 | - if ($scope.zoomInOut == 25) | ||
4900 | - $('#canvasDiv').scrollLeft(0) | ||
4901 | - else | ||
4902 | - $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2) | 4903 | + if ($scope.zoomInOut == 25) { |
4904 | + if ($('#canvasDiv') != null) | ||
4905 | + $('#canvasDiv').scrollLeft(0) | ||
4906 | + } | ||
4907 | + else { | ||
4908 | + if ($('#canvasDiv') != null) | ||
4909 | + $('#canvasDiv').scrollLeft($('#canvasDiv').width() / 2) | ||
4910 | + } | ||
4903 | 4911 | ||
4904 | //remove annotation speech bubble | 4912 | //remove annotation speech bubble |
4905 | if ($('#dot').length > 0) { | 4913 | if ($('#dot').length > 0) { |