mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
Fix some more splitter strange behaviour
- Add ignore zone, undock won't go to a position < 20px from edge. In that case, it undocks to 50% - Work around deferred layout (Chrome & Firefox) which caused wrong DOMNode height, which broke nm resizing
This commit is contained in:
parent
70ebabaf90
commit
1933389ae2
@ -59,6 +59,8 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
|
|||||||
"cols": {"ignore": true}
|
"cols": {"ignore": true}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
DOCK_TOLERANCE: 15,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -189,7 +191,7 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
|
|||||||
// Start docked?
|
// Start docked?
|
||||||
if(options.dock)
|
if(options.dock)
|
||||||
{
|
{
|
||||||
if(options.dock == "bottomDock" && options.sizeTop >= this.div.height() ||
|
if(options.dock == "bottomDock" && Math.abs(options.sizeTop - this.div.height()) < et2_split.DOCK_TOLERANCE ||
|
||||||
options.dock == "topDock" && options.sizeTop == 0)
|
options.dock == "topDock" && options.sizeTop == 0)
|
||||||
{
|
{
|
||||||
this.dock();
|
this.dock();
|
||||||
@ -217,8 +219,22 @@ var et2_split = et2_DOMWidget.extend([et2_IResizeable],
|
|||||||
var size = self.orientation == "v" ? {sizeLeft: self.left.width()} : {sizeTop: self.left.height()};
|
var size = self.orientation == "v" ? {sizeLeft: self.left.width()} : {sizeTop: self.left.height()};
|
||||||
self.egw().set_preference(self.egw().getAppName(), 'splitter-size-' + self.id, size);
|
self.egw().set_preference(self.egw().getAppName(), 'splitter-size-' + self.id, size);
|
||||||
}
|
}
|
||||||
|
// Force immediate layout, so proper layout & sizes are available
|
||||||
|
// for resize(). Chrome defers layout, so current DOM node sizes
|
||||||
|
// are not available to widgets if they ask.
|
||||||
|
var display = this.style.display;
|
||||||
|
this.style.display = 'none';
|
||||||
|
this.offsetHeight;
|
||||||
|
this.style.display = display;
|
||||||
|
|
||||||
|
// Ok, update children
|
||||||
self.iterateOver(function(widget) {
|
self.iterateOver(function(widget) {
|
||||||
if(widget != self) widget.resize();
|
if(widget != self)
|
||||||
|
{
|
||||||
|
widget.resize();
|
||||||
|
// Above forcing is not enough for Firefox, defer
|
||||||
|
window.setTimeout(jQuery.proxy(function() {this.resize();},widget),200);
|
||||||
|
}
|
||||||
},self,et2_IResizeable);
|
},self,et2_IResizeable);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
2
phpgwapi/js/jquery/splitter.js
vendored
2
phpgwapi/js/jquery/splitter.js
vendored
@ -284,6 +284,8 @@ var splitterCounter = 0;
|
|||||||
.bind("undock"+opts.eventNamespace, function(){
|
.bind("undock"+opts.eventNamespace, function(){
|
||||||
var pw = opts.dockPane[0][opts.pxSplit];
|
var pw = opts.dockPane[0][opts.pxSplit];
|
||||||
if ( pw ) return;
|
if ( pw ) return;
|
||||||
|
// 20px away is too close, reset to 50%
|
||||||
|
if(Math.abs(bar._pos - splitter._DA - bar._DA) < 20) bar._pos = splitter._DA / 2;
|
||||||
var x={}; x[opts.origin]=bar._pos+"px";
|
var x={}; x[opts.origin]=bar._pos+"px";
|
||||||
bar.removeClass(opts.barDockedClass)
|
bar.removeClass(opts.barDockedClass)
|
||||||
.animate(x, opts.undockSpeed||opts.dockSpeed||1, opts.undockEasing||opts.dockEasing, function(){
|
.animate(x, opts.undockSpeed||opts.dockSpeed||1, opts.undockEasing||opts.dockEasing, function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user