From f65b4a49d619a39e31600ec8984e2dce835b4ea6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Oct 2016 12:10:45 +0530 Subject: [PATCH] Refactor Code For Font Family --- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index c5b915a..d1bf306 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -149,7 +149,7 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", //theme:"rounded" }); } - $rootScope.isFontFamilyLoaded = true; + $rootScope.isFontFamilyLoaded = false; //annotation tool custom events $rootScope.ShowAnnotationWindow = function () { //7904 @@ -165,26 +165,29 @@ AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", $("#canvas").css("display", "none"); var FontFamilyJson = '~/../content/data/json/settings/fontstyle.json'; - DataService.getJson(FontFamilyJson) + if ($rootScope.isFontFamilyLoaded == false) { + + + DataService.getJson(FontFamilyJson) .then( function (result) { $rootScope.AnnotationFontFamily = result; - // alert($rootScope.AnnotationFontFamily.FontStyle.length); - if ($rootScope.isFontFamilyLoaded == true) - for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) - { - - $("#selected-font-family").append(""); - $rootScope.isFontFamilyLoaded = false; + // alert($rootScope.AnnotationFontFamily.FontStyle.length); + + for (var i = 0; i <= $rootScope.AnnotationFontFamily.FontFamily.length - 1; i++) { + + $("#selected-font-family").append(""); + $rootScope.isFontFamilyLoaded = true; } - + }, function (error) { console.log(error.statusText) } ) + } } -- libgit2 0.21.4