mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-10 07:05:35 +00:00
Further improvement to size ratio
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user