Skip to content

Zoom function not working in FireFox #30

@ErikOlesen

Description

@ErikOlesen

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions