memory: ensure slider is always usable

This commit is contained in:
Girish Ramakrishnan
2024-08-30 12:07:31 +02:00
parent b95285365d
commit bdf9e04963
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -629,9 +629,12 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
var nearest256m = Math.ceil(Math.max(result.memory, $scope.resources.currentMemoryLimit) / (256*1024*1024)) * 256 * 1024 * 1024;
var startTick = app.manifest.memoryLimit || (256 * 1024 * 1024);
for (var i = startTick; i <= nearest256m; i *= 2) {
// code below ensure we atleast have 2 ticks to keep the slider usable
$scope.resources.memoryTicks.push(startTick); // start tick
for (var i = startTick * 2; i < nearest256m; i *= 2) {
$scope.resources.memoryTicks.push(i);
}
$scope.resources.memoryTicks.push(nearest256m); // end tick
});
// for firefox widget update