From 79959191decc3be20cf93e33fd6856f96bdcd549 Mon Sep 17 00:00:00 2001 From: john Date: Fri, 17 Aug 2018 13:09:03 +0800 Subject: [PATCH] Roo/bootstrap/Menu.js roojs-bootstrap.js roojs-bootstrap-debug.js --- Roo/bootstrap/Menu.js | 2 +- roojs-bootstrap-debug.js | 2 +- roojs-bootstrap.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Roo/bootstrap/Menu.js b/Roo/bootstrap/Menu.js index 146d3735cd..e9f3014074 100644 --- a/Roo/bootstrap/Menu.js +++ b/Roo/bootstrap/Menu.js @@ -284,7 +284,7 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, { Roo.log(xy[0]); Roo.log(Roo.lib.Dom.getViewWidth()); - if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){ + if(this.el.getWidth() + xy[0] + 100 >= Roo.lib.Dom.getViewWidth()){ xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth(); } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 9b8f4c154a..1c731ebc00 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -2251,7 +2251,7 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, { Roo.log(xy[0]); Roo.log(Roo.lib.Dom.getViewWidth()); - if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){ + if(this.el.getWidth() + xy[0] + 100 >= Roo.lib.Dom.getViewWidth()){ xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth(); } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 8887b75af3..e2c6734764 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -87,7 +87,7 @@ this.el.on("mouseout",this.onMouseOut,this);},findTargetItem:function(e){var t=e },onClick:function(e){Roo.log("menu.onClick");var t=this.findTargetItem(e);if(!t||t.isContainer){return;}Roo.log(e);Roo.log('pass click event');t.onClick(e);this.fireEvent("click",this,t,e);var A=this;if(!t.href.length||t.href=='#'){(function(){A.hide();} ).defer(100);}},onMouseOver:function(e){var t=this.findTargetItem(e);this.fireEvent("mouseover",this,e,t);},isVisible:function(){return !this.hidden;},onMouseOut:function(e){var t=this.findTargetItem(e);this.fireEvent("mouseout",this,e,t);},show:function(el,A,B){this.parentMenu=B; if(!this.el){this.render();}this.fireEvent("beforeshow",this);this.showAt(this.el.getAlignToXY(el,A||this.defaultAlign),B,false);},showAt:function(xy,A,_e){this.parentMenu=A;if(!this.el){this.render();}if(_e!==false){this.fireEvent("beforeshow",this);}this.hideMenuItems(); -this.hidden=false;this.triggerEl.addClass('open');Roo.log(this.el.getWidth());Roo.log(xy[0]);Roo.log(Roo.lib.Dom.getViewWidth());if(this.el.getWidth()+xy[0]>=Roo.lib.Dom.getViewWidth()){xy[0]=xy[0]-this.el.getWidth()+this.triggerEl.getWidth();}if(this.el.getHeight()+xy[1]>=Roo.lib.Dom.getViewHeight()){xy[1]=xy[1]-this.el.getHeight()-this.triggerEl.getHeight(); +this.hidden=false;this.triggerEl.addClass('open');Roo.log(this.el.getWidth());Roo.log(xy[0]);Roo.log(Roo.lib.Dom.getViewWidth());if(this.el.getWidth()+xy[0]+100>=Roo.lib.Dom.getViewWidth()){xy[0]=xy[0]-this.el.getWidth()+this.triggerEl.getWidth();}if(this.el.getHeight()+xy[1]>=Roo.lib.Dom.getViewHeight()){xy[1]=xy[1]-this.el.getHeight()-this.triggerEl.getHeight(); }if(this.el.getStyle('top')!='auto'&&this.el.getStyle('top').slice(-1)!="%"){this.el.setXY(xy);}this.focus();this.fireEvent("show",this);},focus:function(){return;if(!this.hidden){this.doFocus.defer(50,this);}},doFocus:function(){if(!this.hidden){this.focusEl.focus(); }},hide:function(A){this.hideMenuItems();if(this.el&&this.isVisible()){this.fireEvent("beforehide",this);if(this.activeItem){this.activeItem.deactivate();this.activeItem=null;}this.triggerEl.removeClass('open');;this.hidden=true;this.fireEvent("hide",this); }if(A===true&&this.parentMenu){this.parentMenu.hide(true);}},onTriggerClick:function(e){Roo.log('trigger click');var A=e.getTarget();Roo.log(A.nodeName.toLowerCase());if(A.nodeName.toLowerCase()==='i'){e.preventDefault();}},onTriggerPress:function(e){Roo.log('trigger press'); -- 2.39.2