DragDropManager.html 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  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">/*
  19. * This is a derivative of the similarly named class in the YUI Library.
  20. * The original license:
  21. * Copyright (c) 2006, Yahoo! Inc. All rights reserved.
  22. * Code licensed under the BSD License:
  23. * http://developer.yahoo.net/yui/license.txt
  24. */
  25. <span id='Ext-dd-DragDropManager'>/**
  26. </span> * DragDropManager is a singleton that tracks the element interaction for
  27. * all DragDrop items in the window. Generally, you will not call
  28. * this class directly, but it does have helper methods that could
  29. * be useful in your DragDrop implementations.
  30. */
  31. Ext.define('Ext.dd.DragDropManager', {
  32. singleton: true,
  33. requires: ['Ext.util.Region'],
  34. uses: ['Ext.tip.QuickTipManager'],
  35. // shorter ClassName, to save bytes and use internally
  36. alternateClassName: ['Ext.dd.DragDropMgr', 'Ext.dd.DDM'],
  37. <span id='Ext-dd-DragDropManager-property-ids'> /**
  38. </span> * @property {String[]} ids
  39. * Two dimensional Array of registered DragDrop objects. The first
  40. * dimension is the DragDrop item group, the second the DragDrop
  41. * object.
  42. * @private
  43. */
  44. ids: {},
  45. <span id='Ext-dd-DragDropManager-property-handleIds'> /**
  46. </span> * @property {String[]} handleIds
  47. * Array of element ids defined as drag handles. Used to determine
  48. * if the element that generated the mousedown event is actually the
  49. * handle and not the html element itself.
  50. * @private
  51. */
  52. handleIds: {},
  53. <span id='Ext-dd-DragDropManager-property-dragCurrent'> /**
  54. </span> * @property {Ext.dd.DragDrop} dragCurrent
  55. * the DragDrop object that is currently being dragged
  56. * @private
  57. */
  58. dragCurrent: null,
  59. <span id='Ext-dd-DragDropManager-property-dragOvers'> /**
  60. </span> * @property {Ext.dd.DragDrop[]} dragOvers
  61. * the DragDrop object(s) that are being hovered over
  62. * @private
  63. */
  64. dragOvers: {},
  65. <span id='Ext-dd-DragDropManager-property-deltaX'> /**
  66. </span> * @property {Number} deltaX
  67. * the X distance between the cursor and the object being dragged
  68. * @private
  69. */
  70. deltaX: 0,
  71. <span id='Ext-dd-DragDropManager-property-deltaY'> /**
  72. </span> * @property {Number} deltaY
  73. * the Y distance between the cursor and the object being dragged
  74. * @private
  75. */
  76. deltaY: 0,
  77. <span id='Ext-dd-DragDropManager-property-preventDefault'> /**
  78. </span> * @property {Boolean} preventDefault
  79. * Flag to determine if we should prevent the default behavior of the
  80. * events we define. By default this is true, but this can be set to
  81. * false if you need the default behavior (not recommended)
  82. */
  83. preventDefault: true,
  84. <span id='Ext-dd-DragDropManager-property-stopPropagation'> /**
  85. </span> * @property {Boolean} stopPropagation
  86. * Flag to determine if we should stop the propagation of the events
  87. * we generate. This is true by default but you may want to set it to
  88. * false if the html element contains other features that require the
  89. * mouse click.
  90. */
  91. stopPropagation: true,
  92. <span id='Ext-dd-DragDropManager-property-initialized'> /**
  93. </span> * Internal flag that is set to true when drag and drop has been
  94. * intialized
  95. * @property initialized
  96. * @private
  97. */
  98. initialized: false,
  99. <span id='Ext-dd-DragDropManager-property-locked'> /**
  100. </span> * All drag and drop can be disabled.
  101. * @property locked
  102. * @private
  103. */
  104. locked: false,
  105. <span id='Ext-dd-DragDropManager-method-init'> /**
  106. </span> * Called the first time an element is registered.
  107. * @private
  108. */
  109. init: function() {
  110. this.initialized = true;
  111. },
  112. <span id='Ext-dd-DragDropManager-property-POINT'> /**
  113. </span> * @property {Number} POINT
  114. * In point mode, drag and drop interaction is defined by the
  115. * location of the cursor during the drag/drop
  116. */
  117. POINT: 0,
  118. <span id='Ext-dd-DragDropManager-property-INTERSECT'> /**
  119. </span> * @property {Number} INTERSECT
  120. * In intersect mode, drag and drop interaction is defined by the
  121. * overlap of two or more drag and drop objects.
  122. */
  123. INTERSECT: 1,
  124. <span id='Ext-dd-DragDropManager-property-mode'> /**
  125. </span> * @property {Number} mode
  126. * The current drag and drop mode. Default: POINT
  127. */
  128. mode: 0,
  129. <span id='Ext-dd-DragDropManager-property-notifyOccluded'> /**
  130. </span> * @property {Boolean} [notifyOccluded=false]
  131. * This config is only provided to provide old, usually unwanted drag/drop behaviour.
  132. *
  133. * From ExtJS 4.1.0 onwards, when drop targets are contained in floating, absolutely positioned elements
  134. * such as in {@link Ext.window.Window Windows}, which may overlap each other, `over` and `drop` events
  135. * are only delivered to the topmost drop target at the mouse position.
  136. *
  137. * If all targets below that in zIndex order should also receive notifications, set
  138. * `notifyOccluded` to `true`.
  139. */
  140. notifyOccluded: false,
  141. <span id='Ext-dd-DragDropManager-method-_execOnAll'> /**
  142. </span> * Runs method on all drag and drop objects
  143. * @private
  144. */
  145. _execOnAll: function(sMethod, args) {
  146. var i, j, oDD;
  147. for (i in this.ids) {
  148. for (j in this.ids[i]) {
  149. oDD = this.ids[i][j];
  150. if (! this.isTypeOfDD(oDD)) {
  151. continue;
  152. }
  153. oDD[sMethod].apply(oDD, args);
  154. }
  155. }
  156. },
  157. <span id='Ext-dd-DragDropManager-method-_onLoad'> /**
  158. </span> * Drag and drop initialization. Sets up the global event handlers
  159. * @private
  160. */
  161. _onLoad: function() {
  162. this.init();
  163. var Event = Ext.EventManager;
  164. Event.on(document, &quot;mouseup&quot;, this.handleMouseUp, this, true);
  165. Event.on(document, &quot;mousemove&quot;, this.handleMouseMove, this, true);
  166. Event.on(window, &quot;unload&quot;, this._onUnload, this, true);
  167. Event.on(window, &quot;resize&quot;, this._onResize, this, true);
  168. // Event.on(window, &quot;mouseout&quot;, this._test);
  169. },
  170. <span id='Ext-dd-DragDropManager-method-_onResize'> /**
  171. </span> * Reset constraints on all drag and drop objs
  172. * @private
  173. */
  174. _onResize: function(e) {
  175. this._execOnAll(&quot;resetConstraints&quot;, []);
  176. },
  177. <span id='Ext-dd-DragDropManager-method-lock'> /**
  178. </span> * Lock all drag and drop functionality
  179. */
  180. lock: function() { this.locked = true; },
  181. <span id='Ext-dd-DragDropManager-method-unlock'> /**
  182. </span> * Unlock all drag and drop functionality
  183. */
  184. unlock: function() { this.locked = false; },
  185. <span id='Ext-dd-DragDropManager-method-isLocked'> /**
  186. </span> * Is drag and drop locked?
  187. * @return {Boolean} True if drag and drop is locked, false otherwise.
  188. */
  189. isLocked: function() { return this.locked; },
  190. <span id='Ext-dd-DragDropManager-property-locationCache'> /**
  191. </span> * @property {Object} locationCache
  192. * Location cache that is set for all drag drop objects when a drag is
  193. * initiated, cleared when the drag is finished.
  194. * @private
  195. */
  196. locationCache: {},
  197. <span id='Ext-dd-DragDropManager-property-useCache'> /**
  198. </span> * @property {Boolean} useCache
  199. * Set useCache to false if you want to force object the lookup of each
  200. * drag and drop linked element constantly during a drag.
  201. */
  202. useCache: true,
  203. <span id='Ext-dd-DragDropManager-property-clickPixelThresh'> /**
  204. </span> * @property {Number} clickPixelThresh
  205. * The number of pixels that the mouse needs to move after the
  206. * mousedown before the drag is initiated. Default=3;
  207. */
  208. clickPixelThresh: 3,
  209. <span id='Ext-dd-DragDropManager-property-clickTimeThresh'> /**
  210. </span> * @property {Number} clickTimeThresh
  211. * The number of milliseconds after the mousedown event to initiate the
  212. * drag if we don't get a mouseup event. Default=350
  213. */
  214. clickTimeThresh: 350,
  215. <span id='Ext-dd-DragDropManager-property-dragThreshMet'> /**
  216. </span> * @property {Boolean} dragThreshMet
  217. * Flag that indicates that either the drag pixel threshold or the
  218. * mousdown time threshold has been met
  219. * @private
  220. */
  221. dragThreshMet: false,
  222. <span id='Ext-dd-DragDropManager-property-clickTimeout'> /**
  223. </span> * @property {Object} clickTimeout
  224. * Timeout used for the click time threshold
  225. * @private
  226. */
  227. clickTimeout: null,
  228. <span id='Ext-dd-DragDropManager-property-startX'> /**
  229. </span> * @property {Number} startX
  230. * The X position of the mousedown event stored for later use when a
  231. * drag threshold is met.
  232. * @private
  233. */
  234. startX: 0,
  235. <span id='Ext-dd-DragDropManager-property-startY'> /**
  236. </span> * @property {Number} startY
  237. * The Y position of the mousedown event stored for later use when a
  238. * drag threshold is met.
  239. * @private
  240. */
  241. startY: 0,
  242. <span id='Ext-dd-DragDropManager-method-regDragDrop'> /**
  243. </span> * Each DragDrop instance must be registered with the DragDropManager.
  244. * This is executed in DragDrop.init()
  245. * @param {Ext.dd.DragDrop} oDD the DragDrop object to register
  246. * @param {String} sGroup the name of the group this element belongs to
  247. */
  248. regDragDrop: function(oDD, sGroup) {
  249. if (!this.initialized) { this.init(); }
  250. if (!this.ids[sGroup]) {
  251. this.ids[sGroup] = {};
  252. }
  253. this.ids[sGroup][oDD.id] = oDD;
  254. },
  255. <span id='Ext-dd-DragDropManager-method-removeDDFromGroup'> /**
  256. </span> * Removes the supplied dd instance from the supplied group. Executed
  257. * by DragDrop.removeFromGroup, so don't call this function directly.
  258. * @private
  259. */
  260. removeDDFromGroup: function(oDD, sGroup) {
  261. if (!this.ids[sGroup]) {
  262. this.ids[sGroup] = {};
  263. }
  264. var obj = this.ids[sGroup];
  265. if (obj &amp;&amp; obj[oDD.id]) {
  266. delete obj[oDD.id];
  267. }
  268. },
  269. <span id='Ext-dd-DragDropManager-method-_remove'> /**
  270. </span> * Unregisters a drag and drop item. This is executed in
  271. * DragDrop.unreg, use that method instead of calling this directly.
  272. * @private
  273. */
  274. _remove: function(oDD) {
  275. for (var g in oDD.groups) {
  276. if (g &amp;&amp; this.ids[g] &amp;&amp; this.ids[g][oDD.id]) {
  277. delete this.ids[g][oDD.id];
  278. }
  279. }
  280. delete this.handleIds[oDD.id];
  281. },
  282. <span id='Ext-dd-DragDropManager-method-regHandle'> /**
  283. </span> * Each DragDrop handle element must be registered. This is done
  284. * automatically when executing DragDrop.setHandleElId()
  285. * @param {String} sDDId the DragDrop id this element is a handle for
  286. * @param {String} sHandleId the id of the element that is the drag
  287. * handle
  288. */
  289. regHandle: function(sDDId, sHandleId) {
  290. if (!this.handleIds[sDDId]) {
  291. this.handleIds[sDDId] = {};
  292. }
  293. this.handleIds[sDDId][sHandleId] = sHandleId;
  294. },
  295. <span id='Ext-dd-DragDropManager-method-isDragDrop'> /**
  296. </span> * Utility function to determine if a given element has been
  297. * registered as a drag drop item.
  298. * @param {String} id the element id to check
  299. * @return {Boolean} true if this element is a DragDrop item,
  300. * false otherwise
  301. */
  302. isDragDrop: function(id) {
  303. return ( this.getDDById(id) ) ? true : false;
  304. },
  305. <span id='Ext-dd-DragDropManager-method-getRelated'> /**
  306. </span> * Returns the drag and drop instances that are in all groups the
  307. * passed in instance belongs to.
  308. * @param {Ext.dd.DragDrop} p_oDD the obj to get related data for
  309. * @param {Boolean} bTargetsOnly if true, only return targetable objs
  310. * @return {Ext.dd.DragDrop[]} the related instances
  311. */
  312. getRelated: function(p_oDD, bTargetsOnly) {
  313. var oDDs = [],
  314. i, j, dd;
  315. for (i in p_oDD.groups) {
  316. for (j in this.ids[i]) {
  317. dd = this.ids[i][j];
  318. if (! this.isTypeOfDD(dd)) {
  319. continue;
  320. }
  321. if (!bTargetsOnly || dd.isTarget) {
  322. oDDs[oDDs.length] = dd;
  323. }
  324. }
  325. }
  326. return oDDs;
  327. },
  328. <span id='Ext-dd-DragDropManager-method-isLegalTarget'> /**
  329. </span> * Returns true if the specified dd target is a legal target for
  330. * the specifice drag obj
  331. * @param {Ext.dd.DragDrop} oDD the drag obj
  332. * @param {Ext.dd.DragDrop} oTargetDD the target
  333. * @return {Boolean} true if the target is a legal target for the
  334. * dd obj
  335. */
  336. isLegalTarget: function (oDD, oTargetDD) {
  337. var targets = this.getRelated(oDD, true),
  338. i, len;
  339. for (i=0, len=targets.length;i&lt;len;++i) {
  340. if (targets[i].id == oTargetDD.id) {
  341. return true;
  342. }
  343. }
  344. return false;
  345. },
  346. <span id='Ext-dd-DragDropManager-method-isTypeOfDD'> /**
  347. </span> * My goal is to be able to transparently determine if an object is
  348. * typeof DragDrop, and the exact subclass of DragDrop. typeof
  349. * returns &quot;object&quot;, oDD.constructor.toString() always returns
  350. * &quot;DragDrop&quot; and not the name of the subclass. So for now it just
  351. * evaluates a well-known variable in DragDrop.
  352. * @param {Object} the object to evaluate
  353. * @return {Boolean} true if typeof oDD = DragDrop
  354. */
  355. isTypeOfDD: function (oDD) {
  356. return (oDD &amp;&amp; oDD.__ygDragDrop);
  357. },
  358. <span id='Ext-dd-DragDropManager-method-isHandle'> /**
  359. </span> * Utility function to determine if a given element has been
  360. * registered as a drag drop handle for the given Drag Drop object.
  361. * @param {String} id the element id to check
  362. * @return {Boolean} true if this element is a DragDrop handle, false
  363. * otherwise
  364. */
  365. isHandle: function(sDDId, sHandleId) {
  366. return ( this.handleIds[sDDId] &amp;&amp;
  367. this.handleIds[sDDId][sHandleId] );
  368. },
  369. <span id='Ext-dd-DragDropManager-method-getDDById'> /**
  370. </span> * Returns the DragDrop instance for a given id
  371. * @param {String} id the id of the DragDrop object
  372. * @return {Ext.dd.DragDrop} the drag drop object, null if it is not found
  373. */
  374. getDDById: function(id) {
  375. var me = this,
  376. i, dd;
  377. for (i in this.ids) {
  378. dd = this.ids[i][id];
  379. if (dd instanceof Ext.dd.DDTarget) {
  380. return dd;
  381. }
  382. }
  383. return null;
  384. },
  385. <span id='Ext-dd-DragDropManager-method-handleMouseDown'> /**
  386. </span> * Fired after a registered DragDrop object gets the mousedown event.
  387. * Sets up the events required to track the object being dragged
  388. * @param {Event} e the event
  389. * @param {Ext.dd.DragDrop} oDD the DragDrop object being dragged
  390. * @private
  391. */
  392. handleMouseDown: function(e, oDD) {
  393. if(Ext.tip.QuickTipManager){
  394. Ext.tip.QuickTipManager.ddDisable();
  395. }
  396. if(this.dragCurrent){
  397. // the original browser mouseup wasn't handled (e.g. outside FF browser window)
  398. // so clean up first to avoid breaking the next drag
  399. this.handleMouseUp(e);
  400. }
  401. this.currentTarget = e.getTarget();
  402. this.dragCurrent = oDD;
  403. var el = oDD.getEl();
  404. // We use this to handle an issu where a mouseup will not be detected
  405. // if the mouseup event happens outside of the browser window. When the
  406. // mouse comes back, any drag will still be active
  407. // http://msdn.microsoft.com/en-us/library/ms537630(VS.85).aspx
  408. if (Ext.isIE &amp;&amp; el.setCapture) {
  409. el.setCapture();
  410. }
  411. // track start position
  412. this.startX = e.getPageX();
  413. this.startY = e.getPageY();
  414. this.deltaX = this.startX - el.offsetLeft;
  415. this.deltaY = this.startY - el.offsetTop;
  416. this.dragThreshMet = false;
  417. this.clickTimeout = setTimeout(
  418. function() {
  419. var DDM = Ext.dd.DragDropManager;
  420. DDM.startDrag(DDM.startX, DDM.startY);
  421. },
  422. this.clickTimeThresh );
  423. },
  424. <span id='Ext-dd-DragDropManager-method-startDrag'> /**
  425. </span> * Fired when either the drag pixel threshol or the mousedown hold
  426. * time threshold has been met.
  427. * @param {Number} x the X position of the original mousedown
  428. * @param {Number} y the Y position of the original mousedown
  429. */
  430. startDrag: function(x, y) {
  431. clearTimeout(this.clickTimeout);
  432. if (this.dragCurrent) {
  433. this.dragCurrent.b4StartDrag(x, y);
  434. this.dragCurrent.startDrag(x, y);
  435. }
  436. this.dragThreshMet = true;
  437. },
  438. <span id='Ext-dd-DragDropManager-method-handleMouseUp'> /**
  439. </span> * Internal function to handle the mouseup event. Will be invoked
  440. * from the context of the document.
  441. * @param {Event} e the event
  442. * @private
  443. */
  444. handleMouseUp: function(e) {
  445. var current = this.dragCurrent;
  446. if(Ext.tip &amp;&amp; Ext.tip.QuickTipManager){
  447. Ext.tip.QuickTipManager.ddEnable();
  448. }
  449. if (!current) {
  450. return;
  451. }
  452. // See setCapture call in handleMouseDown
  453. if (Ext.isIE &amp;&amp; document.releaseCapture) {
  454. document.releaseCapture();
  455. }
  456. clearTimeout(this.clickTimeout);
  457. if (this.dragThreshMet) {
  458. this.fireEvents(e, true);
  459. }
  460. this.stopDrag(e);
  461. this.stopEvent(e);
  462. },
  463. <span id='Ext-dd-DragDropManager-method-stopEvent'> /**
  464. </span> * Utility to stop event propagation and event default, if these
  465. * features are turned on.
  466. * @param {Event} e the event as returned by this.getEvent()
  467. */
  468. stopEvent: function(e){
  469. if(this.stopPropagation) {
  470. e.stopPropagation();
  471. }
  472. if (this.preventDefault) {
  473. e.preventDefault();
  474. }
  475. },
  476. <span id='Ext-dd-DragDropManager-method-stopDrag'> /**
  477. </span> * Internal function to clean up event handlers after the drag
  478. * operation is complete
  479. * @param {Event} e the event
  480. * @private
  481. */
  482. stopDrag: function(e) {
  483. // Fire the drag end event for the item that was dragged
  484. if (this.dragCurrent) {
  485. if (this.dragThreshMet) {
  486. this.dragCurrent.b4EndDrag(e);
  487. this.dragCurrent.endDrag(e);
  488. }
  489. this.dragCurrent.onMouseUp(e);
  490. }
  491. this.dragCurrent = null;
  492. this.dragOvers = {};
  493. },
  494. <span id='Ext-dd-DragDropManager-method-handleMouseMove'> /**
  495. </span> * Internal function to handle the mousemove event. Will be invoked
  496. * from the context of the html element.
  497. *
  498. * @TODO figure out what we can do about mouse events lost when the
  499. * user drags objects beyond the window boundary. Currently we can
  500. * detect this in internet explorer by verifying that the mouse is
  501. * down during the mousemove event. Firefox doesn't give us the
  502. * button state on the mousemove event.
  503. *
  504. * @param {Event} e the event
  505. * @private
  506. */
  507. handleMouseMove: function(e) {
  508. var me = this,
  509. diffX,
  510. diffY;
  511. if (!me.dragCurrent) {
  512. return true;
  513. }
  514. if (!me.dragThreshMet) {
  515. diffX = Math.abs(me.startX - e.getPageX());
  516. diffY = Math.abs(me.startY - e.getPageY());
  517. if (diffX &gt; me.clickPixelThresh ||
  518. diffY &gt; me.clickPixelThresh) {
  519. me.startDrag(me.startX, me.startY);
  520. }
  521. }
  522. if (me.dragThreshMet) {
  523. me.dragCurrent.b4Drag(e);
  524. me.dragCurrent.onDrag(e);
  525. if(!me.dragCurrent.moveOnly){
  526. me.fireEvents(e, false);
  527. }
  528. }
  529. me.stopEvent(e);
  530. return true;
  531. },
  532. <span id='Ext-dd-DragDropManager-method-fireEvents'> /**
  533. </span> * Iterates over all of the DragDrop elements to find ones we are
  534. * hovering over or dropping on
  535. * @param {Event} e the event
  536. * @param {Boolean} isDrop is this a drop op or a mouseover op?
  537. * @private
  538. */
  539. fireEvents: function(e, isDrop) {
  540. var me = this,
  541. dragCurrent = me.dragCurrent,
  542. mousePoint = e.getPoint(),
  543. overTarget,
  544. overTargetEl,
  545. allTargets = [],
  546. oldOvers = [], // cache the previous dragOver array
  547. outEvts = [],
  548. overEvts = [],
  549. dropEvts = [],
  550. enterEvts = [],
  551. needsSort,
  552. i,
  553. len,
  554. sGroup;
  555. // If the user did the mouse up outside of the window, we could
  556. // get here even though we have ended the drag.
  557. if (!dragCurrent || dragCurrent.isLocked()) {
  558. return;
  559. }
  560. // Check to see if the object(s) we were hovering over is no longer
  561. // being hovered over so we can fire the onDragOut event
  562. for (i in me.dragOvers) {
  563. overTarget = me.dragOvers[i];
  564. if (! me.isTypeOfDD(overTarget)) {
  565. continue;
  566. }
  567. if (! this.isOverTarget(mousePoint, overTarget, me.mode)) {
  568. outEvts.push( overTarget );
  569. }
  570. oldOvers[i] = true;
  571. delete me.dragOvers[i];
  572. }
  573. // Collect all targets which are members of the same ddGoups that the dragCurrent is a member of, and which may recieve mouseover and drop notifications.
  574. // This is preparatory to seeing which one(s) we are currently over
  575. // Begin by iterating through the ddGroups of which the dragCurrent is a member
  576. for (sGroup in dragCurrent.groups) {
  577. if (&quot;string&quot; != typeof sGroup) {
  578. continue;
  579. }
  580. // Loop over the registered members of each group, testing each as a potential target
  581. for (i in me.ids[sGroup]) {
  582. overTarget = me.ids[sGroup][i];
  583. // The target is valid if it is a DD type
  584. // And it's got a DOM element
  585. // And it's configured to be a drop target
  586. // And it's not locked
  587. // And the DOM element is fully visible with no hidden ancestors
  588. // And it's either not the dragCurrent, or, if it is, tha dragCurrent is configured to not ignore itself.
  589. if (me.isTypeOfDD(overTarget) &amp;&amp;
  590. (overTargetEl = overTarget.getEl()) &amp;&amp;
  591. (overTarget.isTarget) &amp;&amp;
  592. (!overTarget.isLocked()) &amp;&amp;
  593. (Ext.fly(overTargetEl).isVisible(true)) &amp;&amp;
  594. ((overTarget != dragCurrent) || (dragCurrent.ignoreSelf === false))) {
  595. // Only sort by zIndex if there were some which had a floating zIndex value
  596. if ((overTarget.zIndex = me.getZIndex(overTargetEl)) !== -1) {
  597. needsSort = true;
  598. }
  599. allTargets.push(overTarget);
  600. }
  601. }
  602. }
  603. // If there were floating targets, sort the highest zIndex to the top
  604. if (needsSort) {
  605. Ext.Array.sort(allTargets, me.byZIndex);
  606. }
  607. // Loop through possible targets, notifying the one(s) we are over.
  608. // Usually we only deliver events to the topmost.
  609. for (i = 0, len = allTargets.length; i &lt; len; i++) {
  610. overTarget = allTargets[i];
  611. // If we are over the overTarget, queue it up to recieve an event of whatever type we are handling
  612. if (me.isOverTarget(mousePoint, overTarget, me.mode)) {
  613. // look for drop interactions
  614. if (isDrop) {
  615. dropEvts.push( overTarget );
  616. // look for drag enter and drag over interactions
  617. } else {
  618. // initial drag over: dragEnter fires
  619. if (!oldOvers[overTarget.id]) {
  620. enterEvts.push( overTarget );
  621. // subsequent drag overs: dragOver fires
  622. } else {
  623. overEvts.push( overTarget );
  624. }
  625. me.dragOvers[overTarget.id] = overTarget;
  626. }
  627. // Unless this DragDropManager has been explicitly configured to deliver events to multiple targets, then we are done.
  628. if (!me.notifyOccluded) {
  629. break;
  630. }
  631. }
  632. }
  633. if (me.mode) {
  634. if (outEvts.length) {
  635. dragCurrent.b4DragOut(e, outEvts);
  636. dragCurrent.onDragOut(e, outEvts);
  637. }
  638. if (enterEvts.length) {
  639. dragCurrent.onDragEnter(e, enterEvts);
  640. }
  641. if (overEvts.length) {
  642. dragCurrent.b4DragOver(e, overEvts);
  643. dragCurrent.onDragOver(e, overEvts);
  644. }
  645. if (dropEvts.length) {
  646. dragCurrent.b4DragDrop(e, dropEvts);
  647. dragCurrent.onDragDrop(e, dropEvts);
  648. }
  649. } else {
  650. // fire dragout events
  651. for (i=0, len=outEvts.length; i&lt;len; ++i) {
  652. dragCurrent.b4DragOut(e, outEvts[i].id);
  653. dragCurrent.onDragOut(e, outEvts[i].id);
  654. }
  655. // fire enter events
  656. for (i=0,len=enterEvts.length; i&lt;len; ++i) {
  657. // dc.b4DragEnter(e, oDD.id);
  658. dragCurrent.onDragEnter(e, enterEvts[i].id);
  659. }
  660. // fire over events
  661. for (i=0,len=overEvts.length; i&lt;len; ++i) {
  662. dragCurrent.b4DragOver(e, overEvts[i].id);
  663. dragCurrent.onDragOver(e, overEvts[i].id);
  664. }
  665. // fire drop events
  666. for (i=0, len=dropEvts.length; i&lt;len; ++i) {
  667. dragCurrent.b4DragDrop(e, dropEvts[i].id);
  668. dragCurrent.onDragDrop(e, dropEvts[i].id);
  669. }
  670. }
  671. // notify about a drop that did not find a target
  672. if (isDrop &amp;&amp; !dropEvts.length) {
  673. dragCurrent.onInvalidDrop(e);
  674. }
  675. },
  676. <span id='Ext-dd-DragDropManager-method-getZIndex'> /**
  677. </span> * @private
  678. * Collects the z-index of the passed element, looking up the parentNode axis to find an absolutely positioned ancestor
  679. * which is able to yield a z-index. If found to be not absolutely positionedm returns -1.
  680. *
  681. * This is used when sorting potential drop targets into z-index order so that only the topmost receives `over` and `drop` events.
  682. *
  683. * @return {Number} The z-index of the element, or of its topmost absolutely positioned ancestor. Returns -1 if the element is not
  684. * absolutely positioned.
  685. */
  686. getZIndex: function(element) {
  687. var body = document.body,
  688. z,
  689. zIndex = -1;
  690. element = Ext.getDom(element);
  691. while (element !== body) {
  692. if (!isNaN(z = Number(Ext.fly(element).getStyle('zIndex')))) {
  693. zIndex = z;
  694. }
  695. element = element.parentNode;
  696. }
  697. return zIndex;
  698. },
  699. <span id='Ext-dd-DragDropManager-method-byZIndex'> /**
  700. </span> * @private
  701. * Utility method to pass to {@link Ext.Array#sort} when sorting potential drop targets by z-index.
  702. */
  703. byZIndex: function(d1, d2) {
  704. return d1.zIndex &lt; d2.zIndex;
  705. },
  706. <span id='Ext-dd-DragDropManager-method-getBestMatch'> /**
  707. </span> * Helper function for getting the best match from the list of drag
  708. * and drop objects returned by the drag and drop events when we are
  709. * in INTERSECT mode. It returns either the first object that the
  710. * cursor is over, or the object that has the greatest overlap with
  711. * the dragged element.
  712. * @param {Ext.dd.DragDrop[]} dds The array of drag and drop objects
  713. * targeted
  714. * @return {Ext.dd.DragDrop} The best single match
  715. */
  716. getBestMatch: function(dds) {
  717. var winner = null,
  718. len = dds.length,
  719. i, dd;
  720. // Return null if the input is not what we expect
  721. //if (!dds || !dds.length || dds.length == 0) {
  722. // winner = null;
  723. // If there is only one item, it wins
  724. //} else if (dds.length == 1) {
  725. if (len == 1) {
  726. winner = dds[0];
  727. } else {
  728. // Loop through the targeted items
  729. for (i=0; i&lt;len; ++i) {
  730. dd = dds[i];
  731. // If the cursor is over the object, it wins. If the
  732. // cursor is over multiple matches, the first one we come
  733. // to wins.
  734. if (dd.cursorIsOver) {
  735. winner = dd;
  736. break;
  737. // Otherwise the object with the most overlap wins
  738. } else {
  739. if (!winner ||
  740. winner.overlap.getArea() &lt; dd.overlap.getArea()) {
  741. winner = dd;
  742. }
  743. }
  744. }
  745. }
  746. return winner;
  747. },
  748. <span id='Ext-dd-DragDropManager-method-refreshCache'> /**
  749. </span> * Refreshes the cache of the top-left and bottom-right points of the
  750. * drag and drop objects in the specified group(s). This is in the
  751. * format that is stored in the drag and drop instance, so typical
  752. * usage is:
  753. *
  754. * Ext.dd.DragDropManager.refreshCache(ddinstance.groups);
  755. *
  756. * Alternatively:
  757. *
  758. * Ext.dd.DragDropManager.refreshCache({group1:true, group2:true});
  759. *
  760. * @TODO this really should be an indexed array. Alternatively this
  761. * method could accept both.
  762. *
  763. * @param {Object} groups an associative array of groups to refresh
  764. */
  765. refreshCache: function(groups) {
  766. var sGroup, i, oDD, loc;
  767. for (sGroup in groups) {
  768. if (&quot;string&quot; != typeof sGroup) {
  769. continue;
  770. }
  771. for (i in this.ids[sGroup]) {
  772. oDD = this.ids[sGroup][i];
  773. if (this.isTypeOfDD(oDD)) {
  774. // if (this.isTypeOfDD(oDD) &amp;&amp; oDD.isTarget) {
  775. loc = this.getLocation(oDD);
  776. if (loc) {
  777. this.locationCache[oDD.id] = loc;
  778. } else {
  779. delete this.locationCache[oDD.id];
  780. // this will unregister the drag and drop object if
  781. // the element is not in a usable state
  782. // oDD.unreg();
  783. }
  784. }
  785. }
  786. }
  787. },
  788. <span id='Ext-dd-DragDropManager-method-verifyEl'> /**
  789. </span> * This checks to make sure an element exists and is in the DOM. The
  790. * main purpose is to handle cases where innerHTML is used to remove
  791. * drag and drop objects from the DOM. IE provides an 'unspecified
  792. * error' when trying to access the offsetParent of such an element
  793. * @param {HTMLElement} el the element to check
  794. * @return {Boolean} true if the element looks usable
  795. */
  796. verifyEl: function(el) {
  797. if (el) {
  798. var parent;
  799. if(Ext.isIE){
  800. try{
  801. parent = el.offsetParent;
  802. }catch(e){}
  803. }else{
  804. parent = el.offsetParent;
  805. }
  806. if (parent) {
  807. return true;
  808. }
  809. }
  810. return false;
  811. },
  812. <span id='Ext-dd-DragDropManager-method-getLocation'> /**
  813. </span> * Returns a Region object containing the drag and drop element's position
  814. * and size, including the padding configured for it
  815. * @param {Ext.dd.DragDrop} oDD the drag and drop object to get the location for.
  816. * @return {Ext.util.Region} a Region object representing the total area
  817. * the element occupies, including any padding
  818. * the instance is configured for.
  819. */
  820. getLocation: function(oDD) {
  821. if (! this.isTypeOfDD(oDD)) {
  822. return null;
  823. }
  824. //delegate getLocation method to the
  825. //drag and drop target.
  826. if (oDD.getRegion) {
  827. return oDD.getRegion();
  828. }
  829. var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
  830. try {
  831. pos= Ext.Element.getXY(el);
  832. } catch (e) { }
  833. if (!pos) {
  834. return null;
  835. }
  836. x1 = pos[0];
  837. x2 = x1 + el.offsetWidth;
  838. y1 = pos[1];
  839. y2 = y1 + el.offsetHeight;
  840. t = y1 - oDD.padding[0];
  841. r = x2 + oDD.padding[1];
  842. b = y2 + oDD.padding[2];
  843. l = x1 - oDD.padding[3];
  844. return new Ext.util.Region(t, r, b, l);
  845. },
  846. <span id='Ext-dd-DragDropManager-method-isOverTarget'> /**
  847. </span> * Checks the cursor location to see if it over the target
  848. * @param {Ext.util.Point} pt The point to evaluate
  849. * @param {Ext.dd.DragDrop} oTarget the DragDrop object we are inspecting
  850. * @return {Boolean} true if the mouse is over the target
  851. * @private
  852. */
  853. isOverTarget: function(pt, oTarget, intersect) {
  854. // use cache if available
  855. var loc = this.locationCache[oTarget.id],
  856. dc, pos, el, curRegion, overlap;
  857. if (!loc || !this.useCache) {
  858. loc = this.getLocation(oTarget);
  859. this.locationCache[oTarget.id] = loc;
  860. }
  861. if (!loc) {
  862. return false;
  863. }
  864. oTarget.cursorIsOver = loc.contains( pt );
  865. // DragDrop is using this as a sanity check for the initial mousedown
  866. // in this case we are done. In POINT mode, if the drag obj has no
  867. // contraints, we are also done. Otherwise we need to evaluate the
  868. // location of the target as related to the actual location of the
  869. // dragged element.
  870. dc = this.dragCurrent;
  871. if (!dc || !dc.getTargetCoord ||
  872. (!intersect &amp;&amp; !dc.constrainX &amp;&amp; !dc.constrainY)) {
  873. return oTarget.cursorIsOver;
  874. }
  875. oTarget.overlap = null;
  876. // Get the current location of the drag element, this is the
  877. // location of the mouse event less the delta that represents
  878. // where the original mousedown happened on the element. We
  879. // need to consider constraints and ticks as well.
  880. pos = dc.getTargetCoord(pt.x, pt.y);
  881. el = dc.getDragEl();
  882. curRegion = new Ext.util.Region(pos.y,
  883. pos.x + el.offsetWidth,
  884. pos.y + el.offsetHeight,
  885. pos.x );
  886. overlap = curRegion.intersect(loc);
  887. if (overlap) {
  888. oTarget.overlap = overlap;
  889. return (intersect) ? true : oTarget.cursorIsOver;
  890. } else {
  891. return false;
  892. }
  893. },
  894. <span id='Ext-dd-DragDropManager-method-_onUnload'> /**
  895. </span> * unload event handler
  896. * @private
  897. */
  898. _onUnload: function(e, me) {
  899. Ext.dd.DragDropManager.unregAll();
  900. },
  901. <span id='Ext-dd-DragDropManager-method-unregAll'> /**
  902. </span> * Cleans up the drag and drop events and objects.
  903. * @private
  904. */
  905. unregAll: function() {
  906. if (this.dragCurrent) {
  907. this.stopDrag();
  908. this.dragCurrent = null;
  909. }
  910. this._execOnAll(&quot;unreg&quot;, []);
  911. for (var i in this.elementCache) {
  912. delete this.elementCache[i];
  913. }
  914. this.elementCache = {};
  915. this.ids = {};
  916. },
  917. <span id='Ext-dd-DragDropManager-property-elementCache'> /**
  918. </span> * @property {Object} elementCache
  919. * A cache of DOM elements
  920. * @private
  921. */
  922. elementCache: {},
  923. <span id='Ext-dd-DragDropManager-method-getElWrapper'> /**
  924. </span> * Get the wrapper for the DOM element specified
  925. * @param {String} id the id of the element to get
  926. * @return {Ext.dd.DragDropManager.ElementWrapper} the wrapped element
  927. * @private
  928. * @deprecated This wrapper isn't that useful
  929. */
  930. getElWrapper: function(id) {
  931. var oWrapper = this.elementCache[id];
  932. if (!oWrapper || !oWrapper.el) {
  933. oWrapper = this.elementCache[id] =
  934. new this.ElementWrapper(Ext.getDom(id));
  935. }
  936. return oWrapper;
  937. },
  938. <span id='Ext-dd-DragDropManager-method-getElement'> /**
  939. </span> * Returns the actual DOM element
  940. * @param {String} id the id of the elment to get
  941. * @return {Object} The element
  942. * @deprecated use Ext.lib.Ext.getDom instead
  943. */
  944. getElement: function(id) {
  945. return Ext.getDom(id);
  946. },
  947. <span id='Ext-dd-DragDropManager-method-getCss'> /**
  948. </span> * Returns the style property for the DOM element (i.e.,
  949. * document.getElById(id).style)
  950. * @param {String} id the id of the elment to get
  951. * @return {Object} The style property of the element
  952. */
  953. getCss: function(id) {
  954. var el = Ext.getDom(id);
  955. return (el) ? el.style : null;
  956. },
  957. <span id='Ext-dd-DragDropManager-ElementWrapper'> /**
  958. </span> * @class Ext.dd.DragDropManager.ElementWrapper
  959. * Deprecated inner class for cached elements.
  960. * @private
  961. * @deprecated This wrapper isn't that useful
  962. */
  963. ElementWrapper: function(el) {
  964. <span id='Ext-dd-DragDropManager-ElementWrapper-property-el'> /** The element */
  965. </span> this.el = el || null;
  966. <span id='Ext-dd-DragDropManager-ElementWrapper-property-id'> /** The element id */
  967. </span> this.id = this.el &amp;&amp; el.id;
  968. <span id='Ext-dd-DragDropManager-ElementWrapper-property-css'> /** A reference to the style property */
  969. </span> this.css = this.el &amp;&amp; el.style;
  970. },
  971. // Continue class docs
  972. <span id='Ext-dd-DragDropElement'> /** @class Ext.dd.DragDropElement */
  973. </span>
  974. <span id='Ext-dd-DragDropElement-method-getPosX'> /**
  975. </span> * Returns the X position of an html element
  976. * @param {HTMLElement} el the element for which to get the position
  977. * @return {Number} the X coordinate
  978. */
  979. getPosX: function(el) {
  980. return Ext.Element.getX(el);
  981. },
  982. <span id='Ext-dd-DragDropElement-method-getPosY'> /**
  983. </span> * Returns the Y position of an html element
  984. * @param {HTMLElement} el the element for which to get the position
  985. * @return {Number} the Y coordinate
  986. */
  987. getPosY: function(el) {
  988. return Ext.Element.getY(el);
  989. },
  990. <span id='Ext-dd-DragDropElement-method-swapNode'> /**
  991. </span> * Swap two nodes. In IE, we use the native method, for others we
  992. * emulate the IE behavior
  993. * @param {HTMLElement} n1 the first node to swap
  994. * @param {HTMLElement} n2 the other node to swap
  995. */
  996. swapNode: function(n1, n2) {
  997. if (n1.swapNode) {
  998. n1.swapNode(n2);
  999. } else {
  1000. var p = n2.parentNode,
  1001. s = n2.nextSibling;
  1002. if (s == n1) {
  1003. p.insertBefore(n1, n2);
  1004. } else if (n2 == n1.nextSibling) {
  1005. p.insertBefore(n2, n1);
  1006. } else {
  1007. n1.parentNode.replaceChild(n2, n1);
  1008. p.insertBefore(n1, s);
  1009. }
  1010. }
  1011. },
  1012. <span id='Ext-dd-DragDropElement-method-getScroll'> /**
  1013. </span> * Returns the current scroll position
  1014. * @private
  1015. */
  1016. getScroll: function () {
  1017. var doc = window.document,
  1018. docEl = doc.documentElement,
  1019. body = doc.body,
  1020. top = 0,
  1021. left = 0;
  1022. if (Ext.isGecko4) {
  1023. top = window.scrollYOffset;
  1024. left = window.scrollXOffset;
  1025. } else {
  1026. if (docEl &amp;&amp; (docEl.scrollTop || docEl.scrollLeft)) {
  1027. top = docEl.scrollTop;
  1028. left = docEl.scrollLeft;
  1029. } else if (body) {
  1030. top = body.scrollTop;
  1031. left = body.scrollLeft;
  1032. }
  1033. }
  1034. return {
  1035. top: top,
  1036. left: left
  1037. };
  1038. },
  1039. <span id='Ext-dd-DragDropElement-method-getStyle'> /**
  1040. </span> * Returns the specified element style property
  1041. * @param {HTMLElement} el the element
  1042. * @param {String} styleProp the style property
  1043. * @return {String} The value of the style property
  1044. */
  1045. getStyle: function(el, styleProp) {
  1046. return Ext.fly(el).getStyle(styleProp);
  1047. },
  1048. <span id='Ext-dd-DragDropElement-method-getScrollTop'> /**
  1049. </span> * Gets the scrollTop
  1050. * @return {Number} the document's scrollTop
  1051. */
  1052. getScrollTop: function () {
  1053. return this.getScroll().top;
  1054. },
  1055. <span id='Ext-dd-DragDropElement-method-getScrollLeft'> /**
  1056. </span> * Gets the scrollLeft
  1057. * @return {Number} the document's scrollTop
  1058. */
  1059. getScrollLeft: function () {
  1060. return this.getScroll().left;
  1061. },
  1062. <span id='Ext-dd-DragDropElement-method-moveToEl'> /**
  1063. </span> * Sets the x/y position of an element to the location of the
  1064. * target element.
  1065. * @param {HTMLElement} moveEl The element to move
  1066. * @param {HTMLElement} targetEl The position reference element
  1067. */
  1068. moveToEl: function (moveEl, targetEl) {
  1069. var aCoord = Ext.Element.getXY(targetEl);
  1070. Ext.Element.setXY(moveEl, aCoord);
  1071. },
  1072. <span id='Ext-dd-DragDropElement-method-numericSort'> /**
  1073. </span> * Numeric array sort function
  1074. * @param {Number} a
  1075. * @param {Number} b
  1076. * @returns {Number} positive, negative or 0
  1077. */
  1078. numericSort: function(a, b) {
  1079. return (a - b);
  1080. },
  1081. <span id='Ext-dd-DragDropElement-property-_timeoutCount'> /**
  1082. </span> * @property {Number} _timeoutCount
  1083. * Internal counter
  1084. * @private
  1085. */
  1086. _timeoutCount: 0,
  1087. <span id='Ext-dd-DragDropElement-method-_addListeners'> /**
  1088. </span> * Trying to make the load order less important. Without this we get
  1089. * an error if this file is loaded before the Event Utility.
  1090. * @private
  1091. */
  1092. _addListeners: function() {
  1093. if ( document ) {
  1094. this._onLoad();
  1095. } else {
  1096. if (this._timeoutCount &lt;= 2000) {
  1097. setTimeout(this._addListeners, 10);
  1098. if (document &amp;&amp; document.body) {
  1099. this._timeoutCount += 1;
  1100. }
  1101. }
  1102. }
  1103. },
  1104. <span id='Ext-dd-DragDropElement-method-handleWasClicked'> /**
  1105. </span> * Recursively searches the immediate parent and all child nodes for
  1106. * the handle element in order to determine wheter or not it was
  1107. * clicked.
  1108. * @param {HTMLElement} node the html element to inspect
  1109. */
  1110. handleWasClicked: function(node, id) {
  1111. if (this.isHandle(id, node.id)) {
  1112. return true;
  1113. } else {
  1114. // check to see if this is a text node child of the one we want
  1115. var p = node.parentNode;
  1116. while (p) {
  1117. if (this.isHandle(id, p.id)) {
  1118. return true;
  1119. } else {
  1120. p = p.parentNode;
  1121. }
  1122. }
  1123. }
  1124. return false;
  1125. }
  1126. }, function() {
  1127. this._addListeners();
  1128. });
  1129. </pre>
  1130. </body>
  1131. </html>