setDragTimer - configure wait time when dragging
This commit is contained in:
parent
dc32557f23
commit
6124b5576d
3 changed files with 18 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue