From 16dcf398238229ce7e3780da7fee6d88bc9a5116 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sun, 14 Dec 2014 10:00:00 +0100 Subject: [PATCH] WebUI: Use relative sizes when saving panel height This should prevent situations in which the properties panel completely covers the transferlist on page load. Save also the height whenever the window is resized since that changes the height of the panels without saving the height. --- src/webui/www/public/scripts/client.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/webui/www/public/scripts/client.js b/src/webui/www/public/scripts/client.js index 721af0bd2..a01eed5d4 100644 --- a/src/webui/www/public/scripts/client.js +++ b/src/webui/www/public/scripts/client.js @@ -49,11 +49,16 @@ window.addEvent('load', function () { var saveColumnSizes = function () { var filters_width = $('Filters').getSize().x; - var properties_height = $('propertiesPanel').getSize().y; + var properties_height_rel = $('propertiesPanel').getSize().y / Window.getSize().y; localStorage.setItem('filters_width', filters_width); - localStorage.setItem('properties_height', properties_height); + localStorage.setItem('properties_height_rel', properties_height_rel); } + window.addEvent('resize', function() { + // Resizing might takes some time. + saveColumnSizes.delay(200); + }); + /*MochaUI.Desktop = new MochaUI.Desktop(); MochaUI.Desktop.desktop.setStyles({ 'background': '#fff', @@ -310,9 +315,9 @@ window.addEvent('load', function () { onResize : saveColumnSizes, height : null }); - var prop_h = localStorage.getItem('properties_height'); + var prop_h = localStorage.getItem('properties_height_rel'); if ($defined(prop_h)) - prop_h = prop_h.toInt(); + prop_h = prop_h.toFloat() * Window.getSize().y; else prop_h = Window.getSize().y / 2.; new MochaUI.Panel({