View Full Version : Extjs4 drag and drop using DD, not able to drag into top/left direction

7 Feb 2014, 2:49 AM
I am trying to implement drag and drop using ext.dd.DD and DDTarget.

There is a set of few images, and there is a container on the right side, which acts as a drag target.

I am using ext.dd.DD and ext.dd.DDTarget.

The problem is I am not able to drag an object in top or left side of its original place.

After debugging, I noticed following line in method ext.dd.DD.alignElWithMouse, which is internally being called when we implement drag and drop,

this.setLocalXY(fly,Math.max(0, Math.min(oCoord.x + this.deltaSetXY[0], vpSize.width - elSize.width)),Math.max(0, Math.min(oCoord.y + this.deltaSetXY[1], vpSize.height - elSize.height))

This is from ExtJS version 4.2, file : ext-all-dev.js, line 76860.

If I replace, the above line with,

this.setLocalXY(fly,Math.max( Math.min(oCoord.x + this.deltaSetXY[0], vpSize.width - elSize.width),Math.max( Math.min(oCoord.y + this.deltaSetXY[1], vpSize.height - elSize.height)

This allows negative values for X and Y and therefore, I am able to move objects on any place on the form, but this is not a solution, Since I don't want to make any change in core ext js engine.

Please suggest any other way by which I can achive the purpose.


7 Feb 2014, 3:21 AM
You could always extend the component with the corrected functionality and implement the extension.

if it's a bug, there's a forum for that..