Merge pull request +7244 from c9/fix/tree-pagedown

fix +7206 pressing pagedown screws up the layout of ace trees
pull/85/head^2
Harutyun Amirjanyan 2015-05-10 19:28:15 +04:00
commit bacef4fd52
3 zmienionych plików z 40 dodań i 26 usunięć

Wyświetl plik

@ -839,31 +839,45 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
this.animateScrolling = function(fromValue, callback) {
var toValue = this.scrollTop;
if (this.$animatedScroll && Math.abs(fromValue - toValue) < 100000) {
var _self = this;
var steps = _self.$calcSteps(fromValue, toValue);
this.$inScrollAnimation = true;
clearInterval(this.$timer);
_self.provider.setScrollTop(steps.shift());
this.$timer = setInterval(function() {
if (steps.length) {
_self.setScrollTop(steps.shift());
// trick provider to think it's already scrolled to not loose toValue
_self.scrollTop = toValue;
} else if (toValue != null) {
_self.scrollTop = -1;
_self.setScrollTop(toValue);
toValue = null;
} else {
// do this on separate step to not get spurious scroll event from scrollbar
_self.$timer = clearInterval(_self.$timer);
_self.$inScrollAnimation = false;
callback && callback();
}
}, 10);
if (!this.$animatedScroll)
return;
var _self = this;
if (fromValue == toValue)
return;
if (this.$scrollAnimation) {
var oldSteps = this.$scrollAnimation.steps;
if (oldSteps.length) {
fromValue = oldSteps[0];
if (fromValue == toValue)
return;
}
}
var steps = _self.$calcSteps(fromValue, toValue);
this.$scrollAnimation = {from: fromValue, to: toValue, steps: steps};
clearInterval(this.$timer);
_self.provider.setScrollTop(steps.shift());
// trick provider to think it's already scrolled to not loose toValue
_self.provider.$scrollTop = toValue;
this.$timer = setInterval(function() {
if (steps.length) {
_self.provider.setScrollTop(steps.shift());
_self.provider.$scrollTop = toValue;
} else if (toValue != null) {
_self.provider.$scrollTop = -1;
_self.provider.setScrollTop(toValue);
toValue = null;
} else {
// do this on separate step to not get spurious scroll event from scrollbar
_self.$timer = clearInterval(_self.$timer);
_self.$scrollAnimation = null;
callback && callback();
}
}, 10);
};
/**

Wyświetl plik

@ -92,7 +92,7 @@
"c9.ide.immediate": "#6845a93705",
"c9.ide.installer": "#19b25fc787",
"c9.ide.mount": "#896ebf836e",
"c9.ide.navigate": "#64156c7f4a",
"c9.ide.navigate": "#7c58c7f3d7",
"c9.ide.newresource": "#f1f0624768",
"c9.ide.openfiles": "#28a4f5af16",
"c9.ide.preview": "#0bd8dd6e8c",

Wyświetl plik

@ -245,7 +245,7 @@ define(function(require, exports, module) {
function setDefault(name, keys) {
var command = commands[name];
if (!command) return;
// If bind key is not yet overridden by a custom one
if (plugin.commandManager[name] == command.bindKey[platform])
bindKey(keys[platform], command);