Commit 5526609f87cb726091d62fa42acb0f6d86d7f8e5
1 parent
748a5dd8
Null check on get image source
Showing
1 changed file
with
33 additions
and
9 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -975,14 +975,20 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
975 | 975 | |
976 | 976 | $scope.GetMaskImageSource = function (src) { |
977 | 977 | |
978 | - if (src.match('.png')) { | |
979 | - var mciImage = src.replace('.png', '_mci.png') | |
978 | + if (src != null || src != undefined) { | |
979 | + if (src.match('.png')) { | |
980 | + var mciImage = src.replace('.png', '_mci.png') | |
981 | + } | |
982 | + else { | |
983 | + var mciImage = src.replace('.jpg', '_mci.png') | |
984 | + } | |
985 | + return mciImage; | |
986 | + | |
980 | 987 | } |
981 | - else { | |
982 | - var mciImage = src.replace('.jpg', '_mci.png') | |
988 | + else | |
989 | + { | |
990 | + console.log('IMAGE.SOURCE.NOLT.FOUND'); | |
983 | 991 | } |
984 | - return mciImage; | |
985 | - | |
986 | 992 | } |
987 | 993 | |
988 | 994 | |
... | ... | @@ -1006,16 +1012,34 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1006 | 1012 | SelectedLayerData = $rootScope.BodyLayerData.Layers.DataLayer[dataLength - $scope.userInput - 1]; |
1007 | 1013 | if ((SelectedLayerData != null || SelectedLayerData != undefined)) |
1008 | 1014 | |
1009 | - if ($scope.layerNumber == 0) { | |
1015 | + if ($scope.layerNumber == 0) | |
1016 | + { | |
1017 | + console.log('lNo: ' + $scope.layerNumber + ' and BodyRegion.length: ' + SelectedLayerData.BodyRegion.length); | |
1018 | + | |
1010 | 1019 | if (SelectedLayerData.BodyRegion.length > 0) { |
1011 | 1020 | for (var z = 0; z < SelectedLayerData.BodyRegion.length; z++) { |
1012 | 1021 | |
1013 | 1022 | var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; |
1014 | 1023 | var bodyRegionSkinTone = SelectedLayerData.BodyRegion[z].Image._SkintTone; |
1015 | 1024 | |
1016 | - if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { | |
1025 | + if ($rootScope.voId == 3) | |
1026 | + { | |
1027 | + console.log('$rootScope.voId: ' + $rootScope.voId); | |
1017 | 1028 | |
1018 | - return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1029 | + if (bodyRegion == 1 && bodyRegionSkinTone != $scope.skinTone) { | |
1030 | + | |
1031 | + console.log('path:'+ "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName); | |
1032 | + | |
1033 | + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1034 | + } | |
1035 | + } | |
1036 | + | |
1037 | + else { | |
1038 | + | |
1039 | + if (bodyRegion == bodyRegionId && bodyRegionSkinTone == $scope.skinTone) { | |
1040 | + | |
1041 | + return "content/images/DA/" + $scope.zoomInOut + "/body-views/" + $rootScope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + $scope.skinTone + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; | |
1042 | + } | |
1019 | 1043 | } |
1020 | 1044 | } |
1021 | 1045 | } | ... | ... |