fix popup position flipping

This commit is contained in:
nightwing 2013-09-14 14:53:51 +04:00
commit 4d8a31fd54

View file

@ -206,9 +206,12 @@ var AcePopup = function(parentNode) {
};
popup.show = function(pos, lineHeight) {
var el = this.container;
if (pos.top > window.innerHeight / 2 + lineHeight) {
var screenHeight = window.innerHeight;
var renderer = this.renderer;
var maxH = renderer.$maxLines * lineHeight;
if (pos.top +maxH > screenHeight - lineHeight) {
el.style.top = "";
el.style.bottom = window.innerHeight - pos.top + "px";
el.style.bottom = screenHeight - pos.top + "px";
} else {
pos.top += lineHeight;
el.style.top = pos.top + "px";