4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js">// private - DD implementation for Panels
19 Ext.define('Ext.draw.SpriteDD', {
20 extend: 'Ext.dd.DragSource',
22 constructor : function(sprite, cfg){
27 me.dragData = {el: el, sprite: sprite};
28 me.callParent([el, cfg]);
29 me.sprite.setStyle('cursor', 'move');
32 showFrame: Ext.emptyFn,
33 createFrame : Ext.emptyFn,
35 getDragEl : function(e){
39 getRegion: function() {
42 pos, x1, x2, y1, y2, t, r, b, l, bbox, sprite;
45 bbox = sprite.getBBox();
48 pos = Ext.core.Element.getXY(el);
58 y2 = y1 + bbox.height;
60 return Ext.create('Ext.util.Region', y1, x2, y2, x1);
64 TODO(nico): Cumulative translations in VML are handled
65 differently than in SVG. While in SVG we specify the translation
66 relative to the original x, y position attributes, in VML the translation
67 is a delta between the last position of the object (modified by the last
68 translation) and the new one.
70 In VML the translation alters the position
71 of the object, we should change that or alter the SVG impl.
74 startDrag: function(x, y) {
76 attr = me.sprite.attr,
77 trans = attr.translation;
79 me.prevX = x + attr.x;
80 me.prevY = y + attr.y;
82 me.prevX = x - trans.x;
83 me.prevY = y - trans.y;
92 me.translateX = xy[0] - me.prevX;
93 me.translateY = xy[1] - me.prevY;
94 sprite.setAttributes({
101 me.prevX = xy[0] + attr.x || 0;
102 me.prevY = xy[1] + attr.y || 0;