• Touch events support
• rgba support
• new method drag
• document.onmousemove = f → Raphael.mousemove(f)
• resetScale method
• scaling text will change it position, but not size
• sets now have type “set”
• rect in VML doesn’t recreate itself on change of the R
• pathes are not rounded to the nearby pixels anymore
• Various small bug fixes and improvements
• added preventDefault and stopPropagation to event object
- var addEvent = (function () {
+ var preventDefault = function () {
+ this.returnValue = false;
+ },
+ stopPropagation = function () {
+ this.cancelBubble = true;
+ },
+ addEvent = (function () {
if (doc.addEventListener) {
return function (obj, type, fn, element) {
var f = function (e) {
if (doc.addEventListener) {
return function (obj, type, fn, element) {
var f = function (e) {
} else if (doc.attachEvent) {
return function (obj, type, fn, element) {
var f = function (e) {
} else if (doc.attachEvent) {
return function (obj, type, fn, element) {
var f = function (e) {
- return fn.call(element, e || win.event);
+ e = e || win.event;
+ e.preventDefault = e.preventDefault || preventDefault;
+ e.stopPropagation = e.stopPropagation || stopPropagation;
+ return fn.call(element, e);
};
obj.attachEvent("on" + type, f);
var detacher = function () {
};
obj.attachEvent("on" + type, f);
var detacher = function () {
Element[proto].drag = function (onmove, onstart, onend) {
this._drag = {};
var el = this.mousedown(function (e) {
Element[proto].drag = function (onmove, onstart, onend) {
this._drag = {};
var el = this.mousedown(function (e) {
this._drag.x = e.clientX;
this._drag.y = e.clientY;
this._drag.id = e.identifier;
this._drag.x = e.clientX;
this._drag.y = e.clientY;
this._drag.id = e.identifier;
Raphael.mousemove(move).mouseup(up);
}),
move = function (e) {
Raphael.mousemove(move).mouseup(up);
}),
move = function (e) {
+ var x = e.clientX,
+ y = e.clientY;
- for (var i = 0, ii = e.touches.length; i < ii; i++) {
- var touch = e.touches[i];
+ var i = e.touches.length,
+ touch;
+ while (i--) {
+ touch = e.touches[i];
if (touch.identifier == el._drag.id) {
if (touch.identifier == el._drag.id) {
- onmove && onmove.call(el, touch.clientX - el._drag.x, touch.clientY - el._drag.y, touch.clientX, touch.clientY);
+ x = touch.clientX;
+ y = touch.clientY;
e.preventDefault();
break;
}
}
} else {
e.preventDefault();
break;
}
}
} else {
- onmove && onmove.call(el, e.clientX - el._drag.x, e.clientY - el._drag.y, e.clientX, e.clientY);
- e.preventDefault && e.preventDefault();
- e.returnValue = false;
- return false;
+ onmove && onmove.call(el, x - el._drag.x, y - el._drag.y, x, y);
},
up = function () {
el._drag = {};
},
up = function () {
el._drag = {};