commit
9a4a2a6e2f
27
src/mouse.js
27
src/mouse.js
|
@ -42,9 +42,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
stopTouch = function () {
|
||||
return this.originalEvent.stopPropagation();
|
||||
},
|
||||
addEvent = (function () {
|
||||
if (glob.doc.addEventListener) {
|
||||
return function (obj, type, fn, element) {
|
||||
addEvent = function (obj, type, fn, element) {
|
||||
var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
|
||||
f = function (e) {
|
||||
var scrollY = getScroll("y", element),
|
||||
|
@ -80,28 +78,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
|
|||
obj.removeEventListener(realName, f, false);
|
||||
return true;
|
||||
};
|
||||
};
|
||||
} else if (glob.doc.attachEvent) {
|
||||
return function (obj, type, fn, element) {
|
||||
var f = function (e) {
|
||||
e = e || element.node.ownerDocument.window.event;
|
||||
var scrollY = getScroll("y", element),
|
||||
scrollX = getScroll("x", element),
|
||||
x = e.clientX + scrollX,
|
||||
y = e.clientY + scrollY;
|
||||
e.preventDefault = e.preventDefault || preventDefault;
|
||||
e.stopPropagation = e.stopPropagation || stopPropagation;
|
||||
return fn.call(element, e, x, y);
|
||||
};
|
||||
obj.attachEvent("on" + type, f);
|
||||
var detacher = function () {
|
||||
obj.detachEvent("on" + type, f);
|
||||
return true;
|
||||
};
|
||||
return detacher;
|
||||
};
|
||||
}
|
||||
})(),
|
||||
},
|
||||
drag = [],
|
||||
dragMove = function (e) {
|
||||
var x = e.clientX,
|
||||
|
|
Loading…
Reference in New Issue