fix triple click
This commit is contained in:
parent
389d33acac
commit
387e282029
1 changed files with 9 additions and 10 deletions
|
|
@ -94,6 +94,7 @@ var MouseHandler = function(editor) {
|
|||
var pageY = event.getDocumentY(e);
|
||||
var pos = this.$getEventPosition(e);
|
||||
var editor = this.editor;
|
||||
var self = this;
|
||||
var selectionRange = editor.getSelectionRange();
|
||||
var selectionEmpty = selectionRange.isEmpty();
|
||||
var state = STATE_UNKNOWN;
|
||||
|
|
@ -122,7 +123,6 @@ var MouseHandler = function(editor) {
|
|||
|
||||
editor.renderer.scrollCursorIntoView();
|
||||
|
||||
var self = this;
|
||||
var mousePageX, mousePageY;
|
||||
var overwrite = editor.getOverwrite();
|
||||
var dragCursor = null;
|
||||
|
|
@ -135,13 +135,12 @@ var MouseHandler = function(editor) {
|
|||
|
||||
var onMouseSelectionEnd = function() {
|
||||
clearInterval(timerId);
|
||||
if (state == STATE_UNKNOWN) {
|
||||
if (state == STATE_UNKNOWN)
|
||||
onStartSelect(pos);
|
||||
} else if (state == STATE_DRAG)
|
||||
else if (state == STATE_DRAG)
|
||||
onMouseDragSelectionEnd();
|
||||
else
|
||||
self.$clickSelection = null;
|
||||
|
||||
|
||||
self.$clickSelection = null;
|
||||
state = STATE_UNKNOWN;
|
||||
};
|
||||
|
||||
|
|
@ -149,7 +148,6 @@ var MouseHandler = function(editor) {
|
|||
dom.removeCssClass(editor.container, "ace_dragging");
|
||||
|
||||
if (!self.$clickSelection) {
|
||||
self.$clickSelection = null;
|
||||
if (!dragCursor) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
|
|
@ -206,9 +204,10 @@ var MouseHandler = function(editor) {
|
|||
if (e.shiftKey)
|
||||
editor.selection.selectToPosition(pos)
|
||||
else {
|
||||
editor.moveCursorToPosition(pos);
|
||||
if (!editor.$clickSelection)
|
||||
if (!self.$clickSelection) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
}
|
||||
state = STATE_SELECT;
|
||||
}
|
||||
|
|
@ -217,7 +216,7 @@ var MouseHandler = function(editor) {
|
|||
var cursor = editor.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1));
|
||||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
editor.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue