Merge branch 'feature/shadowgutter'
Conflicts: build/kitchen-sink.html build/src/ace-noconflict.js build/src/ace.js lib/ace/virtual_renderer.js
This commit is contained in:
commit
770ab82cbf
190 changed files with 1202 additions and 544 deletions
|
|
@ -1,6 +1,5 @@
|
|||
@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);
|
||||
|
||||
|
||||
.ace_editor {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
|
|
@ -29,12 +28,31 @@
|
|||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_corner{
|
||||
position : absolute;
|
||||
left : 41px;
|
||||
top : -5px;
|
||||
border-radius : 6px 0 0 0;
|
||||
border-color : #e8e8e8;
|
||||
border-width : 1px 0 0 1px;
|
||||
border-style : solid;
|
||||
box-shadow : 4px 4px 0px #e8e8e8 inset;
|
||||
width : 10px;
|
||||
height : 10px;
|
||||
z-index : 10000;
|
||||
}
|
||||
|
||||
.ace_gutter {
|
||||
position: absolute;
|
||||
overflow : hidden;
|
||||
height: 100%;
|
||||
width: auto;
|
||||
cursor: default;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.ace_gutter.horscroll {
|
||||
box-shadow: 0px 0px 20px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.ace_gutter-cell {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,10 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$gutter = dom.createElement("div");
|
||||
this.$gutter.className = "ace_gutter";
|
||||
this.container.appendChild(this.$gutter);
|
||||
|
||||
this.$corner = dom.createElement("div");
|
||||
this.$corner.className = "ace_corner";
|
||||
this.container.appendChild(this.$corner);
|
||||
|
||||
this.scroller = dom.createElement("div");
|
||||
this.scroller.className = "ace_scroller";
|
||||
|
|
@ -117,6 +121,13 @@ var VirtualRenderer = function(container, theme) {
|
|||
var scrollLeft = _self.scroller.scrollLeft;
|
||||
_self.scrollLeft = scrollLeft;
|
||||
_self.session.setScrollLeft(scrollLeft);
|
||||
|
||||
if (scrollLeft == 0) {
|
||||
_self.$gutter.className = "ace_gutter";
|
||||
}
|
||||
else {
|
||||
_self.$gutter.className = "ace_gutter horscroll";
|
||||
}
|
||||
});
|
||||
|
||||
this.cursorPos = {
|
||||
|
|
@ -714,23 +725,24 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.session.setScrollTop(row * this.lineHeight);
|
||||
};
|
||||
|
||||
var STEPS = 10;
|
||||
function calcSteps(fromValue, toValue){
|
||||
var i = 0,
|
||||
l = STEPS,
|
||||
steps = [],
|
||||
func = function(t, x_min, dx) {
|
||||
if ((t /= .5) < 1)
|
||||
return dx / 2 * Math.pow(t, 3) + x_min;
|
||||
return dx / 2 * (Math.pow(t - 2, 3) + 2) + x_min;
|
||||
};
|
||||
this.STEPS = 10;
|
||||
this.$calcSteps = function(fromValue, toValue){
|
||||
var i = 0;
|
||||
var l = STEPS;
|
||||
var steps = [];
|
||||
|
||||
var func = function(t, x_min, dx) {
|
||||
if ((t /= .5) < 1)
|
||||
return dx / 2 * Math.pow(t, 3) + x_min;
|
||||
return dx / 2 * (Math.pow(t - 2, 3) + 2) + x_min;
|
||||
};
|
||||
|
||||
for (i = 0; i < l; ++i)
|
||||
steps.push(func(i / STEPS, fromValue, toValue - fromValue));
|
||||
steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
|
||||
steps.push(toValue);
|
||||
|
||||
return steps;
|
||||
}
|
||||
};
|
||||
|
||||
this.scrollToLine = function(line, center) {
|
||||
var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
|
||||
|
|
@ -739,15 +751,17 @@ var VirtualRenderer = function(container, theme) {
|
|||
offset -= this.$size.scrollerHeight / 2;
|
||||
|
||||
if (this.$animatedScroll && Math.abs(offset - this.scrollTop) < 10000) {
|
||||
var i = 0, _self = this,
|
||||
steps = calcSteps(this.scrollTop, offset);
|
||||
clearInterval(_self.$timer);
|
||||
this.$timer = setInterval(function(){
|
||||
_self.session.setScrollTop(steps[i]);
|
||||
var i = 0;
|
||||
var _self = this;
|
||||
var steps = _self.$calcSteps(this.scrollTop, offset);
|
||||
|
||||
if (++i == STEPS + 1)
|
||||
clearInterval(_self.$timer);
|
||||
}, 10);
|
||||
clearInterval(_self.$timer);
|
||||
this.$timer = setInterval(function() {
|
||||
_self.session.setScrollTop(steps[i]);
|
||||
|
||||
if (++i == STEPS + 1)
|
||||
clearInterval(_self.$timer);
|
||||
}, 10);
|
||||
}
|
||||
else {
|
||||
this.session.setScrollTop(offset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue