Commit 8f52532a29b56ad0e4a70faa8c16660c8be7fa14
1 parent
b8cc46a2
in last commit, asynchronous code was removed by mistake. now it is having async…
…hronous http call code and also the minmize button is positioned correctly in every case.
Showing
2 changed files
with
169 additions
and
140 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
1 | - 'use strict'; | |
1 | +'use strict'; | |
2 | 2 | |
3 | -AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", | |
4 | -function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam) { | |
3 | +AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "GetJsonService", | |
4 | +function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, GetJsonService) { | |
5 | 5 | |
6 | 6 | $scope.genderId = ""; |
7 | 7 | $scope.BodyViewData; |
... | ... | @@ -20,6 +20,30 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
20 | 20 | $scope.daCounter = 1; |
21 | 21 | |
22 | 22 | |
23 | + $scope.genderId = ""; | |
24 | + $scope.BodyViewData; | |
25 | + $scope.selectedGenderBodyViewData; | |
26 | + $scope.imagePath = ""; | |
27 | + $scope.BodyRegionData; | |
28 | + $scope.BodyRegionCordinatesData; | |
29 | + $scope.isTransparencyActivated; | |
30 | + $scope.BodyLayerData; | |
31 | + $scope.VocabTermData; | |
32 | + $scope.TermNumberData; | |
33 | + $scope.bodyViewId = 0; | |
34 | + //view specific constants | |
35 | + $scope.voId; | |
36 | + $scope.layerNumber; | |
37 | + $scope.daCounter = 1; | |
38 | + | |
39 | + $scope.isBodylayerdataLoaded = false; | |
40 | + $scope.isBodyRegionDataLoaded = false; | |
41 | + $scope.showme = false; | |
42 | + $scope.IsVisible = function () { | |
43 | + $scope.showme = $scope.showme ? false : true; | |
44 | + } | |
45 | + | |
46 | + | |
23 | 47 | //get the DA body view list based on selected gender |
24 | 48 | $scope.getDAViewList = function ($event) { |
25 | 49 | |
... | ... | @@ -147,124 +171,140 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
147 | 171 | //da-body-view functions |
148 | 172 | |
149 | 173 | $scope.openBodyView = function () { |
174 | + //debugger; | |
150 | 175 | |
176 | + //load bodyRegion data | |
177 | + var brViewdata = GetJsonService.getJson('~/../content/data/json/da_dat_brview.json') | |
178 | + brViewdata.then( | |
179 | + function (result) { | |
180 | + // debugger; | |
181 | + $scope.BodyRegionData = result; | |
182 | + $scope.isBodyRegionDataLoaded = true; | |
183 | + // alert('da_dat_brview= ' + result) | |
184 | + | |
185 | + //get layer data for body view | |
186 | + GetJsonService.getAnotherJson('~/../content/data/json/da_dat_layer_1.json') | |
187 | + .then( | |
188 | + function (result) { | |
189 | + //debugger; | |
190 | + | |
191 | + $scope.BodyLayerData = result; | |
192 | + $scope.isBodylayerdataLoaded = true; | |
193 | + | |
194 | + //load json for annotations | |
195 | + $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) { | |
196 | + $scope.TermNumberData = data; | |
197 | + }) | |
198 | + .error(function (data, status, headers, config) { | |
199 | + console.log(data); | |
200 | + }); | |
201 | + | |
202 | + //load vocabterm data | |
203 | + $http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) { | |
204 | + $scope.VocabTermData = data; | |
205 | + }) | |
206 | + .error(function (data, status, headers, config) { | |
207 | + console.log(data); | |
208 | + }); | |
209 | + | |
210 | + | |
211 | + | |
212 | + var openViews; | |
213 | + | |
214 | + var currentBodyViewId = localStorage.getItem("currentBodyViewId"); | |
215 | + // debugger; | |
216 | + if ($rootScope.openViews.length > 0) { | |
217 | + openViews = new jinqJs() | |
218 | + .from($rootScope.openViews) | |
219 | + .where("BodyViewId==" + currentBodyViewId) | |
220 | + .select(); | |
221 | + } | |
222 | + var counter = 1; | |
223 | + | |
224 | + // var tittle = $rootScope.ViewTitle; | |
225 | + var tittle = localStorage.getItem("currentViewTitleFromJson"); | |
226 | + | |
227 | + if (openViews != null && openViews.length > 0) { | |
228 | + angular.forEach(openViews, function (value, key) { | |
229 | + | |
230 | + if (value.BodyView == tittle) { | |
231 | + tittle = localStorage.getItem("currentViewTitleFromJson") + counter++; | |
232 | + $rootScope.currentActiveViewTitle = tittle; | |
233 | + localStorage.setItem("currentViewTitle", tittle); | |
234 | + } | |
151 | 235 | |
152 | - //load json | |
153 | - $http({ method: 'GET', url: '~/../content/data/json/da_dat_tm_sg_1.json' }).success(function (data) { | |
154 | - $scope.TermNumberData = data; | |
155 | - }) | |
156 | - .error(function (data, status, headers, config) { | |
157 | - console.log(data); | |
158 | - }); | |
159 | - | |
160 | - | |
161 | - //load vocabterm data | |
162 | - $http({ method: 'GET', url: '~/../content/data/json/cm_dat_vocabterm_1.json' }).success(function (data) { | |
163 | - $scope.VocabTermData = data; | |
164 | - }) | |
165 | - .error(function (data, status, headers, config) { | |
166 | - console.log(data); | |
167 | - }); | |
168 | - | |
169 | - | |
170 | - | |
171 | - var openViews; | |
172 | - var currentBodyViewId = localStorage.getItem("currentBodyViewId"); | |
173 | - // debugger; | |
174 | - if ($rootScope.openViews.length > 0) { | |
175 | - openViews = new jinqJs() | |
176 | - .from($rootScope.openViews) | |
177 | - .where("BodyViewId==" + currentBodyViewId) | |
178 | - .select(); | |
179 | - } | |
180 | - var counter = 1; | |
181 | - | |
182 | - // var tittle = $rootScope.ViewTitle; | |
183 | - var tittle = localStorage.getItem("currentViewTitleFromJson"); | |
184 | - | |
185 | - if (openViews != null && openViews.length > 0) { | |
186 | - angular.forEach(openViews, function (value, key) { | |
187 | - | |
188 | - if (value.BodyView == tittle) { | |
189 | - tittle = localStorage.getItem("currentViewTitleFromJson") + counter++; | |
190 | - $rootScope.currentActiveViewTitle = tittle; | |
191 | - localStorage.setItem("currentViewTitle", tittle); | |
192 | - } | |
193 | - | |
194 | - }); | |
195 | - } | |
196 | - else { | |
197 | - localStorage.setItem("currentViewTitle", tittle); | |
198 | - } | |
236 | + }); | |
237 | + } | |
238 | + else { | |
239 | + localStorage.setItem("currentViewTitle", tittle); | |
240 | + } | |
199 | 241 | |
200 | - $http({ method: 'GET', url: '~/../content/data/json/da_dat_brview.json' }).success(function (data) { | |
201 | 242 | |
202 | - $scope.BodyRegionData = data; | |
203 | - // console.log($scope.BodyRegionData); | |
204 | - // alert(' $scope.BodyRegionData= ' + $scope.BodyRegionData) | |
205 | - }) | |
206 | - .error(function (data, status, headers, config) { | |
207 | - console.log(data); | |
208 | - }); | |
243 | + $.jsPanel({ | |
244 | + id: 'daImagePanel', | |
245 | + selector: '.daBodyView', | |
246 | + theme: 'success', | |
247 | + ajax: { | |
248 | + url: 'app/views/da/da-view.html' | |
249 | + }, | |
250 | + title: localStorage.getItem("currentViewTitle"), | |
251 | + position: { | |
252 | + top: 70, | |
253 | + left: 1, | |
254 | + }, | |
209 | 255 | |
256 | + size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 }, | |
210 | 257 | |
211 | - // Load Layer data | |
212 | - $http({ method: 'GET', url: '~/../content/data/json/da_dat_layer_1.json' }).success(function (data) { | |
213 | - // debugger | |
214 | - $scope.BodyLayerData = data; | |
215 | - // console.log($scope.BodyLayerData); | |
258 | + }); | |
216 | 259 | |
217 | - }) | |
218 | - .error(function (data, status, headers, config) { | |
219 | - console.log(data); | |
220 | - }); | |
221 | 260 | |
222 | - $.jsPanel({ | |
223 | - id: 'daImagePanel', | |
224 | - selector: '.daBodyView', | |
225 | - theme: 'success', | |
226 | - ajax: { | |
227 | - url: 'app/views/da/da-view.html' | |
228 | - }, | |
229 | - title: localStorage.getItem("currentViewTitle"), | |
230 | - position: { | |
231 | - top: 70, | |
232 | - left: 1, | |
233 | - }, | |
234 | - | |
235 | - size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 }, | |
236 | 261 | |
237 | - }); | |
238 | 262 | |
239 | 263 | |
240 | 264 | |
265 | + // $rootScope.openViewsDA.push({ "ViewId": 1 }); | |
266 | + $rootScope.currentSlug = 'da-body-view'; | |
241 | 267 | |
268 | + //hide scrollbar | |
242 | 269 | |
243 | 270 | |
244 | - // $rootScope.openViewsDA.push({ "ViewId": 1 }); | |
245 | - $rootScope.currentSlug = 'da-body-view'; | |
271 | + $rootScope.openViews.push( | |
272 | + { | |
273 | + "module": $rootScope.currentActiveModuleTitle, "BodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, | |
274 | + "slug": $rootScope.currentSlug | |
275 | + } | |
276 | + ); | |
277 | + // debugger; | |
246 | 278 | |
247 | - //hide scrollbar | |
279 | + var e1 = angular.element(document.getElementById("daBodyview")); | |
280 | + $timeout(function () { $compile(e1.contents())($scope) }, 250); | |
281 | + // $compile(e1.contents())($scope); | |
248 | 282 | |
283 | + $('#daBodyview').css("height", $(window).outerHeight()); | |
249 | 284 | |
250 | - $rootScope.openViews.push( | |
251 | - { | |
252 | - "module": $rootScope.currentActiveModuleTitle, "BodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, | |
253 | - "slug": $rootScope.currentSlug | |
254 | - } | |
255 | - ); | |
256 | - // debugger; | |
285 | + $('#daBodyview').css("width", $(window).outerWidth()); | |
257 | 286 | |
258 | - var e1 = angular.element(document.getElementById("daBodyview")); | |
259 | - $timeout(function () { $compile(e1.contents())($scope) }, 250); | |
260 | - // $compile(e1.contents())($scope); | |
287 | + // debugger | |
288 | + if ($scope.isBodylayerdataLoaded) { | |
289 | + $timeout(function () { $scope.LoadDefaultLayerImage() }, 350); | |
290 | + } | |
291 | + }, | |
292 | + function (error) { | |
293 | + // handle errors here | |
294 | + console.log(' $scope.BodyLayerData= ' + error.statusText); | |
295 | + } | |
296 | + ); | |
297 | + }, | |
298 | + function (error) { | |
299 | + // handle errors here | |
300 | + console.log(' $scope.BodyRegionData = ' + error.statusText); | |
301 | + } | |
302 | + ); | |
261 | 303 | |
304 | + // debugger | |
262 | 305 | $('#daBodyview').css("height", $(window).outerHeight()); |
263 | 306 | |
264 | 307 | $('#daBodyview').css("width", $(window).outerWidth()); |
265 | - | |
266 | - $timeout(function () { $scope.LoadDefaultLayerImage() }, 350); | |
267 | - | |
268 | 308 | } |
269 | 309 | |
270 | 310 | angular.element(document).ready(function () { |
... | ... | @@ -289,46 +329,21 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
289 | 329 | $scope.layerNumber = 0; |
290 | 330 | $scope.skinTone = DA[0].ethnicity; |
291 | 331 | |
292 | - $timeout(function () { $scope.CalculateImageCordinates($scope.voId); }, 350); | |
293 | - | |
332 | + // $timeout(function () { $scope.CalculateImageCordinates($scope.voId); }, 350); | |
294 | 333 | |
334 | + $scope.CalculateImageCordinates($scope.voId); | |
295 | 335 | }; |
296 | 336 | |
297 | 337 | |
298 | 338 | //calculate coordinates for body region images |
299 | 339 | $scope.CalculateImageCordinates = function (viewOrientationId) { |
300 | 340 | |
301 | - // debugger; | |
302 | - //load json data | |
303 | - // $http({ method: 'GET', url: '~/../content/data/json/da_dat_brview.json' }).success(function (data) { | |
304 | - // alert('da_dat_brview.json') | |
305 | - // $scope.BodyRegionData = data; | |
306 | - // alert(data) | |
307 | - // // console.log($scope.BodyRegionData); | |
308 | - // }) | |
309 | - //.error(function (data, status, headers, config) { | |
310 | - // console.log(data); | |
311 | - //}); | |
312 | - | |
313 | - | |
314 | - // // Load Layer data | |
315 | - // $http({ method: 'GET', url: '~/../content/data/json/da_dat_layer_1.json' }).success(function (data) { | |
316 | - // // debugger | |
317 | - // $scope.BodyLayerData = data; | |
318 | - // console.log($scope.BodyLayerData); | |
319 | - | |
320 | - // }) | |
321 | - // .error(function (data, status, headers, config) { | |
322 | - // console.log(data); | |
323 | - // }); | |
324 | - | |
325 | - | |
326 | - | |
327 | - $('#daBodyview').css('width', '100%') | |
341 | + | |
328 | 342 | |
329 | 343 | //set height of canvas div and left tool bar as per window size |
330 | 344 | $scope.BodyRegionCordinatesData = []; // create an empty array |
331 | 345 | |
346 | + $('#daBodyview').css('width', '100%'); | |
332 | 347 | $('#canvasDiv').css('height', $('#daImagePanel').outerHeight() - 104) |
333 | 348 | //$('#canvasDiv').css('width', $('#daImagePanel').outerWidth() - 100) |
334 | 349 | $('#leftToolBar').css('height', $('#daImagePanel').outerHeight()) |
... | ... | @@ -425,15 +440,17 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
425 | 440 | |
426 | 441 | |
427 | 442 | }); |
428 | - // debugger; | |
429 | - // var isiOSSafari = (navigator.userAgent.match(/like Mac OS X/i)) ? true : false; | |
443 | + | |
444 | + //set scrollbars on canvas and hide loading label | |
445 | + // debugger; | |
446 | + // var isiOSSafari = (navigator.userAgent.match(/like Mac OS X/i)) ? true : false; | |
430 | 447 | var isiOSSafari = (navigator.userAgent.match(/iPad/i)) ? true : false; |
431 | 448 | |
432 | 449 | //set scrollbars on canvas and hide loading label |
433 | 450 | $('#daLoaderLabel').css('visibility', 'hidden') |
434 | 451 | $('#canvasDiv').css('overflow', 'scroll') |
435 | 452 | if (isiOSSafari) { |
436 | - $('#canvasDiv').scrollLeft($('#canvasDiv').width()+150) | |
453 | + $('#canvasDiv').scrollLeft($('#canvasDiv').width() + 150) | |
437 | 454 | |
438 | 455 | } |
439 | 456 | else { |
... | ... | @@ -445,7 +462,6 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
445 | 462 | // debugger; |
446 | 463 | $('#layerChangeSlider').slider("option", "value", parseInt($scope.totalLayers) - parseInt($scope.layerNumber)); |
447 | 464 | |
448 | - | |
449 | 465 | } |
450 | 466 | |
451 | 467 | function scaleRectangle(x, y, height, width, mirrorValue) { |
... | ... | @@ -493,7 +509,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
493 | 509 | |
494 | 510 | |
495 | 511 | $scope.GetImageSource = function (bodyRegionId) { |
496 | - // debugger; | |
512 | + // debugger; | |
497 | 513 | var dataLength = $scope.BodyLayerData.Layers.DataLayer.length; |
498 | 514 | |
499 | 515 | //set max for LayerNumber input |
... | ... | @@ -524,7 +540,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
524 | 540 | } |
525 | 541 | |
526 | 542 | else { |
527 | - for (var z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { | |
543 | + for (z = 0; z <= SelectedLayerData.BodyRegion.length; z++) { | |
528 | 544 | var bodyRegion = SelectedLayerData.BodyRegion[z]._BodyRegionId; |
529 | 545 | if (bodyRegion == bodyRegionId) { |
530 | 546 | return "content/images/DA/BodyViews/" + $scope.voId + "/layers/" + $scope.layerNumber + "/" + bodyRegionId + "/" + SelectedLayerData.BodyRegion[z].Image._ImageName; |
... | ... | @@ -922,7 +938,9 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
922 | 938 | } |
923 | 939 | } |
924 | 940 | } |
925 | - | |
941 | + if (state == 'max') { | |
942 | + $('#daBodyview').css('width', '100%') | |
943 | + } | |
926 | 944 | } |
927 | 945 | |
928 | 946 | $scope.changeLayer = function () { |
... | ... | @@ -1012,6 +1030,4 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
1012 | 1030 | |
1013 | 1031 | }] |
1014 | 1032 | |
1015 | - | |
1016 | - | |
1017 | -); | |
1018 | 1033 | \ No newline at end of file |
1034 | +); | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/jquery/jquery_plugin/jsPanel/jspanel/jquery.jspanel.js
... | ... | @@ -78,7 +78,7 @@ var jsPanel = { |
78 | 78 | '<div class="jsPanel-btn-close ng-click= openBodyView"><span class="jsglyph jsglyph-remove"></span></div>' + |
79 | 79 | '<div class="jsPanel-btn-max"><span class="jsglyph jsglyph-maximize"></span></div>' + |
80 | 80 | '<div class="jsPanel-btn-norm"><span class="jsglyph jsglyph-normalize"></span></div>' + |
81 | - '<div class="jsPanel-btn-min"><span class="fa fa-minus"></span></div>' + | |
81 | + '<div class="jsPanel-btn-min"><span id="minSpan" class="fa fa-minus"></span></div>' + | |
82 | 82 | |
83 | 83 | //'<div class="jsPanel-btn-min"><span class="jsglyph jsglyph-minimize"></span></div>' + |
84 | 84 | //'<div class="jsPanel-btn-small"><span class="jsglyph jsglyph-chevron-up"></span></div>' + |
... | ... | @@ -669,6 +669,8 @@ var jsPanel = { |
669 | 669 | hideControls: function (sel, panel) { |
670 | 670 | var controls = panel.header.controls; |
671 | 671 | $("*", controls).css('display', 'block'); |
672 | + $('#minSpan').css({ 'display': '' }); | |
673 | + | |
672 | 674 | $(sel, controls).css('display', 'none'); |
673 | 675 | }, |
674 | 676 | |
... | ... | @@ -858,17 +860,22 @@ var jsPanel = { |
858 | 860 | //nikita |
859 | 861 | if (panel.outerHeight() >= 435 && panel.outerWidth() >= 650) { |
860 | 862 | //alert('if') |
863 | + // debugger; | |
861 | 864 | $('#canvasDiv').css('height', panel.outerHeight() - 85) |
862 | - $('#canvasDiv').css('width', panel.outerWidth() - 100) | |
865 | + $('#canvasDiv').css('width', panel.outerWidth() - 90) | |
863 | 866 | $('#canvasDiv').css('overflow', 'scroll') |
864 | 867 | } |
865 | 868 | else { |
866 | 869 | // alert('else') |
867 | 870 | $('#canvasDiv').css('height', panel.outerHeight() - 105) |
868 | - $('#canvasDiv').css('width', panel.outerWidth() - 90) | |
871 | + $('#canvasDiv').css('width', panel.outerWidth() - 80) | |
869 | 872 | $('#canvasDiv').css('overflow', 'scroll') |
873 | + | |
870 | 874 | } |
871 | 875 | //nikita |
876 | + // debugger; | |
877 | + // $(".fa-minus").removeClass('display'); | |
878 | + $('#minSpan').css({ 'display': '' }); | |
872 | 879 | }, |
873 | 880 | |
874 | 881 | // calls functions to maximize a jsPanel |
... | ... | @@ -1117,6 +1124,7 @@ var jsPanel = { |
1117 | 1124 | } |
1118 | 1125 | panel.content.css({ |
1119 | 1126 | height: (panel.outerHeight() - hdrftr), |
1127 | + //nikita | |
1120 | 1128 | width: panel.outerWidth() |
1121 | 1129 | }); |
1122 | 1130 | return panel; |
... | ... | @@ -1681,6 +1689,11 @@ console.log("jsPanel version: " + jsPanel.version); |
1681 | 1689 | // debugger; |
1682 | 1690 | e.preventDefault(); |
1683 | 1691 | jsPanel.maximize(jsP); |
1692 | + | |
1693 | + $('.jsPanel-btn-min').css('display', 'initial'); | |
1694 | + $('.fa fa-minus').css('display', 'initial'); | |
1695 | + | |
1696 | + | |
1684 | 1697 | |
1685 | 1698 | var headerTitle = $('.jsPanel-title'); |
1686 | 1699 | var title = headerTitle[0].innerHTML; | ... | ... |