Merge pull request #277 from nightwing/cursor

when unfocused make cursor transparent instead of removing it
This commit is contained in:
Fabian Jakobs 2011-05-30 23:46:41 -07:00
commit acd7e92351
2 changed files with 10 additions and 9 deletions

View file

@ -117,6 +117,10 @@
position: absolute;
}
.ace_cursor.ace_hidden {
opacity: 0.2;
}
.ace_line {
white-space: nowrap;
}

View file

@ -47,7 +47,8 @@ var Cursor = function(parentEl) {
parentEl.appendChild(this.element);
this.cursor = dom.createElement("div");
this.cursor.className = "ace_cursor";
this.cursor.className = "ace_cursor ace_hidden";
this.element.appendChild(this.cursor);
this.isVisible = false;
};
@ -60,18 +61,14 @@ var Cursor = function(parentEl) {
this.hideCursor = function() {
this.isVisible = false;
if (this.cursor.parentNode) {
this.cursor.parentNode.removeChild(this.cursor);
}
dom.addCssClass(this.cursor, "ace_hidden");
clearInterval(this.blinkId);
};
this.showCursor = function() {
this.isVisible = true;
this.element.appendChild(this.cursor);
var cursor = this.cursor;
cursor.style.visibility = "visible";
this.isVisible = true;
dom.removeCssClass(this.cursor, "ace_hidden");
this.cursor.style.visibility = "visible";
this.restartTimer();
};