remove setTimeout from startSelect

fixes #956: double tap regression
This commit is contained in:
nightwing 2013-12-20 17:17:00 +04:00
commit c01725184e

View file

@ -110,15 +110,13 @@ function DefaultHandlers(mouseHandler) {
var editor = this.editor; var editor = this.editor;
// allow double/triple click handlers to change selection // allow double/triple click handlers to change selection
var shiftPressed = this.mousedownEvent.getShiftKey(); var shiftPressed = this.mousedownEvent.getShiftKey();
setTimeout(function(){ if (shiftPressed) {
if (shiftPressed) { editor.selection.selectToPosition(pos);
editor.selection.selectToPosition(pos); }
} else if (!this.$clickSelection) {
else if (!this.$clickSelection) { editor.moveCursorToPosition(pos);
editor.moveCursorToPosition(pos); editor.selection.clearSelection();
editor.selection.clearSelection(); }
}
}.bind(this), 0);
if (editor.renderer.scroller.setCapture) { if (editor.renderer.scroller.setCapture) {
editor.renderer.scroller.setCapture(); editor.renderer.scroller.setCapture();
} }
@ -210,13 +208,13 @@ function DefaultHandlers(mouseHandler) {
range.start.column--; range.start.column--;
range.end.column++; range.end.column++;
} }
this.$clickSelection = range;
this.setState("select"); this.setState("select");
return; } else {
range = editor.selection.getWordRange(pos.row, pos.column);
this.setState("selectByWords");
} }
this.$clickSelection = range;
this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column); this[this.state] && this[this.state](ev);
this.setState("selectByWords");
}; };
this.onTripleClick = function(ev) { this.onTripleClick = function(ev) {
@ -225,6 +223,7 @@ function DefaultHandlers(mouseHandler) {
this.setState("selectByLines"); this.setState("selectByLines");
this.$clickSelection = editor.selection.getLineRange(pos.row); this.$clickSelection = editor.selection.getLineRange(pos.row);
this[this.state] && this[this.state](ev);
}; };
this.onQuadClick = function(ev) { this.onQuadClick = function(ev) {