Scrolling does not jerk to a stop when scrolling w/ a trackpad

When scrolling with a trackpad, webkit repeatedly triggers multiple mousewheel events on the original event's target element to simulate the velocity effect we're accustomed to with touchscreen UIs. When scrolling quickly, this clashed with our strategy of removing off-screen lines, because the element was removed before the velocity were done firing.

The solution is to make the overlayer accept mouse events. It lays on top of all the lines, so it is never removed and therefore allows the mousewheel events to run to completion. But, this means we need to transfer mousedown events from the overlayer to the underlying lines.
This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-28 12:25:14 -07:00
parent 94220d95a7
commit 1aa8f26e94
2 changed files with 8 additions and 1 deletions

View File

@@ -310,6 +310,14 @@ class Editor extends View
@isFocused = false
@removeClass 'focused'
@overlayer.on 'mousedown', (e) =>
@overlayer.hide()
clickedElement = document.elementFromPoint(e.pageX, e.pageY)
@overlayer.show()
e.target = clickedElement
$(clickedElement).trigger(e)
false
@renderedLines.on 'mousedown', '.fold.line', (e) =>
@destroyFold($(e.currentTarget).attr('fold-id'))
false

View File

@@ -92,7 +92,6 @@
.editor .overlayer {
z-index: 2;
pointer-events: none;
position: absolute;
}