git.ithinksw.org
/
extjs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git]
/
src
/
menu
/
Menu.js
diff --git
a/src/menu/Menu.js
b/src/menu/Menu.js
index
ab8e5d1
..
cbfcb1b
100644
(file)
--- a/
src/menu/Menu.js
+++ b/
src/menu/Menu.js
@@
-146,7
+146,9
@@
Ext.define('Ext.menu.Menu', {
initComponent: function() {
var me = this,
initComponent: function() {
var me = this,
- prefix = Ext.baseCSSPrefix;
+ prefix = Ext.baseCSSPrefix,
+ cls = [prefix + 'menu'],
+ bodyCls = me.bodyCls ? [me.bodyCls] : [];
me.addEvents(
/**
me.addEvents(
/**
@@
-190,14
+192,12
@@
Ext.define('Ext.menu.Menu', {
Ext.menu.Manager.register(me);
// Menu classes
Ext.menu.Manager.register(me);
// Menu classes
- var cls = [prefix + 'menu'];
if (me.plain) {
cls.push(prefix + 'menu-plain');
}
me.cls = cls.join(' ');
// Menu body classes
if (me.plain) {
cls.push(prefix + 'menu-plain');
}
me.cls = cls.join(' ');
// Menu body classes
- var bodyCls = me.bodyCls ? [me.bodyCls] : [];
bodyCls.unshift(prefix + 'menu-body');
me.bodyCls = bodyCls.join(' ');
bodyCls.unshift(prefix + 'menu-body');
me.bodyCls = bodyCls.join(' ');
@@
-363,7
+363,9
@@
Ext.define('Ext.menu.Menu', {
// private
lookupItemFromObject: function(cmp) {
var me = this,
// private
lookupItemFromObject: function(cmp) {
var me = this,
- prefix = Ext.baseCSSPrefix;
+ prefix = Ext.baseCSSPrefix,
+ cls,
+ intercept;
if (!cmp.isComponent) {
if (!cmp.xtype) {
if (!cmp.isComponent) {
if (!cmp.xtype) {
@@
-378,11
+380,8
@@
Ext.define('Ext.menu.Menu', {
}
if (!cmp.isMenuItem && !cmp.dock) {
}
if (!cmp.isMenuItem && !cmp.dock) {
- var cls = [
- prefix + 'menu-item',
- prefix + 'menu-item-cmp'
- ],
- intercept = Ext.Function.createInterceptor;
+ cls = [prefix + 'menu-item', prefix + 'menu-item-cmp'];
+ intercept = Ext.Function.createInterceptor;
// Wrap focus/blur to control component focus
cmp.focus = intercept(cmp.focus, function() {
// Wrap focus/blur to control component focus
cmp.focus = intercept(cmp.focus, function() {
@@
-525,7
+524,9
@@
Ext.define('Ext.menu.Menu', {
* @markdown
*/
showBy: function(cmp, pos, off) {
* @markdown
*/
showBy: function(cmp, pos, off) {
- var me = this;
+ var me = this,
+ xy,
+ region;
if (me.floating && cmp) {
me.layout.autoSize = true;
if (me.floating && cmp) {
me.layout.autoSize = true;
@@
-535,22
+536,30
@@
Ext.define('Ext.menu.Menu', {
cmp = cmp.el || cmp;
// Convert absolute to floatParent-relative coordinates if necessary.
cmp = cmp.el || cmp;
// Convert absolute to floatParent-relative coordinates if necessary.
-
var
xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
+ xy = me.el.getAlignToXY(cmp, pos || me.defaultAlign, off);
if (me.floatParent) {
if (me.floatParent) {
-
var r
= me.floatParent.getTargetEl().getViewRegion();
- xy[0] -= r.x;
- xy[1] -= r.y;
+
region
= me.floatParent.getTargetEl().getViewRegion();
+ xy[0] -= r
egion
.x;
+ xy[1] -= r
egion
.y;
}
me.showAt(xy);
}
me.showAt(xy);
- me.doConstrain();
}
return me;
},
}
return me;
},
+
+ // inherit docs
+ showAt: function(){
+ this.callParent(arguments);
+ if (this.floating) {
+ this.doConstrain();
+ }
+ },
doConstrain : function() {
var me = this,
doConstrain : function() {
var me = this,
- y =
this
.el.getY(),
+ y =
me
.el.getY(),
max, full,
max, full,
+ vector,
returnY = y, normalY, parentEl, scrollTop, viewHeight;
delete me.height;
returnY = y, normalY, parentEl, scrollTop, viewHeight;
delete me.height;
@@
-586,6
+595,10
@@
Ext.define('Ext.menu.Menu', {
me.iconSepEl.setHeight(me.layout.getRenderTarget().dom.scrollHeight);
}
}
me.iconSepEl.setHeight(me.layout.getRenderTarget().dom.scrollHeight);
}
}
+ vector = me.getConstrainVector();
+ if (vector) {
+ me.setPosition(me.getPosition()[0] + vector[0]);
+ }
me.el.setY(returnY);
}
});
\ No newline at end of file
me.el.setY(returnY);
}
});
\ No newline at end of file