add renderer.setMouseCursor
This commit is contained in:
parent
2cef7f4747
commit
a44cbdc5c2
2 changed files with 15 additions and 9 deletions
|
|
@ -887,24 +887,25 @@ function MultiSelect(editor) {
|
||||||
function addAltCursorListeners(editor){
|
function addAltCursorListeners(editor){
|
||||||
var el = editor.textInput.getElement();
|
var el = editor.textInput.getElement();
|
||||||
var altCursor = false;
|
var altCursor = false;
|
||||||
var contentEl = editor.renderer.content;
|
|
||||||
event.addListener(el, "keydown", function(e) {
|
event.addListener(el, "keydown", function(e) {
|
||||||
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||||
if (!altCursor) {
|
if (!altCursor) {
|
||||||
contentEl.style.cursor = "crosshair";
|
editor.renderer.setMouseCursor("crosshair");
|
||||||
altCursor = true;
|
altCursor = true;
|
||||||
}
|
}
|
||||||
} else if (altCursor) {
|
} else if (altCursor) {
|
||||||
contentEl.style.cursor = "";
|
reset();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
event.addListener(el, "keyup", reset);
|
event.addListener(el, "keyup", reset);
|
||||||
event.addListener(el, "blur", reset);
|
event.addListener(el, "blur", reset);
|
||||||
function reset() {
|
function reset(e) {
|
||||||
if (altCursor) {
|
if (altCursor) {
|
||||||
contentEl.style.cursor = "";
|
editor.renderer.setMouseCursor("");
|
||||||
altCursor = false;
|
altCursor = false;
|
||||||
|
// TODO disable menu poping up
|
||||||
|
// e && e.preventDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1504,9 +1504,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
* [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 setStyle(style, include) {
|
this.setStyle = function(style, include) {
|
||||||
dom.setCssClass(this.container, style, include != false);
|
dom.setCssClass(this.container, style, include != false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1514,14 +1513,20 @@ var VirtualRenderer = function(container, theme) {
|
||||||
* [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 unsetStyle(style) {
|
this.unsetStyle = function(style) {
|
||||||
dom.removeCssClass(this.container, style);
|
dom.removeCssClass(this.container, style);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param {String} cursorStyle A css cursor style
|
||||||
*
|
*
|
||||||
|
**/
|
||||||
|
this.setMouseCursor = function(cursorStyle) {
|
||||||
|
this.content.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() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue