From 07b4969690b0f4e784edd8396530a80272ab43eb Mon Sep 17 00:00:00 2001 From: Walter Roman Date: Wed, 23 Apr 2014 10:47:27 -0700 Subject: [PATCH 1/2] Updated README with instructions for installation either through Bower or manually --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 1ecabff..8040710 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,12 @@ A JavaScript SVG library for the modern web. Learn more at [snapsvg.io](http://s [Follow us on Twitter.](https://twitter.com/snapsvg) +### Install +* [Bower](http://bower.io/) - `bower install snap.svg` +* Manual Minified - https://github.com/adobe-webplatform/Snap.svg/raw/master/dist/snap.svg-min.js +* Manual Unminified - https://raw.githubusercontent.com/adobe-webplatform/Snap.svg/master/dist/snap.svg.js + + ### Learn * [About Snap.svg](http://snapsvg.io/about/) From 7259df485a583f9365f525a47c557a4ce7b361b4 Mon Sep 17 00:00:00 2001 From: Alex Normand Date: Wed, 9 Jul 2014 22:35:37 +0200 Subject: [PATCH 2/2] remove attachEvent from addEvent --- src/mouse.js | 89 +++++++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 56 deletions(-) diff --git a/src/mouse.js b/src/mouse.js index 3e4657a..40fd8ae 100644 --- a/src/mouse.js +++ b/src/mouse.js @@ -42,66 +42,43 @@ 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) { - var realName = supportsTouch && touchMap[type] ? touchMap[type] : type, - f = function (e) { - var scrollY = getScroll("y", element), - scrollX = getScroll("x", element); - if (supportsTouch && touchMap[has](type)) { - for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) { - if (e.targetTouches[i].target == obj || obj.contains(e.targetTouches[i].target)) { - var olde = e; - e = e.targetTouches[i]; - e.originalEvent = olde; - e.preventDefault = preventTouch; - e.stopPropagation = stopTouch; - break; - } - } + addEvent = function (obj, type, fn, element) { + var realName = supportsTouch && touchMap[type] ? touchMap[type] : type, + f = function (e) { + var scrollY = getScroll("y", element), + scrollX = getScroll("x", element); + if (supportsTouch && touchMap[has](type)) { + for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) { + if (e.targetTouches[i].target == obj || obj.contains(e.targetTouches[i].target)) { + var olde = e; + e = e.targetTouches[i]; + e.originalEvent = olde; + e.preventDefault = preventTouch; + e.stopPropagation = stopTouch; + break; } - var x = e.clientX + scrollX, - y = e.clientY + scrollY; - return fn.call(element, e, x, y); - }; - - if (type !== realName) { - obj.addEventListener(type, f, false); - } - - obj.addEventListener(realName, f, false); - - return function () { - if (type !== realName) { - obj.removeEventListener(type, f, false); } + } + var x = e.clientX + scrollX, + y = e.clientY + scrollY; + return fn.call(element, e, x, y); + }; - 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; - }; + if (type !== realName) { + obj.addEventListener(type, f, false); } - })(), + + obj.addEventListener(realName, f, false); + + return function () { + if (type !== realName) { + obj.removeEventListener(type, f, false); + } + + obj.removeEventListener(realName, f, false); + return true; + }; + }, drag = [], dragMove = function (e) { var x = e.clientX,