You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.1 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js"><span id='Ext-tree-TreeDragZone-method-constructor'><span id='Ext-tree-TreeDragZone'>/**
  19. </span></span> * @class Ext.tree.TreeDragZone
  20. * @extends Ext.dd.DragZone
  21. * @constructor
  22. * @param {String/HTMLElement/Element} tree The {@link Ext.tree.TreePanel} for which to enable dragging
  23. * @param {Object} config
  24. */
  25. if(Ext.dd.DragZone){
  26. Ext.tree.TreeDragZone = function(tree, config){
  27. Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.innerCt, config);
  28. <span id='Ext-tree-TreeDragZone-property-tree'> /**
  29. </span> * The TreePanel for this drag zone
  30. * @type Ext.tree.TreePanel
  31. * @property
  32. */
  33. this.tree = tree;
  34. };
  35. Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {
  36. <span id='Ext-tree-TreeDragZone-cfg-ddGroup'> /**
  37. </span> * @cfg {String} ddGroup
  38. * A named drag drop group to which this object belongs. If a group is specified, then this object will only
  39. * interact with other drag drop objects in the same group (defaults to 'TreeDD').
  40. */
  41. ddGroup : &quot;TreeDD&quot;,
  42. // private
  43. onBeforeDrag : function(data, e){
  44. var n = data.node;
  45. return n &amp;&amp; n.draggable &amp;&amp; !n.disabled;
  46. },
  47. // private
  48. onInitDrag : function(e){
  49. var data = this.dragData;
  50. this.tree.getSelectionModel().select(data.node);
  51. this.tree.eventModel.disable();
  52. this.proxy.update(&quot;&quot;);
  53. data.node.ui.appendDDGhost(this.proxy.ghost.dom);
  54. this.tree.fireEvent(&quot;startdrag&quot;, this.tree, data.node, e);
  55. },
  56. // private
  57. getRepairXY : function(e, data){
  58. return data.node.ui.getDDRepairXY();
  59. },
  60. // private
  61. onEndDrag : function(data, e){
  62. this.tree.eventModel.enable.defer(100, this.tree.eventModel);
  63. this.tree.fireEvent(&quot;enddrag&quot;, this.tree, data.node, e);
  64. },
  65. // private
  66. onValidDrop : function(dd, e, id){
  67. this.tree.fireEvent(&quot;dragdrop&quot;, this.tree, this.dragData.node, dd, e);
  68. this.hideProxy();
  69. },
  70. // private
  71. beforeInvalidDrop : function(e, id){
  72. // this scrolls the original position back into view
  73. var sm = this.tree.getSelectionModel();
  74. sm.clearSelections();
  75. sm.select(this.dragData.node);
  76. },
  77. // private
  78. afterRepair : function(){
  79. if (Ext.enableFx &amp;&amp; this.tree.hlDrop) {
  80. Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || &quot;c3daf9&quot;);
  81. }
  82. this.dragging = false;
  83. }
  84. });
  85. }</pre>
  86. </body>
  87. </html>