This commit is contained in:
nightwing 2013-12-20 15:14:35 +04:00
commit 15dd2082f6
2 changed files with 7 additions and 7 deletions

View file

@ -86,7 +86,7 @@ function DefaultHandlers(mouseHandler) {
if (inSelection && !editor.isFocused()) { if (inSelection && !editor.isFocused()) {
editor.focus(); editor.focus();
if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) { if (this.$focusTimout && !this.$clickSelection && !editor.inMultiSelectMode) {
this.mousedownEvent.time = (new Date()).getTime(); this.mousedownEvent.time = Date.now();
this.setState("focusWait"); this.setState("focusWait");
this.captureMouse(ev); this.captureMouse(ev);
return; return;
@ -98,7 +98,7 @@ function DefaultHandlers(mouseHandler) {
// a selection. // a selection.
this.startSelect(pos); this.startSelect(pos);
} else if (inSelection) { } else if (inSelection) {
this.mousedownEvent.time = (new Date()).getTime(); this.mousedownEvent.time = Date.now();
this.startSelect(pos); this.startSelect(pos);
} }
this.captureMouse(ev); this.captureMouse(ev);
@ -193,7 +193,7 @@ function DefaultHandlers(mouseHandler) {
this.focusWait = function() { this.focusWait = function() {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
var time = (new Date()).getTime(); var time = Date.now();
if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout) if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimout)
this.startSelect(this.mousedownEvent.getDocumentPosition()); this.startSelect(this.mousedownEvent.getDocumentPosition());

View file

@ -193,7 +193,7 @@ function DragdropHandler(mouseHandler) {
event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler)); event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler));
function scrollCursorIntoView(cursor, prevCursor) { function scrollCursorIntoView(cursor, prevCursor) {
var now = new Date().getTime(); var now = Date.now();
var vMovement = !prevCursor || cursor.row != prevCursor.row; var vMovement = !prevCursor || cursor.row != prevCursor.row;
var hMovement = !prevCursor || cursor.column != prevCursor.column; var hMovement = !prevCursor || cursor.column != prevCursor.column;
if (!cursorMovedTime || vMovement || hMovement) { if (!cursorMovedTime || vMovement || hMovement) {
@ -214,7 +214,7 @@ function DragdropHandler(mouseHandler) {
} }
function autoScroll(cursor, prevCursor) { function autoScroll(cursor, prevCursor) {
var now = new Date().getTime(); var now = Date.now();
var lineHeight = editor.renderer.layerConfig.lineHeight; var lineHeight = editor.renderer.layerConfig.lineHeight;
var characterWidth = editor.renderer.layerConfig.characterWidth; var characterWidth = editor.renderer.layerConfig.characterWidth;
var editorRect = editor.renderer.scroller.getBoundingClientRect(); var editorRect = editor.renderer.scroller.getBoundingClientRect();
@ -330,7 +330,7 @@ function DragdropHandler(mouseHandler) {
(function() { (function() {
this.dragWait = function() { this.dragWait = function() {
var interval = (new Date()).getTime() - this.mousedownEvent.time; var interval = Date.now() - this.mousedownEvent.time;
if (interval > this.editor.getDragDelay()) if (interval > this.editor.getDragDelay())
this.startDrag(); this.startDrag();
}; };
@ -384,7 +384,7 @@ function DragdropHandler(mouseHandler) {
var button = e.getButton(); var button = e.getButton();
var clickCount = e.domEvent.detail || 1; var clickCount = e.domEvent.detail || 1;
if (clickCount === 1 && button === 0 && inSelection) { if (clickCount === 1 && button === 0 && inSelection) {
this.mousedownEvent.time = (new Date()).getTime(); this.mousedownEvent.time = Date.now();
var eventTarget = e.domEvent.target || e.domEvent.srcElement; var eventTarget = e.domEvent.target || e.domEvent.srcElement;
if ("unselectable" in eventTarget) if ("unselectable" in eventTarget)
eventTarget.unselectable = "on"; eventTarget.unselectable = "on";