allow editors parent nodes to handle mouse wheel when editor is fully scrolled
This commit is contained in:
parent
dae61d79f1
commit
eaa38022e5
2 changed files with 11 additions and 2 deletions
|
|
@ -67,7 +67,7 @@ var MouseHandler = function(editor) {
|
||||||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||||
event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
|
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
@ -304,7 +304,8 @@ var MouseHandler = function(editor) {
|
||||||
var speed = this.$scrollSpeed * 2;
|
var speed = this.$scrollSpeed * 2;
|
||||||
|
|
||||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||||
return event.preventDefault(e);
|
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||||
|
return event.preventDefault(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -712,6 +712,14 @@ var VirtualRenderer = function(container, theme) {
|
||||||
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
|
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isScrollableBy = function(deltaX, deltaY) {
|
||||||
|
if (deltaY < 0 && this.scrollTop > 0)
|
||||||
|
return true;
|
||||||
|
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
|
||||||
|
return true;
|
||||||
|
// todo: handle horizontal scrolling
|
||||||
|
};
|
||||||
|
|
||||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||||
var canvasPos = this.scroller.getBoundingClientRect();
|
var canvasPos = this.scroller.getBoundingClientRect();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue