-
Notifications
You must be signed in to change notification settings - Fork 74
Zoom function not working in FireFox #30
Description
Since the Seen.MouseEvents.prototype.attach and Seen.MouseEvents.prototype.detach functions use the mousewheel EventListener, which is non-standard and not supported by FF, this functionality is broken. This can however easily be fixed by adding an additional EventListener for the new standard wheel event within the MouseEvents.prototype.
The syntax of the wheel event is a bit different then that of the mousewheel event though, so I would suggest editing the Seen.Zoom.prototype._onMouseWheel function as follows:
Seen.Zoom.prototype._onMouseWheel = function(e) {
var delta, sign, zoom, zoomFactor;
zoom = 1;
if(e.wheelDelta){
e.preventDefault();
delta = e.wheelDelta;
} else if(e.deltaY){
e.preventDefault();
delta = -e.deltaY;
}
if(delta && delta != 0){
sign = delta / Math.abs(delta);
zoomFactor = Math.abs(delta) / 120 * this.speed;
zoom = Math.pow(2, sign * zoomFactor);
}
return this.dispatch.zoom({
zoom: zoom
});
};
Kind regards and thank you for an awesome library :)