Listen for mouse events on scrollView instead of renderedLines

It was not possible to click on the lower part of the last line
when the editor was scrollable and listening for mousedown events on renderedLines.

Closes #464
This commit is contained in:
Corey Johnson
2013-04-29 14:59:13 -07:00
parent 8e218de3e7
commit fdae5fd89c
2 changed files with 87 additions and 84 deletions

View File

@@ -835,13 +835,12 @@ class Editor extends View
$(clickedElement).trigger(e)
false if @isFocused
@renderedLines.on 'mousedown', '.fold.line', (e) =>
@scrollView.on 'mousedown', '.fold.line', (e) =>
@destroyFold($(e.currentTarget).attr('fold-id'))
false
onMouseDown = (e) =>
@scrollView.on 'mousedown', (e) =>
clickCount = e.originalEvent.detail
screenPosition = @screenPositionFromMouseEvent(e)
if clickCount == 1
if e.metaKey
@@ -857,8 +856,6 @@ class Editor extends View
@selectOnMousemoveUntilMouseup() unless e.ctrlKey or e.originalEvent.which > 1
@renderedLines.on 'mousedown', onMouseDown
@on "textInput", (e) =>
@insertText(e.originalEvent.data)
false