Merge pull request #1507 from ajaxorg/scroll_past_end
[WIP] scrollPastEnd
This commit is contained in:
commit
a25a685d11
4 changed files with 38 additions and 3 deletions
|
|
@ -430,6 +430,9 @@ bindCheckbox("fade_fold_widgets", function(checked) {
|
||||||
bindCheckbox("read_only", function(checked) {
|
bindCheckbox("read_only", function(checked) {
|
||||||
env.editor.setReadOnly(checked);
|
env.editor.setReadOnly(checked);
|
||||||
});
|
});
|
||||||
|
bindCheckbox("scrollPastEnd", function(checked) {
|
||||||
|
env.editor.setOption("scrollPastEnd", checked);
|
||||||
|
});
|
||||||
|
|
||||||
bindDropdown("split", function(value) {
|
bindDropdown("split", function(value) {
|
||||||
var sp = env.split;
|
var sp = env.split;
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,14 @@
|
||||||
<input type="checkbox" id="read_only">
|
<input type="checkbox" id="read_only">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td >
|
||||||
|
<label for="scrollPastEnd">Scroll Past End</label>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" id="scrollPastEnd" checked>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="button" value="Edit Snippets" onclick="env.editSnippets()">
|
<input type="button" value="Edit Snippets" onclick="env.editSnippets()">
|
||||||
|
|
|
||||||
|
|
@ -2261,6 +2261,7 @@ config.defineOptions(Editor.prototype, "editor", {
|
||||||
fontFamily: "renderer",
|
fontFamily: "renderer",
|
||||||
maxLines: "renderer",
|
maxLines: "renderer",
|
||||||
minLines: "renderer",
|
minLines: "renderer",
|
||||||
|
scrollPastEnd: "renderer",
|
||||||
|
|
||||||
scrollSpeed: "$mouseHandler",
|
scrollSpeed: "$mouseHandler",
|
||||||
dragDelay: "$mouseHandler",
|
dragDelay: "$mouseHandler",
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,14 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.scrollBarH.setVisible(horizScroll);
|
this.scrollBarH.setVisible(horizScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.$maxLines && this.$scrollPastEnd) {
|
||||||
|
if (this.scrollTop > maxHeight - this.$size.scrollerHeight)
|
||||||
|
maxHeight += Math.min(
|
||||||
|
(this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd,
|
||||||
|
this.scrollTop - maxHeight + this.$size.scrollerHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
|
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
|
||||||
this.$size.scrollerHeight - maxHeight < 0);
|
this.$size.scrollerHeight - maxHeight < 0);
|
||||||
var vScrollChanged = this.$vScroll !== vScroll;
|
var vScrollChanged = this.$vScroll !== vScroll;
|
||||||
|
|
@ -1268,7 +1276,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
|
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
|
||||||
return true;
|
return true;
|
||||||
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
|
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
|
||||||
- this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
|
- this.layerConfig.maxHeight - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
|
||||||
|
< -1 + this.scrollMargin.bottom)
|
||||||
return true;
|
return true;
|
||||||
// todo: better handle horizontal scrolling
|
// todo: better handle horizontal scrolling
|
||||||
if (deltaX)
|
if (deltaX)
|
||||||
|
|
@ -1579,9 +1588,23 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
minLines: {
|
minLines: {
|
||||||
set: function(name) {
|
set: function(val) {
|
||||||
this.updateFull();
|
this.updateFull();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
scrollPastEnd: {
|
||||||
|
set: function(val) {
|
||||||
|
if (val == true)
|
||||||
|
val = 1;
|
||||||
|
else if (val == false)
|
||||||
|
val = 0;
|
||||||
|
if (this.$scrollPastEnd == val)
|
||||||
|
return;
|
||||||
|
this.$scrollPastEnd = val;
|
||||||
|
this.$loop.schedule(this.CHANGE_SCROLL);
|
||||||
|
},
|
||||||
|
initialValue: 1,
|
||||||
|
handlesSet: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue