Commit f65b4a49d619a39e31600ec8984e2dce835b4ea6
1 parent
f4b355e2
Refactor Code For Font Family
Showing
1 changed file
with
13 additions
and
10 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -149,7 +149,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
149 | 149 | //theme:"rounded" |
150 | 150 | }); |
151 | 151 | } |
152 | - $rootScope.isFontFamilyLoaded = true; | |
152 | + $rootScope.isFontFamilyLoaded = false; | |
153 | 153 | //annotation tool custom events |
154 | 154 | $rootScope.ShowAnnotationWindow = function () { |
155 | 155 | //7904 |
... | ... | @@ -165,26 +165,29 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", |
165 | 165 | $("#canvas").css("display", "none"); |
166 | 166 | |
167 | 167 | var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; |
168 | - DataService.getJson(FontFamilyJson) | |
168 | + if ($rootScope.isFontFamilyLoaded == false) { | |
169 | + | |
170 | + | |
171 | + DataService.getJson(FontFamilyJson) | |
169 | 172 | .then( |
170 | 173 | function (result) { |
171 | 174 | |
172 | 175 | $rootScope.AnnotationFontFamily = result; |
173 | - // alert($rootScope.AnnotationFontFamily.FontStyle.length); | |
174 | - if ($rootScope.isFontFamilyLoaded == true) | |
175 | - for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) | |
176 | - { | |
177 | - | |
178 | - $("#selected-font-family").append("<option>" + $rootScope.AnnotationFontFamily.FontFamily[i].FontName + "</option>"); | |
179 | - $rootScope.isFontFamilyLoaded = false; | |
176 | + // alert($rootScope.AnnotationFontFamily.FontStyle.length); | |
177 | + | |
178 | + for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) { | |
179 | + | |
180 | + $("#selected-font-family").append("<option>" + $rootScope.AnnotationFontFamily.FontFamily[i].FontName + "</option>"); | |
181 | + $rootScope.isFontFamilyLoaded = true; | |
180 | 182 | } |
181 | - | |
183 | + | |
182 | 184 | }, |
183 | 185 | function (error) { |
184 | 186 | console.log(error.statusText) |
185 | 187 | } |
186 | 188 | ) |
187 | 189 | |
190 | + } | |
188 | 191 | |
189 | 192 | } |
190 | 193 | ... | ... |