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.
This commit is contained in:
Gabriele 2014-12-14 10:00:00 +01:00
parent 95bf2ffc51
commit 16dcf39823

View File

@ -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({