Add support for customizing canvas default cursor.

This commit is contained in:
kangax 2011-11-11 15:01:20 -05:00
parent 343a5a2605
commit 7adb4309de
4 changed files with 23 additions and 11 deletions

View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2011, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.6.9" };
var fabric = fabric || { version: "0.6.10" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;

16
dist/all.js vendored
View file

@ -1,6 +1,6 @@
/*! Fabric.js Copyright 2008-2011, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
var fabric = fabric || { version: "0.6.9" };
var fabric = fabric || { version: "0.6.10" };
if (typeof exports != 'undefined') {
exports.fabric = fabric;
@ -4534,6 +4534,12 @@ fabric.util.string = {
*/
HOVER_CURSOR: 'move',
/**
* @constant
* @type String
*/
CURSOR: 'default',
/**
* Callback; invoked right before object is about to be scaled/rotated
* @method onBeforeScaleRotate
@ -4906,7 +4912,7 @@ fabric.util.string = {
if (activeGroup) {
activeGroup.setObjectsCoords();
activeGroup.set('isMoving', false);
this._setCursor('default');
this._setCursor(this.CURSOR);
}
// clear selection
@ -5252,7 +5258,7 @@ fabric.util.string = {
this._objects[i].setActive(false);
}
}
style.cursor = 'default';
style.cursor = this.CURSOR;
}
else {
// set proper cursor
@ -5395,7 +5401,7 @@ fabric.util.string = {
_setCursorFromEvent: function (e, target) {
var s = this.upperCanvasEl.style;
if (!target) {
s.cursor = 'default';
s.cursor = this.CURSOR;
return false;
}
else {
@ -5413,7 +5419,7 @@ fabric.util.string = {
s.cursor = cursorMap[corner];
}
else {
s.cursor = 'default';
s.cursor = this.CURSOR;
return false;
}
}

View file

@ -1,7 +1,7 @@
{
"name": "fabric",
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
"version": "0.6.9",
"version": "0.6.10",
"author": "Juriy Zaytsev <kangax@gmail.com>",
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
"repository": "git://github.com/kangax/fabric.js",

View file

@ -227,6 +227,12 @@
*/
HOVER_CURSOR: 'move',
/**
* @constant
* @type String
*/
CURSOR: 'default',
/**
* Callback; invoked right before object is about to be scaled/rotated
* @method onBeforeScaleRotate
@ -599,7 +605,7 @@
if (activeGroup) {
activeGroup.setObjectsCoords();
activeGroup.set('isMoving', false);
this._setCursor('default');
this._setCursor(this.CURSOR);
}
// clear selection
@ -945,7 +951,7 @@
this._objects[i].setActive(false);
}
}
style.cursor = 'default';
style.cursor = this.CURSOR;
}
else {
// set proper cursor
@ -1088,7 +1094,7 @@
_setCursorFromEvent: function (e, target) {
var s = this.upperCanvasEl.style;
if (!target) {
s.cursor = 'default';
s.cursor = this.CURSOR;
return false;
}
else {
@ -1106,7 +1112,7 @@
s.cursor = cursorMap[corner];
}
else {
s.cursor = 'default';
s.cursor = this.CURSOR;
return false;
}
}