fix contextmenu for editor with border

This commit is contained in:
nightwing 2013-02-18 21:52:35 +04:00
commit 1a9686c6b7

View file

@ -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);