fix #1680 Autocomplete box doesn't work with horizontal scrolling
This commit is contained in:
parent
29e1838394
commit
af7c370318
2 changed files with 9 additions and 3 deletions
|
|
@ -78,7 +78,7 @@ var Autocomplete = function() {
|
||||||
|
|
||||||
var rect = editor.container.getBoundingClientRect();
|
var rect = editor.container.getBoundingClientRect();
|
||||||
pos.top += rect.top - renderer.layerConfig.offset;
|
pos.top += rect.top - renderer.layerConfig.offset;
|
||||||
pos.left += rect.left;
|
pos.left += rect.left - editor.renderer.scrollLeft;
|
||||||
pos.left += renderer.$gutterLayer.gutterWidth;
|
pos.left += renderer.$gutterLayer.gutterWidth;
|
||||||
|
|
||||||
this.popup.show(pos, lineHeight);
|
this.popup.show(pos, lineHeight);
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,7 @@ var AcePopup = function(parentNode) {
|
||||||
popup.show = function(pos, lineHeight, topdownOnly) {
|
popup.show = function(pos, lineHeight, topdownOnly) {
|
||||||
var el = this.container;
|
var el = this.container;
|
||||||
var screenHeight = window.innerHeight;
|
var screenHeight = window.innerHeight;
|
||||||
|
var screenWidth = window.innerWidth;
|
||||||
var renderer = this.renderer;
|
var renderer = this.renderer;
|
||||||
// var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
|
// var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
|
||||||
var maxH = renderer.$maxLines * lineHeight * 1.4;
|
var maxH = renderer.$maxLines * lineHeight * 1.4;
|
||||||
|
|
@ -265,10 +266,15 @@ var AcePopup = function(parentNode) {
|
||||||
popup.isTopdown = true;
|
popup.isTopdown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
el.style.left = pos.left + "px";
|
|
||||||
el.style.display = "";
|
el.style.display = "";
|
||||||
this.renderer.$textLayer.checkForSizeChanges();
|
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");
|
this._signal("show");
|
||||||
lastMouseEvent = null;
|
lastMouseEvent = null;
|
||||||
popup.isOpen = true;
|
popup.isOpen = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue