diff options
author | Cheng-Han, Wu | 2016-06-04 10:49:53 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-06-04 10:49:53 +0800 |
commit | 85e00cb2ef4ee96b8f9a8c8b58e89292c6eb56d2 (patch) | |
tree | 06f7e3ded33db3c3e4886b06bef9884b22e6109a | |
parent | 43ad625b82f02f3352349eb6e3447a3048af6ed2 (diff) |
Remove doc top offset workaround for checkCursorTag and checkCursorMenu which cause cursors floating around
Diffstat (limited to '')
-rw-r--r-- | public/js/index.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/public/js/index.js b/public/js/index.js index dad51922..791f5333 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2279,8 +2279,6 @@ function checkCursorTag(coord, ele) { // get coord position var left = coord.left; var top = coord.top; - // get doc top offset (to workaround with viewport) - var docTopOffset = ui.area.codemirrorSizerInner.position().top; // set offset var offsetLeft = -3; var offsetTop = defaultTextHeight; @@ -2292,7 +2290,7 @@ function checkCursorTag(coord, ele) { } // flip y when element bottom bound larger than doc height // and element top position is larger than element height - if (top + docTopOffset + height + offsetTop + tagBottomMargin > Math.max(editor.doc.height, editorHeight) && top + docTopOffset > height + tagBottomMargin) { + if (top + height + offsetTop + tagBottomMargin > Math.max(editor.doc.height, editorHeight) && top > height + tagBottomMargin) { offsetTop = -(height); } } @@ -2877,8 +2875,6 @@ function checkCursorMenuInner() { }, 'windows'); var left = coord.left; var top = coord.top; - // get doc top offset (to workaround with viewport) - var docTopOffset = ui.area.codemirrorSizerInner.position().top; // set offset var offsetLeft = 0; var offsetTop = defaultTextHeight; @@ -2889,7 +2885,7 @@ function checkCursorMenuInner() { offsetLeft = -(left + width - docWidth + menuRightMargin); // flip y when element bottom bound larger than doc height // and element top position is larger than element height - if (top + docTopOffset + height + offsetTop + menuBottomMargin > Math.max(editor.doc.height, editorHeight) && top + docTopOffset > height + menuBottomMargin) { + if (top + height + offsetTop + menuBottomMargin > Math.max(editor.doc.height, editorHeight) && top > height + menuBottomMargin) { offsetTop = -(height + menuBottomMargin); // reverse sort menu because upSideDown dropdown.html(reverseSortCursorMenu(dropdown)); |