ViewDragZone.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-ViewDragZone'>/**
  19. </span> * @private
  20. */
  21. Ext.define('Ext.tree.ViewDragZone', {
  22. extend: 'Ext.view.DragZone',
  23. isPreventDrag: function(e, record) {
  24. return (record.get('allowDrag') === false) || !!e.getTarget(this.view.expanderSelector);
  25. },
  26. afterRepair: function() {
  27. var me = this,
  28. view = me.view,
  29. selectedRowCls = view.selectedItemCls,
  30. records = me.dragData.records,
  31. r,
  32. rLen = records.length,
  33. fly = Ext.fly,
  34. item;
  35. if (Ext.enableFx &amp;&amp; me.repairHighlight) {
  36. // Roll through all records and highlight all the ones we attempted to drag.
  37. for (r = 0; r &lt; rLen; r++) {
  38. // anonymous fns below, don't hoist up unless below is wrapped in
  39. // a self-executing function passing in item.
  40. item = view.getNode(records[r]);
  41. // We must remove the selected row class before animating, because
  42. // the selected row class declares !important on its background-color.
  43. fly(item.firstChild).highlight(me.repairHighlightColor, {
  44. listeners: {
  45. beforeanimate: function() {
  46. if (view.isSelected(item)) {
  47. fly(item).removeCls(selectedRowCls);
  48. }
  49. },
  50. afteranimate: function() {
  51. if (view.isSelected(item)) {
  52. fly(item).addCls(selectedRowCls);
  53. }
  54. }
  55. }
  56. });
  57. }
  58. }
  59. me.dragging = false;
  60. }
  61. });</pre>
  62. </body>
  63. </html>