Merge pull request #1705 from ajaxorg/autocomplete/hor_scroll
fix #1680 Autocomplete box doesn't work with horizontal scrolling
This commit is contained in:
commit
91d581b12b
2 changed files with 10 additions and 3 deletions
|
|
@ -69,6 +69,7 @@ var Autocomplete = function() {
|
|||
|
||||
var renderer = editor.renderer;
|
||||
if (!keepPopupPosition) {
|
||||
this.popup.setRow(0);
|
||||
this.popup.setFontSize(editor.getFontSize());
|
||||
|
||||
var lineHeight = renderer.layerConfig.lineHeight;
|
||||
|
|
@ -78,7 +79,7 @@ var Autocomplete = function() {
|
|||
|
||||
var rect = editor.container.getBoundingClientRect();
|
||||
pos.top += rect.top - renderer.layerConfig.offset;
|
||||
pos.left += rect.left;
|
||||
pos.left += rect.left - editor.renderer.scrollLeft;
|
||||
pos.left += renderer.$gutterLayer.gutterWidth;
|
||||
|
||||
this.popup.show(pos, lineHeight);
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ var AcePopup = function(parentNode) {
|
|||
popup.show = function(pos, lineHeight, topdownOnly) {
|
||||
var el = this.container;
|
||||
var screenHeight = window.innerHeight;
|
||||
var screenWidth = window.innerWidth;
|
||||
var renderer = this.renderer;
|
||||
// var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
|
||||
var maxH = renderer.$maxLines * lineHeight * 1.4;
|
||||
|
|
@ -265,10 +266,15 @@ var AcePopup = function(parentNode) {
|
|||
popup.isTopdown = true;
|
||||
}
|
||||
|
||||
el.style.left = pos.left + "px";
|
||||
el.style.display = "";
|
||||
this.renderer.$textLayer.checkForSizeChanges();
|
||||
|
||||
|
||||
var left = pos.left;
|
||||
if (left + el.offsetWidth > screenWidth)
|
||||
left = screenWidth - el.offsetWidth;
|
||||
|
||||
el.style.left = left + "px";
|
||||
|
||||
this._signal("show");
|
||||
lastMouseEvent = null;
|
||||
popup.isOpen = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue