revet delay on chrome for window resize
authorAlan Knowles <alan@roojs.com>
Thu, 19 Aug 2021 06:03:08 +0000 (14:03 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 19 Aug 2021 06:03:08 +0000 (14:03 +0800)
docs/src/Roo_EventManager.js.html
roojs-all.js
roojs-core-debug.js
roojs-core.js
roojs-debug.js

index 128030e..3b2273b 100644 (file)
@@ -370,7 +370,8 @@ el.on({
          * @param {Object}   scope    An object that becomes the scope of the handler
          * @param {boolean}  options
          */
-        </span><span class="jsdoc-var">onWindowResize </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">fn</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">scope</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">options</span><span class="jsdoc-syntax">){
+        </span><span class="jsdoc-var">onWindowResize </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">fn</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">scope</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">options</span><span class="jsdoc-syntax">)
+        {
             </span><span class="jsdoc-keyword">if</span><span class="jsdoc-syntax">(!</span><span class="jsdoc-var">resizeEvent</span><span class="jsdoc-syntax">){
                 </span><span class="jsdoc-var">resizeEvent </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">new </span><span class="jsdoc-var">Roo.util.Event</span><span class="jsdoc-syntax">();
                 </span><span class="jsdoc-var">resizeTask </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">new </span><span class="jsdoc-var">Roo.util.DelayedTask</span><span class="jsdoc-syntax">(</span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(){
@@ -378,13 +379,12 @@ el.on({
                 });
                 </span><span class="jsdoc-var">E.on</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">window</span><span class="jsdoc-syntax">, </span><span class="jsdoc-string">&quot;resize&quot;</span><span class="jsdoc-syntax">, </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">()
                 {
-                    </span><span class="jsdoc-comment">// it seems that even chrome likes to have a slight delay here.
-                    //if(Roo.isIE){
+                    </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">Roo.isIE</span><span class="jsdoc-syntax">) {
                         </span><span class="jsdoc-var">resizeTask.delay</span><span class="jsdoc-syntax">(50);
-                    </span><span class="jsdoc-comment">//}else{
-                    //    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
-                    //}
-                </span><span class="jsdoc-syntax">});
+                    } </span><span class="jsdoc-keyword">else </span><span class="jsdoc-syntax">{
+                        </span><span class="jsdoc-var">resizeEvent.fire</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">D.getViewWidth</span><span class="jsdoc-syntax">(), </span><span class="jsdoc-var">D.getViewHeight</span><span class="jsdoc-syntax">());
+                    }
+                });
             }
             </span><span class="jsdoc-var">resizeEvent.addListener</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">fn</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">scope</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">options</span><span class="jsdoc-syntax">);
         },
index 8ffd88e..77ec278 100644 (file)
@@ -308,13 +308,13 @@ E.on(window,'unload',function(){el.removeEventListener("DOMMouseScroll",h,false)
 i<V;i++){var h=U[i];if(h[0]==id&&h[1]==T){hd=h[2];U.splice(i,1);break;}}}E.un(el,T,hd);el=Roo.getDom(el);if(T=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(T=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.removeListener(hd);
 }};var R=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var S={wrap:function(fn,T,U){return function(e){Roo.EventObject.setEvent(e);fn.call(U?T||window:window,Roo.EventObject,T);};},addListener:function(T,U,fn,V,W){if(typeof U=="object"){var o=U;
 for(var e in o){if(R.test(e)){continue;}if(typeof o[e]=="function"){listen(T,e,o,o[e],o.scope);}else{listen(T,e,o[e]);}}return;}return listen(T,U,W,fn,V);},removeListener:function(T,U,fn){return Q(T,U,fn);},onDocumentReady:function(fn,T,U){if(C){A.addListener(fn,T,U);
-A.fire();A.clearListeners();return;}if(!A){K();}A.addListener(fn,T,U);},onWindowResize:function(fn,T,U){if(!F){F=new Roo.util.Event();G=new Roo.util.DelayedTask(function(){F.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){G.delay(50);
-});}F.addListener(fn,T,U);},onTextResize:function(fn,T,U){if(!H){H=new Roo.util.Event();var V=new Roo.Element(document.createElement('div'));V.dom.className='x-text-resize';V.dom.innerHTML='X';V.appendTo(document.body);I=V.dom.offsetHeight;setInterval(function(){if(V.dom.offsetHeight!=I){H.fire(I,I=V.dom.offsetHeight);
-}},this.textResizeInterval);}H.addListener(fn,T,U);},removeResizeListener:function(fn,T){if(F){F.removeListener(fn,T);}},fireResize:function(){if(F){F.fire(D.getViewWidth(),D.getViewHeight());}},ieDeferSrc:false,textResizeInterval:50};S.on=S.addListener;S.un=S.removeListener;
-S.stoppedMouseDownEvent=new Roo.util.Event();return S;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;}var A=[Roo.isIE?"roo-ie":Roo.isIE11?"roo-ie11":Roo.isEdge?"roo-edge":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];
-if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isIOS){A.push("roo-ios");}if(Roo.isTouch){A.push("roo-touch");}if(Roo.isBorderBox){A.push('roo-border-box');}if(Roo.isStrict){var p=bd.dom.parentNode;if(p){p.className+=' roo-strict';
-}}bd.addClass(A.join(' '));});Roo.EventObject=function(){var E=Roo.lib.Event;var A={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var B=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);
-}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
+A.fire();A.clearListeners();return;}if(!A){K();}A.addListener(fn,T,U);},onWindowResize:function(fn,T,U){if(!F){F=new Roo.util.Event();G=new Roo.util.DelayedTask(function(){F.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Roo.isIE){G.delay(50);
+}else{F.fire(D.getViewWidth(),D.getViewHeight());}});}F.addListener(fn,T,U);},onTextResize:function(fn,T,U){if(!H){H=new Roo.util.Event();var V=new Roo.Element(document.createElement('div'));V.dom.className='x-text-resize';V.dom.innerHTML='X';V.appendTo(document.body);
+I=V.dom.offsetHeight;setInterval(function(){if(V.dom.offsetHeight!=I){H.fire(I,I=V.dom.offsetHeight);}},this.textResizeInterval);}H.addListener(fn,T,U);},removeResizeListener:function(fn,T){if(F){F.removeListener(fn,T);}},fireResize:function(){if(F){F.fire(D.getViewWidth(),D.getViewHeight());
+}},ieDeferSrc:false,textResizeInterval:50};S.on=S.addListener;S.un=S.removeListener;S.stoppedMouseDownEvent=new Roo.util.Event();return S;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;
+}var A=[Roo.isIE?"roo-ie":Roo.isIE11?"roo-ie11":Roo.isEdge?"roo-edge":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isIOS){A.push("roo-ios");}if(Roo.isTouch){A.push("roo-touch");
+}if(Roo.isBorderBox){A.push('roo-border-box');}if(Roo.isStrict){var p=bd.dom.parentNode;if(p){p.className+=' roo-strict';}}bd.addClass(A.join(' '));});Roo.EventObject=function(){var E=Roo.lib.Event;var A={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35}
+;var B=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
 }this.browserEvent=e;if(e){this.button=e.button?B[e.button]:(e.which?e.which-1:-1);if(e.type=='click'&&this.button==-1){this.button=0;}this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;
 this.charCode=(e.type=='keyup'||e.type=='keydown')?0:e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;
 },stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=='mousedown'){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}
index c94cbef..d64393b 100644 (file)
@@ -7264,7 +7264,8 @@ el.on({
          * @param {Object}   scope    An object that becomes the scope of the handler
          * @param {boolean}  options
          */
-        onWindowResize : function(fn, scope, options){
+        onWindowResize : function(fn, scope, options)
+        {
             if(!resizeEvent){
                 resizeEvent = new Roo.util.Event();
                 resizeTask = new Roo.util.DelayedTask(function(){
@@ -7272,12 +7273,11 @@ el.on({
                 });
                 E.on(window, "resize", function()
                 {
-                    // it seems that even chrome likes to have a slight delay here.
-                    //if(Roo.isIE){
+                    if (Roo.isIE) {
                         resizeTask.delay(50);
-                    //}else{
-                    //    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
-                    //}
+                    } else {
+                        resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
+                    }
                 });
             }
             resizeEvent.addListener(fn, scope, options);
index c74c5ce..279a52a 100644 (file)
@@ -308,13 +308,13 @@ E.on(window,'unload',function(){el.removeEventListener("DOMMouseScroll",h,false)
 i<V;i++){var h=U[i];if(h[0]==id&&h[1]==T){hd=h[2];U.splice(i,1);break;}}}E.un(el,T,hd);el=Roo.getDom(el);if(T=="mousewheel"&&el.addEventListener){el.removeEventListener("DOMMouseScroll",hd,false);}if(T=="mousedown"&&el==document){Roo.EventManager.stoppedMouseDownEvent.removeListener(hd);
 }};var R=/^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;var S={wrap:function(fn,T,U){return function(e){Roo.EventObject.setEvent(e);fn.call(U?T||window:window,Roo.EventObject,T);};},addListener:function(T,U,fn,V,W){if(typeof U=="object"){var o=U;
 for(var e in o){if(R.test(e)){continue;}if(typeof o[e]=="function"){listen(T,e,o,o[e],o.scope);}else{listen(T,e,o[e]);}}return;}return listen(T,U,W,fn,V);},removeListener:function(T,U,fn){return Q(T,U,fn);},onDocumentReady:function(fn,T,U){if(C){A.addListener(fn,T,U);
-A.fire();A.clearListeners();return;}if(!A){K();}A.addListener(fn,T,U);},onWindowResize:function(fn,T,U){if(!F){F=new Roo.util.Event();G=new Roo.util.DelayedTask(function(){F.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){G.delay(50);
-});}F.addListener(fn,T,U);},onTextResize:function(fn,T,U){if(!H){H=new Roo.util.Event();var V=new Roo.Element(document.createElement('div'));V.dom.className='x-text-resize';V.dom.innerHTML='X';V.appendTo(document.body);I=V.dom.offsetHeight;setInterval(function(){if(V.dom.offsetHeight!=I){H.fire(I,I=V.dom.offsetHeight);
-}},this.textResizeInterval);}H.addListener(fn,T,U);},removeResizeListener:function(fn,T){if(F){F.removeListener(fn,T);}},fireResize:function(){if(F){F.fire(D.getViewWidth(),D.getViewHeight());}},ieDeferSrc:false,textResizeInterval:50};S.on=S.addListener;S.un=S.removeListener;
-S.stoppedMouseDownEvent=new Roo.util.Event();return S;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;}var A=[Roo.isIE?"roo-ie":Roo.isIE11?"roo-ie11":Roo.isEdge?"roo-edge":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];
-if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isIOS){A.push("roo-ios");}if(Roo.isTouch){A.push("roo-touch");}if(Roo.isBorderBox){A.push('roo-border-box');}if(Roo.isStrict){var p=bd.dom.parentNode;if(p){p.className+=' roo-strict';
-}}bd.addClass(A.join(' '));});Roo.EventObject=function(){var E=Roo.lib.Event;var A={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35};var B=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);
-}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
+A.fire();A.clearListeners();return;}if(!A){K();}A.addListener(fn,T,U);},onWindowResize:function(fn,T,U){if(!F){F=new Roo.util.Event();G=new Roo.util.DelayedTask(function(){F.fire(D.getViewWidth(),D.getViewHeight());});E.on(window,"resize",function(){if(Roo.isIE){G.delay(50);
+}else{F.fire(D.getViewWidth(),D.getViewHeight());}});}F.addListener(fn,T,U);},onTextResize:function(fn,T,U){if(!H){H=new Roo.util.Event();var V=new Roo.Element(document.createElement('div'));V.dom.className='x-text-resize';V.dom.innerHTML='X';V.appendTo(document.body);
+I=V.dom.offsetHeight;setInterval(function(){if(V.dom.offsetHeight!=I){H.fire(I,I=V.dom.offsetHeight);}},this.textResizeInterval);}H.addListener(fn,T,U);},removeResizeListener:function(fn,T){if(F){F.removeListener(fn,T);}},fireResize:function(){if(F){F.fire(D.getViewWidth(),D.getViewHeight());
+}},ieDeferSrc:false,textResizeInterval:50};S.on=S.addListener;S.un=S.removeListener;S.stoppedMouseDownEvent=new Roo.util.Event();return S;}();Roo.onReady=Roo.EventManager.onDocumentReady;Roo.onReady(function(){var bd=Roo.get(document.body);if(!bd){return;
+}var A=[Roo.isIE?"roo-ie":Roo.isIE11?"roo-ie11":Roo.isEdge?"roo-edge":Roo.isGecko?"roo-gecko":Roo.isOpera?"roo-opera":Roo.isSafari?"roo-safari":""];if(Roo.isMac){A.push("roo-mac");}if(Roo.isLinux){A.push("roo-linux");}if(Roo.isIOS){A.push("roo-ios");}if(Roo.isTouch){A.push("roo-touch");
+}if(Roo.isBorderBox){A.push('roo-border-box');}if(Roo.isStrict){var p=bd.dom.parentNode;if(p){p.className+=' roo-strict';}}bd.addClass(A.join(' '));});Roo.EventObject=function(){var E=Roo.lib.Event;var A={63234:37,63235:39,63232:38,63233:40,63276:33,63277:34,63272:46,63273:36,63275:35}
+;var B=Roo.isIE?{1:0,4:1,2:2}:(Roo.isSafari?{1:0,2:1,3:2}:{0:0,1:1,2:2});Roo.EventObjectImpl=function(e){if(e){this.setEvent(e.browserEvent||e);}};Roo.EventObjectImpl.prototype={browserEvent:null,button:-1,shiftKey:false,ctrlKey:false,altKey:false,BACKSPACE:8,TAB:9,RETURN:13,ENTER:13,SHIFT:16,CONTROL:17,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,F5:116,setEvent:function(e){if(e==this||(e&&e.browserEvent)){return e;
 }this.browserEvent=e;if(e){this.button=e.button?B[e.button]:(e.which?e.which-1:-1);if(e.type=='click'&&this.button==-1){this.button=0;}this.type=e.type;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey||e.metaKey;this.altKey=e.altKey;this.keyCode=e.keyCode;
 this.charCode=(e.type=='keyup'||e.type=='keydown')?0:e.charCode;this.target=E.getTarget(e);this.xy=E.getXY(e);}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.keyCode=0;this.charCode=0;this.target=null;this.xy=[0,0];}return this;
 },stopEvent:function(){if(this.browserEvent){if(this.browserEvent.type=='mousedown'){Roo.EventManager.stoppedMouseDownEvent.fire(this);}E.stopEvent(this.browserEvent);}},preventDefault:function(){if(this.browserEvent){E.preventDefault(this.browserEvent);}
index 4d8d55a..8d917e9 100644 (file)
@@ -7264,7 +7264,8 @@ el.on({
          * @param {Object}   scope    An object that becomes the scope of the handler
          * @param {boolean}  options
          */
-        onWindowResize : function(fn, scope, options){
+        onWindowResize : function(fn, scope, options)
+        {
             if(!resizeEvent){
                 resizeEvent = new Roo.util.Event();
                 resizeTask = new Roo.util.DelayedTask(function(){
@@ -7272,12 +7273,11 @@ el.on({
                 });
                 E.on(window, "resize", function()
                 {
-                    // it seems that even chrome likes to have a slight delay here.
-                    //if(Roo.isIE){
+                    if (Roo.isIE) {
                         resizeTask.delay(50);
-                    //}else{
-                    //    resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
-                    //}
+                    } else {
+                        resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
+                    }
                 });
             }
             resizeEvent.addListener(fn, scope, options);