mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-11 00:18:25 +01:00
Fix splitter widget did not restore size from preference
Two problems: 1. Preference was stored as percent which splitter did not like to load directly 2. Etemplate was triggering the final finish-up, which triggered resize(), which stored the default as preference before the splitter got to its _init_splitter(),
This commit is contained in:
parent
49e7aab2cc
commit
e8635be8c1
@ -161,10 +161,12 @@ export class et2_split extends et2_DOMWidget implements et2_IResizeable, et2_IPr
|
|||||||
super.doLoadingFinished();
|
super.doLoadingFinished();
|
||||||
|
|
||||||
// Not done yet, but widget will let you know
|
// Not done yet, but widget will let you know
|
||||||
return new Promise((resolve) => {
|
let p = new Promise((resolve) =>
|
||||||
|
{
|
||||||
// Use a timeout to give the children a chance to finish
|
// Use a timeout to give the children a chance to finish
|
||||||
window.setTimeout(() => this._init_splitter(resolve), 1);
|
window.setTimeout(() => this._init_splitter(resolve), 1);
|
||||||
});
|
});
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,13 +218,18 @@ export class et2_split extends et2_DOMWidget implements et2_IResizeable, et2_IPr
|
|||||||
let pref = this.egw().preference('splitter-size-' + this.id, this.egw().getAppName());
|
let pref = this.egw().preference('splitter-size-' + this.id, this.egw().getAppName());
|
||||||
if(pref)
|
if(pref)
|
||||||
{
|
{
|
||||||
if(this.orientation == "v" && pref['sizeLeft'] < this.dynheight.outerNode.width() ||
|
// Change from percent back to numeric
|
||||||
this.orientation == "h" && pref['sizeTop'] < this.dynheight.outerNode.height())
|
if(typeof pref.sizeLeft !== "undefined")
|
||||||
{
|
{
|
||||||
|
pref.sizeLeft = ((parseFloat(pref.sizeLeft) / 100) * widget.dynheight.outerNode.width());
|
||||||
|
}
|
||||||
|
if(typeof pref.sizeTop !== "undefined")
|
||||||
|
{
|
||||||
|
pref.sizeTop = ((parseFloat(pref.sizeTop) / 100) * widget.dynheight.outerNode.height());
|
||||||
|
}
|
||||||
options = jQuery.extend(options, pref);
|
options = jQuery.extend(options, pref);
|
||||||
this.prefSize = pref[this.orientation == "v" ? 'sizeLeft' : 'sizeTop'];
|
this.prefSize = pref[this.orientation == "v" ? 'sizeLeft' : 'sizeTop'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// If there is no preference yet, set it to half size
|
// If there is no preference yet, set it to half size
|
||||||
// Otherwise the right pane gets the fullsize
|
// Otherwise the right pane gets the fullsize
|
||||||
if (typeof this.prefSize == 'undefined' || !this.prefSize)
|
if (typeof this.prefSize == 'undefined' || !this.prefSize)
|
||||||
|
@ -646,7 +646,10 @@ export class etemplate2
|
|||||||
egw.window.console.groupEnd();
|
egw.window.console.groupEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for everything to be loaded, then finish it up
|
// Wait for everything to be loaded, then finish it up. Use timeout to give anything else a chance
|
||||||
|
// to run.
|
||||||
|
setTimeout(() =>
|
||||||
|
{
|
||||||
Promise.all(deferred).then(() =>
|
Promise.all(deferred).then(() =>
|
||||||
{
|
{
|
||||||
egw.debug("log", "Finished loading %s, triggering load event", _name);
|
egw.debug("log", "Finished loading %s, triggering load event", _name);
|
||||||
@ -734,6 +737,7 @@ export class etemplate2
|
|||||||
gen_time_div.append('<span class="et2RenderTime">' + egw.lang('eT2 rendering took %1s', '' + ((end_time - start_time) / 1000)) + '</span>');
|
gen_time_div.append('<span class="et2RenderTime">' + egw.lang('eT2 rendering took %1s', '' + ((end_time - start_time) / 1000)) + '</span>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user