fix animated scroll in multiselect mode
This commit is contained in:
parent
38c97ee467
commit
ebafdd419d
3 changed files with 11 additions and 5 deletions
|
|
@ -1799,6 +1799,8 @@ var Editor = function(renderer, session) {
|
|||
this.session.unfold({row: lineNumber - 1, column: column || 0});
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
// todo: find a way to automatically exit multiselect mode
|
||||
this.exitMultiSelectMode && this.exitMultiSelectMode()
|
||||
this.moveCursorTo(lineNumber - 1, column || 0);
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -499,9 +499,13 @@ var Editor = require("./editor").Editor;
|
|||
this.inVirtualSelectionMode = false;
|
||||
selection._eventRegistry = reg;
|
||||
selection.mergeOverlappingRanges();
|
||||
|
||||
|
||||
var anim = this.renderer.$scrollAnimation;
|
||||
this.onCursorChange();
|
||||
this.onSelectionChange();
|
||||
if (anim && anim.from == anim.to)
|
||||
this.renderer.animateScrolling(anim.from);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.scrollBar = new ScrollBar(this.container);
|
||||
this.scrollBar.addEventListener("scroll", function(e) {
|
||||
if (!_self.$inScrollAnimation)
|
||||
if (!_self.$scrollAnimation)
|
||||
_self.session.setScrollTop(e.data);
|
||||
});
|
||||
|
||||
|
|
@ -1063,10 +1063,10 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.animateScrolling = function(fromValue, callback) {
|
||||
var toValue = this.scrollTop;
|
||||
if (this.$animatedScroll && Math.abs(fromValue - toValue) < 100000) {
|
||||
if (this.$animatedScroll) {
|
||||
var _self = this;
|
||||
var steps = _self.$calcSteps(fromValue, toValue);
|
||||
this.$inScrollAnimation = true;
|
||||
this.$scrollAnimation = {from: fromValue, to: toValue};
|
||||
|
||||
clearInterval(this.$timer);
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
} else {
|
||||
// do this on separate step to not get spurious scroll event from scrollbar
|
||||
_self.$timer = clearInterval(_self.$timer);
|
||||
_self.$inScrollAnimation = false;
|
||||
_self.$scrollAnimation = null;
|
||||
callback && callback();
|
||||
}
|
||||
}, 10);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue