PDA

View Full Version : drag-n-drop unclear offset



juggerr
30 Aug 2011, 5:40 AM
Hi.
I need to drag-n-drop captions on the grid headers. Аs dragSource I used panel without body, just title.
The problem is that when I drag the panel, it moves away from the cursor.
27752
Thanks for help!

skirtle
30 Aug 2011, 8:23 AM
You'll need to post some code. Please ensure that your test case is both complete and minimal. Also be sure to wrap code in code tags (# button on the editor toolbar).

juggerr
30 Aug 2011, 11:41 PM
Element has been created so:


{
xtype : 'panel',
id: 'cli',
title : CLI,
width : 125,
draggable: true,
y: 14
},

Then I make dragSource from it:


var cli = new Ext.dd.DragSource('cli');

And processing it by my way:


new Ext.dd.DropTarget('first-dtarget',{
notifyDrop : function(ddSource, e, data){
firstCol = DnD(ddSource, firstCol, 0);
checkoutValidColsDefineLoop()
return true;
}
});


This drag elements is child elements of common panel, and the offset between the cursor-indicator and a copy of the element is proportional to the position of this element to the upper left corner of the panel.

2776927770

skirtle
1 Sep 2011, 11:08 AM
Looks to me like it might be a bug. Try this workaround:


var cli = new Ext.dd.DragSource('cli', {
onStartDrag: function() {
this.proxy.ghost.first().setLeftTop(0, 0);
}
});

juggerr
2 Sep 2011, 3:11 AM
It is work! problem is resolved!
Thank you so much skirtle!

Bob Wilson
4 Jul 2012, 5:12 PM
Hi

The bug seems to still be there in 4.1.1 RC2