Merge pull request #2156 from ajaxorg/dragcursor
improve drag cursor on windows
This commit is contained in:
commit
a0327aebd9
3 changed files with 50 additions and 49 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1443,26 +1443,26 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Focuses the current container.
|
* Focuses the current container.
|
||||||
**/
|
**/
|
||||||
this.visualizeFocus = function() {
|
this.visualizeFocus = function() {
|
||||||
dom.addCssClass(this.container, "ace_focus");
|
dom.addCssClass(this.container, "ace_focus");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Blurs the current container.
|
* Blurs the current container.
|
||||||
**/
|
**/
|
||||||
this.visualizeBlur = function() {
|
this.visualizeBlur = function() {
|
||||||
dom.removeCssClass(this.container, "ace_focus");
|
dom.removeCssClass(this.container, "ace_focus");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Number} position
|
* @param {Number} position
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
**/
|
**/
|
||||||
this.showComposition = function(position) {
|
this.showComposition = function(position) {
|
||||||
if (!this.$composition)
|
if (!this.$composition)
|
||||||
this.$composition = {
|
this.$composition = {
|
||||||
|
|
@ -1477,18 +1477,18 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} text A string of text to use
|
* @param {String} text A string of text to use
|
||||||
*
|
*
|
||||||
* Sets the inner text of the current composition to `text`.
|
* Sets the inner text of the current composition to `text`.
|
||||||
**/
|
**/
|
||||||
this.setCompositionText = function(text) {
|
this.setCompositionText = function(text) {
|
||||||
this.$moveTextAreaToCursor();
|
this.$moveTextAreaToCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Hides the current composition.
|
* Hides the current composition.
|
||||||
**/
|
**/
|
||||||
this.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
if (!this.$composition)
|
if (!this.$composition)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1500,11 +1500,11 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
|
||||||
* @param {String} theme The path to a theme
|
* @param {String} theme The path to a theme
|
||||||
* @param {Function} cb optional callback
|
* @param {Function} cb optional callback
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setTheme = function(theme, cb) {
|
this.setTheme = function(theme, cb) {
|
||||||
var _self = this;
|
var _self = this;
|
||||||
this.$themeId = theme;
|
this.$themeId = theme;
|
||||||
|
|
@ -1555,9 +1555,9 @@ var VirtualRenderer = function(container, theme) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Returns the path of the current theme.]{: #VirtualRenderer.getTheme}
|
* [Returns the path of the current theme.]{: #VirtualRenderer.getTheme}
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
**/
|
**/
|
||||||
this.getTheme = function() {
|
this.getTheme = function() {
|
||||||
return this.$themeId;
|
return this.$themeId;
|
||||||
};
|
};
|
||||||
|
|
@ -1567,39 +1567,39 @@ var VirtualRenderer = function(container, theme) {
|
||||||
// a certain mode that editor is in.
|
// a certain mode that editor is in.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
|
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
|
||||||
* @param {String} style A class name
|
* @param {String} style A class name
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setStyle = function(style, include) {
|
this.setStyle = function(style, include) {
|
||||||
dom.setCssClass(this.container, style, include !== false);
|
dom.setCssClass(this.container, style, include !== false);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
|
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
|
||||||
* @param {String} style A class name
|
* @param {String} style A class name
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.unsetStyle = function(style) {
|
this.unsetStyle = function(style) {
|
||||||
dom.removeCssClass(this.container, style);
|
dom.removeCssClass(this.container, style);
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {String} cursorStyle A css cursor style
|
* @param {String} cursorStyle A css cursor style
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setMouseCursor = function(cursorStyle) {
|
this.setMouseCursor = function(cursorStyle) {
|
||||||
this.content.style.cursor = cursorStyle;
|
this.scroller.style.cursor = cursorStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the text and cursor layers for this renderer.
|
* Destroys the text and cursor layers for this renderer.
|
||||||
**/
|
**/
|
||||||
this.destroy = function() {
|
this.destroy = function() {
|
||||||
this.$textLayer.destroy();
|
this.$textLayer.destroy();
|
||||||
this.$cursorLayer.destroy();
|
this.$cursorLayer.destroy();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue