add demo/autoresize.html
This commit is contained in:
parent
0479acfea7
commit
78585a9c5d
3 changed files with 67 additions and 3 deletions
|
|
@ -2259,6 +2259,8 @@ config.defineOptions(Editor.prototype, "editor", {
|
|||
displayIndentGuides: "renderer",
|
||||
fontSize: "renderer",
|
||||
fontFamily: "renderer",
|
||||
maxLines: "renderer",
|
||||
minLines: "renderer",
|
||||
|
||||
scrollSpeed: "$mouseHandler",
|
||||
dragDelay: "$mouseHandler",
|
||||
|
|
|
|||
|
|
@ -808,7 +808,10 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$autosize = function(height, width) {
|
||||
var height = this.session.getScreenLength() * this.lineHeight;
|
||||
var maxHeight = this.$maxLines * this.lineHeight;
|
||||
var desiredHeight = Math.max(this.lineHeight, Math.min(maxHeight, height));
|
||||
var desiredHeight = Math.max(
|
||||
(this.$minLines||1) * this.lineHeight,
|
||||
Math.min(maxHeight, height)
|
||||
);
|
||||
var vScroll = height > maxHeight;
|
||||
|
||||
if (desiredHeight != this.desiredHeight ||
|
||||
|
|
@ -817,9 +820,10 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$vScroll = vScroll;
|
||||
this.scrollBarV.setVisible(vScroll);
|
||||
}
|
||||
|
||||
|
||||
var w = this.container.clientWidth;
|
||||
this.container.style.height = desiredHeight + "px";
|
||||
this.$updateCachedSize(true, this.$gutterWidth, this.$size.width, desiredHeight);
|
||||
this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight);
|
||||
// this.$loop.changes = 0;
|
||||
this.desiredHeight = desiredHeight;
|
||||
}
|
||||
|
|
@ -1557,6 +1561,16 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
|
|||
this.container.style.fontFamily = name;
|
||||
this.updateFontSize();
|
||||
}
|
||||
},
|
||||
maxLines: {
|
||||
set: function(val) {
|
||||
this.updateFull();
|
||||
}
|
||||
},
|
||||
minLines: {
|
||||
set: function(name) {
|
||||
this.updateFull();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue