It had been originally posted on community and was told to post as a bug
1. Ext version 1.1
2. ext-base.js / ext-core.js/ DDCore-min.js/ JSON-min.js
3. windows xp and linux?
4. browser FF 2.0, 1.5
Ok, I noticed that there was a xy array declared in the global scope; after hours trying to figure if my code was doing it I found out it's from the library.
when you instantiate a DD object and use the constrainTo function (not in the API), this same function declares xy on this part of the code in bold
constrainTo : function(constrainTo, pad, inContent){
if(typeof pad == "number"){
pad = {left: pad, right:pad, top:pad, bottom:pad};
}
pad = pad this.defaultPadding;
var b = Ext.get(this.getEl()).getBox();
var ce = Ext.get(constrainTo);
var s = ce.getScroll();
var c, cd = ce.dom;
if(cd == document.body){
c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
}else{
xy = ce.getXY();
c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
}
var topSpace = b.y - c.y;
var leftSpace = b.x - c.x;
this.resetConstraints();
this.setXConstraint(leftSpace - (pad.left0), // left
c.width - leftSpace - b.width - (pad.right0) //right
);
this.setYConstraint(topSpace - (pad.top0), //top
c.height - topSpace - b.height - (pad.bottom0) //bottom
);
},
Notice that xy is not declare up on top, and if you "alert" xy before and after the constrainTo() call you will see that xy will appear in the global scope.
I fixed my DDCore-min.js, and declared xy locally in constrainTo() and it works now.
usage:
var sDD =new Ext.dd.DD("slider");
sDD.constrainTo("slider_cont");
include this patch in your overrides file till the next release of Ext
Ext.override(Ext.dd.DragDrop, {
constrainTo : function(constrainTo, pad, inContent){
if(typeof pad == "number"){
pad = {left: pad, right:pad, top:pad, bottom:pad};
}
pad = pad this.defaultPadding;
var b = Ext.get(this.getEl()).getBox();
var ce = Ext.get(constrainTo);
var s = ce.getScroll();
var c, cd = ce.dom;
if(cd == document.body){
c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
}else{
var xy = ce.getXY();
c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
}
var topSpace = b.y - c.y;
var leftSpace = b.x - c.x;
this.resetConstraints();
this.setXConstraint(leftSpace - (pad.left0), // left
c.width - leftSpace - b.width - (pad.right0) //right
);
this.setYConstraint(topSpace - (pad.top0), //top
c.height - topSpace - b.height - (pad.bottom0) //bottom
);
}
});
Fixed in SVN. There was also an undeclared "i" var in unregAll that was corrected in the same file.
Allergies.. no relief?!?
Religion in the workplace? |