Interpret editor clicks relative to lines div, not the scrollView div

Fixes #2668

If the scroll view has padding, using it as the basis for locating
clicks relative to the lines is problematic.
This commit is contained in:
Nathan Sobo
2014-06-30 16:18:05 +01:00
parent f5517bad66
commit 431fc725ff

View File

@@ -881,9 +881,9 @@ EditorComponent = React.createClass
{editor} = @props
{clientX, clientY} = event
scrollViewClientRect = @refs.scrollView.getDOMNode().getBoundingClientRect()
top = clientY - scrollViewClientRect.top + editor.getScrollTop()
left = clientX - scrollViewClientRect.left + editor.getScrollLeft()
linesClientRect = @refs.lines.getDOMNode().getBoundingClientRect()
top = clientY - linesClientRect.top
left = clientX - linesClientRect.left
{top, left}
getModel: ->