1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
jquery.event.drag.js / threedubmedia.com
--------------------------------------------------------------------------------
The MIT License
Copyright (c) 2008, Three Dub Media (threedubmedia@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--------------------------------------------------------------------------------
FUTURE ENHANCEMENTS...
data.handle config
automagic proxy offsets
document::mouseleave?
--------------------------------------------------------------------------------
Changes in Version 1.5, Released 2009-03-24
- Added "dragstart" and "dragend" special event configurations which prevents
default event bindings in Internet Explorer (some events were firing twice).
- Added a custom "ondragstart" handler for IE only to suppress image/text drags
--------------------------------------------------------------------------------
Changes in Version 1.4, Released 2009-01-26
- Fixed a mistake where the "which" property was not correctly checked.
- Changed the initial test for checking if a drag is already underway (within
the shared handler) to an internal property instead of checking for the document
--------------------------------------------------------------------------------
Changes in Version 1.3, Released 2009-01-26
- Now Compatable with jQuery 1.3.x and jQuery 1.2.x
- Fixed a problem with the return value of event handlers. Now use the property
"event.result" instead of the (obsolete) return value of "jQuery.event.handle"
- Fixed the logic for determining the proxy element returned from "dragstart",
The document was being set as the proxy when dragstart returned undefined, and
this caused an error in the offset method in jQuery 1.3
- Added "document.selection.empty()" to the private static "selectable" function
Thanks Jos Mata.
- Added a "which" property to the "jQuery.event.special.drag" object, which
defines the mouse button to "accept" on mousedown to initialize draggging. The
default value is "1" (left mouse button), this attribute is customizable through
the "bind" method using the optional "data" argument.
--------------------------------------------------------------------------------
Changes in Version 1.2, Released 2008-10-06
- Moved the drag init checks to avoid the switch statement when possible
- Made the drag.handler function private
- Renamed private data properties: dist2 -> distance, x -> pageX, y -> pageY
This will theoretically help reduce the gzipped file size.
- Moved distance squared calculation to the "setup" function from "mousdown"
because there is no reason to calculate this value more than once.
- fixed a bug where "event.dragProxy" was being set one "mousemove" event late
- added local variable refs for "$.event" and "$.event.special" to reduce file
size when minified/packed, and speed up execution.
- added private "squared" function to reduce file size/lines.
- added private "hijack" function to reduce file size/lines.
- change the drag method to trigger the "drag" handler instead of "mousedown"
which was an artifact from an earlier version of the code.
--------------------------------------------------------------------------------
Changes in Version 1.1, Released 2008-10-03
- Fixed a bug where the text-selection attributes that were disabled on
"mousedown" were not being enabled on "mouseup" unless the element was dragged.
- Now restoring the event.target property that is captured on "mousedown" before
handling "dragstart" events. This fixes buggy behavior involving "dragstart"
and the "distance" setting, and attempting to capture "handle" elements.
- Modified the handler logic for the "dragstart" return value. The stack can
now continue directly into the "drag" handler call from "dragstart" instead of
waiting for the next "mousemove" event to fire.
- Added a "not" property to the "jQuery.event.special.drag" object which allows
the prevention of drag behavior for any event.target element that matches the
property value (selector). The default value is ":input" and when jQuery 1.3 is
released, this attribute will also be customizable through the "bind" method
using the optional "data" argument. Thanks to Elijah Insua for suggesting this
feature.
- Changed binding of "mousemove" and "mouseup" events from "document.body" to
"document"... This fixes buggy behavior when the body element does not cover
the entire window. Thanks to Jonah Fox (weepy) and Elijah Insua for pointing
out this bug.
--------------------------------------------------------------------------------
Changes in Version 1.0, Released 2008-08-08
- Initial Release
|