PDA

View Full Version : Problem with Drag and Drop



Urkman
12 Jan 2010, 3:57 AM
Hello,

I use the following Code to create and handle Drag and Drop Objects:


pElement.getEl().dd = new Ext.dd.DD( pElement.getEl() );
Ext.apply( pElement.getEl().dd, {
startDrag: function( pX, pY )
{
// Here I calculate the min and max values.

this.setXConstraint( minX, maxX );
this.setYConstraint( minY, maxY );
},

endDrag:function( pEvent )
{
// Here I store the position for later use.
}
});
I use "setXConstraint" to limit the dragging of the element.
This works fine for the first drag. The element can only be draged inside the given values.
But when I take the same element and drag it again, it is not working. The dragging of element is not limited correct. I try to debug it and take a look at the min and max values, but they seem to be OK...

Perhaps somebody can give me a hint one this.

Thanks and greetings,
Urkman

Urkman
12 Jan 2010, 6:26 AM
Hello,

I found a solution:

Add

this.setInitPosition();to the endDrag() Function.

But why do I need this?

Greetings,
Urkman