* 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,12 +154,16 @@ var et2_split = /** @class */ (function (_super) {
if (this.id) { if (this.id) {
var pref = this.egw().preference('splitter-size-' + this.id, this.egw().getAppName()); var 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) {

View File

@ -219,13 +219,18 @@ class et2_split extends et2_DOMWidget implements et2_IResizeable, et2_IPrint
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)