improve drag cursor on windows

This commit is contained in:
nightwing 2014-09-07 20:59:31 +04:00
commit f68ca6266a
3 changed files with 50 additions and 49 deletions

View file

@ -15,6 +15,7 @@
-moz-user-select: none; -moz-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none; user-select: none;
cursor: text;
} }
.ace_content { .ace_content {
@ -22,14 +23,9 @@
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
cursor: text;
min-width: 100%; min-width: 100%;
} }
.ace_dragging, .ace_dragging * {
cursor: move !important;
}
.ace_dragging .ace_scroller:before{ .ace_dragging .ace_scroller:before{
position: absolute; position: absolute;
top: 0; top: 0;

View file

@ -110,6 +110,7 @@ function DragdropHandler(mouseHandler) {
editor.renderer.$cursorLayer.setBlinking(true); editor.renderer.$cursorLayer.setBlinking(true);
} }
this.editor.unsetStyle("ace_dragging"); this.editor.unsetStyle("ace_dragging");
this.editor.renderer.setCursorStyle("");
}; };
this.onDragEnter = function(e) { this.onDragEnter = function(e) {
@ -349,15 +350,19 @@ function DragdropHandler(mouseHandler) {
this.dragReadyEnd = function(e) { this.dragReadyEnd = function(e) {
this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()); this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly());
this.editor.unsetStyle("ace_dragging"); this.editor.unsetStyle("ace_dragging");
this.editor.renderer.setCursorStyle("");
this.dragWaitEnd(); this.dragWaitEnd();
}; };
this.startDrag = function(){ this.startDrag = function(){
this.cancelDrag = false; this.cancelDrag = false;
var target = this.editor.container; var editor = this.editor;
var target = editor.container;
target.draggable = true; target.draggable = true;
this.editor.renderer.$cursorLayer.setBlinking(false); editor.renderer.$cursorLayer.setBlinking(false);
this.editor.setStyle("ace_dragging"); editor.setStyle("ace_dragging");
var cursorStyle = useragent.isWin ? "default" : "move";
editor.renderer.setCursorStyle(cursorStyle);
this.setState("dragReady"); this.setState("dragReady");
}; };

View file

@ -1585,8 +1585,8 @@ var VirtualRenderer = function(container, theme) {
}; };
this.setCursorStyle = function(style) { this.setCursorStyle = function(style) {
if (this.content.style.cursor != style) if (this.scroller.style.cursor != style)
this.content.style.cursor = style; this.scroller.style.cursor = style;
}; };
/** /**
@ -1594,7 +1594,7 @@ var VirtualRenderer = function(container, theme) {
* *
**/ **/
this.setMouseCursor = function(cursorStyle) { this.setMouseCursor = function(cursorStyle) {
this.content.style.cursor = cursorStyle; this.scroller.style.cursor = cursorStyle;
}; };
/** /**