Further improvement to size ratio

This commit is contained in:
Colin McLeod
2015-07-26 22:38:01 -07:00
parent 164e9f5c8a
commit ab18228131
8 changed files with 45 additions and 21 deletions

View File

@@ -257,7 +257,7 @@ angular.module('app').service('Persist', ['$window', 'lodash', function($window,
/**
* Retrieve the last router state from local storage
* @param {object} state State object containing state name and params
* @return {object} state State object containing state name and params
*/
this.getState = function() {
if (this.lsEnabled) {
@@ -279,6 +279,30 @@ angular.module('app').service('Persist', ['$window', 'lodash', function($window,
}
};
/**
* Retrieve the last router state from local storage
* @return {number} size Ratio
*/
this.getSizeRatio = function() {
if (this.lsEnabled) {
var ratio = localStorage.getItem('sizeRatio');
if (!isNaN(ratio) && ratio > 0.6) {
return ratio
}
}
return 1;
};
/**
* Save the current size ratio to localstorage
* @param {number} sizeRatio
*/
this.setSizeRatio = function(sizeRatio) {
if (this.lsEnabled) {
localStorage.setItem('sizeRatio', sizeRatio);
}
};
/**
* Check if localStorage is enabled/active
* @return {Boolean} True if localStorage is enabled