From 1a9686c6b77f9c52c861e262bc3d7d86adbdaf5d Mon Sep 17 00:00:00 2001 From: nightwing Date: Mon, 18 Feb 2013 21:52:35 +0400 Subject: [PATCH] fix contextmenu for editor with border --- lib/ace/keyboard/textinput.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index e4def8b1..397a0917 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -374,9 +374,12 @@ var TextInput = function(parentNode, host) { resetSelection(host.selection.isEmpty()); host._emit("nativecontextmenu", {target: host}); var rect = host.container.getBoundingClientRect(); + var style = dom.computedStyle(host.container); + var top = rect.top + (parseInt(style.borderTopWidth) || 0); + var left = rect.left + (parseInt(rect.borderLeftWidth) || 0); var move = function(e) { - text.style.left = e.clientX - rect.left - 2 + "px"; - text.style.top = e.clientY - rect.top - 2 + "px"; + text.style.left = e.clientX - left - 2 + "px"; + text.style.top = e.clientY - top - 2 + "px"; }; move(e);