1 // private - DD implementation for Panels
2 Ext.define('Ext.draw.SpriteDD', {
3 extend: 'Ext.dd.DragSource',
5 constructor : function(sprite, cfg){
10 me.dragData = {el: el, sprite: sprite};
11 me.callParent([el, cfg]);
12 me.sprite.setStyle('cursor', 'move');
15 showFrame: Ext.emptyFn,
16 createFrame : Ext.emptyFn,
18 getDragEl : function(e){
22 getRegion: function() {
25 pos, x1, x2, y1, y2, t, r, b, l, bbox, sprite;
28 bbox = sprite.getBBox();
31 pos = Ext.core.Element.getXY(el);
41 y2 = y1 + bbox.height;
43 return Ext.create('Ext.util.Region', y1, x2, y2, x1);
47 TODO(nico): Cumulative translations in VML are handled
48 differently than in SVG. While in SVG we specify the translation
49 relative to the original x, y position attributes, in VML the translation
50 is a delta between the last position of the object (modified by the last
51 translation) and the new one.
53 In VML the translation alters the position
54 of the object, we should change that or alter the SVG impl.
57 startDrag: function(x, y) {
59 attr = me.sprite.attr,
60 trans = attr.translation;
62 me.prevX = x + attr.x;
63 me.prevY = y + attr.y;
65 me.prevX = x - trans.x;
66 me.prevY = y - trans.y;
75 me.translateX = xy[0] - me.prevX;
76 me.translateY = xy[1] - me.prevY;
77 sprite.setAttributes({
84 me.prevX = xy[0] + attr.x || 0;
85 me.prevY = xy[1] + attr.y || 0;