roojs-core.js
authoredward <edward@roojs.com>
Wed, 29 Nov 2017 09:11:24 +0000 (17:11 +0800)
committeredward <edward@roojs.com>
Wed, 29 Nov 2017 09:11:24 +0000 (17:11 +0800)
roojs-core-debug.js

roojs-core-debug.js
roojs-core.js

index b717c84..4776c33 100644 (file)
@@ -7168,30 +7168,26 @@ if(opt.anim.isAnimated()){
          */
         findScrollableParent : function(){
             
-            var el = Roo.get(this.dom.parentNode);
+            var overflowRegex = /(auto|scroll)/;
             
-            while (
-                    el && 
-                    (
-                        !el.isScrollable() ||
-                        (
-                            el.isScrollable() &&
-                            (
-                                D.getViewHeight() - el.dom.clientHeight > 15 || 
-                                D.getViewWidth() - el.dom.clientWidth > 15
-                            )
-                        )
-                    ) &&
-                    el.dom.nodeName.toLowerCase() != 'body'
-            ){
-                el = Roo.get(el.dom.parentNode);
+            if(this.getStyle('position') === 'fixed'){
+                return Roo.get(document.body);
             }
             
-            if(!el.isScrollable()){
-                return null;
+            var excludeStaticParent = this.getStyle('position') === "absolute";
+            
+            for (var parent = this; (parent = Roo.get(parent.dom.parentNode));){
+                
+                if (excludeStaticParent && parent.getStyle('position') === "static") {
+                    continue;
+                }
+                
+                if (overflowRegex.test(parent.getStyle('overflow') + parent.getStyle('overflow-x') + parent.getStyle('overflow-y'))){
+                    return parent;
+                }
             }
             
-            return el;
+            return Roo.get(document.body);
         },
 
         /**
index 3f6f808..7723563 100644 (file)
@@ -305,17 +305,17 @@ return Roo.isSafari?(A[k]||k):k;},getPageX:function(){return this.xy[0];},getPag
 (function(){var D=Roo.lib.Dom;var E=Roo.lib.Event;var A=Roo.lib.Anim;var B={};var C=/(-[a-z])/gi;var F=function(m,a){return a.charAt(1).toUpperCase();};var G=document.defaultView;Roo.Element=function(J,K){var L=typeof J=="string"?document.getElementById(J):J;
 if(!L){return null;}var id=L.id;if(K!==true&&id&&Roo.Element.cache[id]){return Roo.Element.cache[id];}this.dom=L;this.id=id||Roo.id(L);};var El=Roo.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(J){this.visibilityMode=J;
 return this;},enableDisplayMode:function(J){this.setVisibilityMode(El.DISPLAY);if(typeof J!="undefined"){this.originalDisplay=J;}return this;},findParent:function(J,K,L){var p=this.dom,b=document.body,M=0,dq=Roo.DomQuery,N;K=K||50;if(typeof K!="number"){N=Roo.getDom(K);
-K=10;}while(p&&p.nodeType==1&&M<K&&p!=b&&p!=N){if(dq.is(p,J)){return L?Roo.get(p):p;}M++;p=p.parentNode;}return null;},findParentNode:function(J,K,L){var p=Roo.fly(this.dom.parentNode,'_internal');return p?p.findParent(J,K,L):null;},findScrollableParent:function(){var el=Roo.get(this.dom.parentNode);
-while(el&&(!el.isScrollable()||(el.isScrollable()&&(D.getViewHeight()-el.dom.clientHeight>15||D.getViewWidth()-el.dom.clientWidth>15)))&&el.dom.nodeName.toLowerCase()!='body'){el=Roo.get(el.dom.parentNode);}if(!el.isScrollable()){return null;}return el;},up:function(J,K){return this.findParentNode(J,K,true);
-},is:function(J){return Roo.DomQuery.is(this.dom,J);},animate:function(J,K,L,M,N){this.anim(J,{duration:K,callback:L,easing:M},N);return this;},anim:function(J,K,L,M,N,cb){L=L||'run';K=K||{};var O=Roo.lib.Anim[L](this.dom,J,(K.duration||M)||.35,(K.easing||N)||'easeOut',function(){Roo.callback(cb,this);
-Roo.callback(K.callback,K.scope||this,[this,K]);},this);K.anim=O;return O;},preanim:function(a,i){return !a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]});},clean:function(J){if(this.isCleaned&&J!==true){return this;
-}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}this.isCleaned=true;return this;},calcOffsetsTo:function(el){el=Roo.get(el);var d=el.dom;
-var J=false;if(el.getStyle('position')=='static'){el.position('relative');J=true;}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!='HTML'){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent;}if(J){el.position('static');}return [x,y];},scrollIntoView:function(J,K){var c=Roo.getDom(J)||document.body;
-var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t;}else if(b>cb){c.scrollTop=b-ch;
-}if(K!==false){if(l<cl){c.scrollLeft=l;}else if(r>cr){c.scrollLeft=r-c.clientWidth;}}return this;},scrollChildIntoView:function(J,K){Roo.fly(J,'_scrollChildIntoView').scrollIntoView(this,K);},autoHeight:function(J,K,L,M){var N=this.getHeight();this.clip();
-this.setHeight(1);setTimeout(function(){var O=parseInt(this.dom.scrollHeight,10);if(!J){this.setHeight(O);this.unclip();if(typeof L=="function"){L();}}else{this.setHeight(N);this.setHeight(O,J,K,function(){this.unclip();if(typeof L=="function"){L();}}.createDelegate(this),M);
-}}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(J){var K=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(J!==true||!K){return K;
-}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Roo.fly(p,'_isVisible').isVisible()){return false;}p=p.parentNode;}return true;},select:function(J,K){return El.select(J,K,this.dom);},query:function(J,K){return Roo.DomQuery.select(J,this.dom);
+K=10;}while(p&&p.nodeType==1&&M<K&&p!=b&&p!=N){if(dq.is(p,J)){return L?Roo.get(p):p;}M++;p=p.parentNode;}return null;},findParentNode:function(J,K,L){var p=Roo.fly(this.dom.parentNode,'_internal');return p?p.findParent(J,K,L):null;},findScrollableParent:function(){var J=/(auto|scroll)/;
+if(this.getStyle('position')==='fixed'){return Roo.get(document.body);}var K=this.getStyle('position')==="absolute";for(var L=this;(L=Roo.get(L.dom.parentNode));){if(K&&L.getStyle('position')==="static"){continue;}if(J.test(L.getStyle('overflow')+L.getStyle('overflow-x')+L.getStyle('overflow-y'))){return L;
+}}return Roo.get(document.body);},up:function(J,K){return this.findParentNode(J,K,true);},is:function(J){return Roo.DomQuery.is(this.dom,J);},animate:function(J,K,L,M,N){this.anim(J,{duration:K,callback:L,easing:M},N);return this;},anim:function(J,K,L,M,N,cb){L=L||'run';
+K=K||{};var O=Roo.lib.Anim[L](this.dom,J,(K.duration||M)||.35,(K.easing||N)||'easeOut',function(){Roo.callback(cb,this);Roo.callback(K.callback,K.scope||this,[this,K]);},this);K.anim=O;return O;},preanim:function(a,i){return !a[i]?false:(typeof a[i]=="object"?a[i]:{duration:a[i+1],callback:a[i+2],easing:a[i+3]}
+);},clean:function(J){if(this.isCleaned&&J!==true){return this;}var ns=/\S/;var d=this.dom,n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!ns.test(n.nodeValue)){d.removeChild(n);}else{n.nodeIndex=++ni;}n=nx;}this.isCleaned=true;return this;
+},calcOffsetsTo:function(el){el=Roo.get(el);var d=el.dom;var J=false;if(el.getStyle('position')=='static'){el.position('relative');J=true;}var x=0,y=0;var op=this.dom;while(op&&op!=d&&op.tagName!='HTML'){x+=op.offsetLeft;y+=op.offsetTop;op=op.offsetParent;
+}if(J){el.position('static');}return [x,y];},scrollIntoView:function(J,K){var c=Roo.getDom(J)||document.body;var el=this.dom;var o=this.calcOffsetsTo(c),l=o[0],t=o[1],b=t+el.offsetHeight,r=l+el.offsetWidth;var ch=c.clientHeight;var ct=parseInt(c.scrollTop,10);
+var cl=parseInt(c.scrollLeft,10);var cb=ct+ch;var cr=cl+c.clientWidth;if(t<ct){c.scrollTop=t;}else if(b>cb){c.scrollTop=b-ch;}if(K!==false){if(l<cl){c.scrollLeft=l;}else if(r>cr){c.scrollLeft=r-c.clientWidth;}}return this;},scrollChildIntoView:function(J,K){Roo.fly(J,'_scrollChildIntoView').scrollIntoView(this,K);
+},autoHeight:function(J,K,L,M){var N=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var O=parseInt(this.dom.scrollHeight,10);if(!J){this.setHeight(O);this.unclip();if(typeof L=="function"){L();}}else{this.setHeight(N);this.setHeight(O,J,K,function(){this.unclip();
+if(typeof L=="function"){L();}}.createDelegate(this),M);}}.createDelegate(this),0);return this;},contains:function(el){if(!el){return false;}return D.isAncestor(this.dom,el.dom?el.dom:el);},isVisible:function(J){var K=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");
+if(J!==true||!K){return K;}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Roo.fly(p,'_isVisible').isVisible()){return false;}p=p.parentNode;}return true;},select:function(J,K){return El.select(J,K,this.dom);},query:function(J,K){return Roo.DomQuery.select(J,this.dom);
 },child:function(J,K){var n=Roo.DomQuery.selectNode(J,this.dom);return K?n:Roo.get(n);},down:function(J,K){var n=Roo.DomQuery.selectNode(" > "+J,this.dom);return K?n:Roo.get(n);},initDD:function(J,K,L){var dd=new Roo.dd.DD(Roo.id(this.dom),J,K);return Roo.apply(dd,L);
 },initDDProxy:function(J,K,L){var dd=new Roo.dd.DDProxy(Roo.id(this.dom),J,K);return Roo.apply(dd,L);},initDDTarget:function(J,K,L){var dd=new Roo.dd.DDTarget(Roo.id(this.dom),J,K);return Roo.apply(dd,L);},setVisible:function(J,K){if(!K||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(J);
 }else{this.fixDisplay();this.dom.style.visibility=J?"visible":"hidden";}}else{var L=this.dom;var M=this.visibilityMode;if(J){this.setOpacity(.01);this.setVisible(true);}this.anim({opacity:{to:(J?1:0)}},this.preanim(arguments,1),null,.35,'easeIn',function(){if(!J){if(M==El.DISPLAY){L.style.display="none";