diff --git a/lib/ace/editor.js b/lib/ace/editor.js index bb4c68b6..dd290b13 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -551,6 +551,14 @@ var Editor = function(renderer, session) { return this.$mouseHandler.getScrollSpeed(); }; + this.setDragTimer = function(dragTimer) { + this.$mouseHandler.setDragTimer(dragTimer); + }; + + this.getDragTimer = function() { + return this.$mouseHandler.getDragTimer(); + }; + this.$selectionStyle = "line"; this.setSelectionStyle = function(style) { if (this.$selectionStyle == style) return; diff --git a/lib/ace/mouse/default_handlers.js b/lib/ace/mouse/default_handlers.js index 87708356..9b0083de 100644 --- a/lib/ace/mouse/default_handlers.js +++ b/lib/ace/mouse/default_handlers.js @@ -48,7 +48,6 @@ var STATE_UNKNOWN = 0; var STATE_SELECT = 1; var STATE_DRAG = 2; -var DRAG_TIMER = 250; // milliseconds var DRAG_OFFSET = 5; // pixels function DefaultHandlers(editor) { @@ -182,7 +181,7 @@ function DefaultHandlers(editor) { cursor.row = Math.max(0, Math.min(cursor.row, editor.session.getLength()-1)); onStartSelect(cursor); } - else if ((time - mousedownTime) > DRAG_TIMER) { + else if ((time - mousedownTime) > editor.getDragTimer()) { state = STATE_DRAG; dragRange = editor.getSelectionRange(); var style = editor.getSelectionStyle(); diff --git a/lib/ace/mouse/mouse_handler.js b/lib/ace/mouse/mouse_handler.js index 18ad462a..698576f9 100644 --- a/lib/ace/mouse/mouse_handler.js +++ b/lib/ace/mouse/mouse_handler.js @@ -76,6 +76,15 @@ var MouseHandler = function(editor) { return this.$scrollSpeed; }; + this.$dragTimer = 250; + this.setDragTimer = function(dragTimer) { + this.$dragTimer=dragTimer; + }; + + this.getDragTimer = function() { + return this.$dragTimer; + }; + this.onMouseDown = function(e) { this.editor._dispatchEvent("mousedown", new MouseEvent(e, this.editor)); };