* Api: Fix splitter widget did not restore size from preference

This commit is contained in:
nathan 2022-03-29 09:42:01 -06:00
parent 4c503d61ea
commit d35577f1a8
2 changed files with 17 additions and 8 deletions

View File

@ -154,11 +154,15 @@ var et2_split = /** @class */ (function (_super) {
if (this.id) {
var pref = this.egw().preference('splitter-size-' + this.id, this.egw().getAppName());
if (pref) {
if (this.orientation == "v" && pref['sizeLeft'] < this.dynheight.outerNode.width() ||
this.orientation == "h" && pref['sizeTop'] < this.dynheight.outerNode.height()) {
options = jQuery.extend(options, pref);
this.prefSize = pref[this.orientation == "v" ? 'sizeLeft' : 'sizeTop'];
// Change from percent back to numeric
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);
this.prefSize = pref[this.orientation == "v" ? 'sizeLeft' : 'sizeTop'];
}
// If there is no preference yet, set it to half size
// Otherwise the right pane gets the fullsize

View File

@ -219,12 +219,17 @@ class et2_split extends et2_DOMWidget implements et2_IResizeable, et2_IPrint
let pref = this.egw().preference('splitter-size-' + this.id, this.egw().getAppName());
if(pref)
{
if(this.orientation == "v" && pref['sizeLeft'] < this.dynheight.outerNode.width() ||
this.orientation == "h" && pref['sizeTop'] < this.dynheight.outerNode.height())
// Change from percent back to numeric
if(typeof pref.sizeLeft !== "undefined")
{
options = jQuery.extend(options, pref);
this.prefSize = pref[this.orientation == "v" ?'sizeLeft' : 'sizeTop'];
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);
this.prefSize = pref[this.orientation == "v" ? 'sizeLeft' : 'sizeTop'];
}
// If there is no preference yet, set it to half size
// Otherwise the right pane gets the fullsize