react-draggable
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,2 +5,6 @@ # Changelog | ||
- Initial release | ||
- Initial release | ||
### 0.1.1 (Jul 26, 2014) | ||
- Fixing dragging not stopping on mouseup in some cases |
@@ -47,2 +47,24 @@ 'use strict'; | ||
function addEvent(el, event, handler) { | ||
if (!el) { return; } | ||
if (el.attachEvent) { | ||
el.attachEvent('on' + event, handler); | ||
} else if (el.addEventListener) { | ||
el.addEventListener(event, handler, true); | ||
} else { | ||
el['on' + event] = handler; | ||
} | ||
} | ||
function removeEvent(el, event, handler) { | ||
if (!el) { return; } | ||
if (el.detachEvent) { | ||
el.detachEvent('on' + event, handler); | ||
} else if (el.removeEventListener) { | ||
el.removeEventListener(event, handler, true); | ||
} else { | ||
el['on' + event] = null; | ||
} | ||
} | ||
module.exports = React.createClass({ | ||
@@ -233,3 +255,4 @@ displayName: 'Draggable', | ||
window.addEventListener('mousemove', this.handleMouseMove); | ||
addEvent(window, 'mousemove', this.handleMouseMove); | ||
addEvent(window, 'mouseup', this.handleMouseUp); | ||
}, | ||
@@ -248,3 +271,4 @@ | ||
window.removeEventListener('mousemove', this.handleMouseMove); | ||
removeEvent(window, 'mousemove', this.handleMouseMove); | ||
removeEvent(window, 'mouseup', this.handleMouseUp); | ||
}, | ||
@@ -251,0 +275,0 @@ |
{ | ||
"name": "react-draggable", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "React draggable component", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49118
283