fix scroll wheel regression. fixes #430

This commit is contained in:
Fabian Jakobs 2011-09-26 08:45:22 +00:00
commit 1e7efe70e1
2 changed files with 7 additions and 5 deletions

View file

@ -60,7 +60,7 @@ function DefaultHandlers(editor) {
editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(this)); editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(this));
editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(this)); editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(this));
editor.setDefaultHandler("quadclick", this.onQuadClick.bind(this)); editor.setDefaultHandler("quadclick", this.onQuadClick.bind(this));
editor.setDefaultHandler("scroll", this.onScroll.bind(this)); editor.setDefaultHandler("mousewheel", this.onScroll.bind(this));
} }
(function() { (function() {
@ -285,9 +285,9 @@ function DefaultHandlers(editor) {
this.onScroll = function(ev) { this.onScroll = function(ev) {
var editor = this.editor; var editor = this.editor;
editor.renderer.scrollBy(e.wheelX * ev.speed, e.wheelY * speed); editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
if (editor.renderer.isScrollableBy(e.wheelX, e.wheelY)) if (editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed))
return event.preventDefault(e); return ev.preventDefault();
}; };
}).call(DefaultHandlers.prototype); }).call(DefaultHandlers.prototype);

View file

@ -103,8 +103,10 @@ var MouseHandler = function(editor) {
this.onMouseWheel = function(e) { this.onMouseWheel = function(e) {
var mouseEvent = new MouseEvent(e, this.editor); var mouseEvent = new MouseEvent(e, this.editor);
mouseEvent.speed = this.$scrollSpeed * 2; mouseEvent.speed = this.$scrollSpeed * 2;
mouseEvent.wheelX = e.wheelX;
mouseEvent.wheelY = e.wheelY;
this.editor._dispatchEvent("quadclick", mouseEvent); this.editor._dispatchEvent("mousewheel", mouseEvent);
}; };
}).call(MouseHandler.prototype); }).call(MouseHandler.prototype);