Browse Source

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.
adaptive-webui-19844
Gabriele 10 years ago
parent
commit
16dcf39823
  1. 13
      src/webui/www/public/scripts/client.js

13
src/webui/www/public/scripts/client.js

@ -49,11 +49,16 @@ window.addEvent('load', function () { @@ -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 () { @@ -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({

Loading…
Cancel
Save