From 431fc725ff1fb15d3e77102dce9af2dfe76244e6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 30 Jun 2014 16:18:05 +0100 Subject: [PATCH] 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. --- src/editor-component.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index f7a7dfef7..8e1efdd3e 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -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: ->