Merge pull request #744 from ajaxorg/mouse-refactor

Mouse refactor
This commit is contained in:
Fabian Jakobs 2012-05-01 13:06:44 -07:00
commit 4c87594521
13 changed files with 423 additions and 313 deletions

View file

@ -80,6 +80,7 @@ var Editor = function(renderer, session) {
this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
this.renderer.textarea = this.textInput.getElement();
this.keyBinding = new KeyBinding(this);
// TODO detect touch event support
@ -385,11 +386,7 @@ var Editor = function(renderer, session) {
this.$cursorChange = function() {
this.renderer.updateCursor();
// move text input over the cursor
// this is required for iOS and IME
this.renderer.moveTextAreaToCursor(this.textInput.getElement());
}
};
/**
* Editor@onDocumentChange(e)
@ -458,7 +455,6 @@ var Editor = function(renderer, session) {
this.$highlightBrackets();
this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
};
/** internal, hide
@ -490,21 +486,6 @@ var Editor = function(renderer, session) {
}
};
/** internal, hide
* Editor.$updateHighlightGutterLine()
*
*
**/
this.$updateHighlightGutterLine = function(){
if (typeof this.$lastrow == "number")
this.renderer.removeGutterDecoration(this.$lastrow, "ace_gutter_active_line");
this.$lastrow = null;
if (this.$highlightGutterLine)
this.renderer.addGutterDecoration(
this.$lastrow = this.getCursorPosition().row, "ace_gutter_active_line");
}
/**
* Editor@onSelectionChange(e)
@ -526,7 +507,6 @@ var Editor = function(renderer, session) {
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
} else {
this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
}
if (this.$highlightSelectedWord)
@ -605,7 +585,6 @@ var Editor = function(renderer, session) {
// Update the active line marker as due to folding changes the current
// line range on the screen might have changed.
this.$updateHighlightActiveLine();
this.$updateHighlightGutterLine();
// TODO: This might be too much updating. Okay for now.
this.renderer.updateFull();
};
@ -891,12 +870,11 @@ var Editor = function(renderer, session) {
};
this.$highlightGutterLine = true;
this.setHighlightGutterLine = function(shouldHighlightGutterLine) {
if (this.$highlightGutterLine == shouldHighlightGutterLine)
this.setHighlightGutterLine = function(shouldHighlight) {
if (this.$highlightGutterLine == shouldHighlight)
return;
this.$highlightGutterLine = shouldHighlightGutterLine;
this.$updateHighlightGutterLine();
this.renderer.setHighlightGutterLine(shouldHighlight);
};
this.getHighlightGutterLine = function() {