[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
(function(global) {
|
2013-02-04 19:47:02 +00:00
|
|
|
|
2014-02-16 21:36:03 +00:00
|
|
|
'use strict';
|
2013-02-04 19:47:02 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
var fabric = global.fabric || (global.fabric = { });
|
2013-02-04 19:47:02 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
if (fabric.Shadow) {
|
|
|
|
|
fabric.warn('fabric.Shadow is already defined.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-02-04 19:47:02 +00:00
|
|
|
|
|
|
|
|
/**
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
* Shadow class
|
|
|
|
|
* @class fabric.Shadow
|
2013-09-28 10:31:32 +00:00
|
|
|
* @see {@link http://fabricjs.com/shadows/|Shadow demo}
|
2013-10-05 18:21:28 +00:00
|
|
|
* @see {@link fabric.Shadow#initialize} for constructor definition
|
2013-02-04 19:47:02 +00:00
|
|
|
*/
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
fabric.Shadow = fabric.util.createClass(/** @lends fabric.Shadow.prototype */ {
|
2013-02-04 19:47:02 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Shadow color
|
|
|
|
|
* @type String
|
|
|
|
|
* @default
|
|
|
|
|
*/
|
|
|
|
|
color: 'rgb(0,0,0)',
|
2013-02-06 22:55:15 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Shadow blur
|
|
|
|
|
* @type Number
|
|
|
|
|
*/
|
|
|
|
|
blur: 0,
|
2013-07-25 17:39:21 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Shadow horizontal offset
|
|
|
|
|
* @type Number
|
|
|
|
|
* @default
|
|
|
|
|
*/
|
|
|
|
|
offsetX: 0,
|
2013-02-04 19:47:02 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Shadow vertical offset
|
|
|
|
|
* @type Number
|
|
|
|
|
* @default
|
|
|
|
|
*/
|
|
|
|
|
offsetY: 0,
|
2013-07-25 17:39:21 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Whether the shadow should affect stroke operations
|
|
|
|
|
* @type Boolean
|
|
|
|
|
* @default
|
|
|
|
|
*/
|
|
|
|
|
affectStroke: false,
|
|
|
|
|
|
2013-10-25 07:04:48 +00:00
|
|
|
/**
|
|
|
|
|
* Indicates whether toObject should include default values
|
|
|
|
|
* @type Boolean
|
|
|
|
|
* @default
|
|
|
|
|
*/
|
|
|
|
|
includeDefaultValues: true,
|
|
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
* @param {Object|String} [options] Options object with any of color, blur, offsetX, offsetX properties or string (e.g. "rgba(0,0,0,0.2) 2px 2px 10px, "2px 2px 10px rgba(0,0,0,0.2)")
|
|
|
|
|
* @return {fabric.Shadow} thisArg
|
|
|
|
|
*/
|
|
|
|
|
initialize: function(options) {
|
2014-06-24 13:39:31 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
if (typeof options === 'string') {
|
|
|
|
|
options = this._parseShadow(options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var prop in options) {
|
|
|
|
|
this[prop] = options[prop];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.id = fabric.Object.__uid++;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private
|
|
|
|
|
* @param {String} shadow Shadow value to parse
|
|
|
|
|
* @return {Object} Shadow object with color, offsetX, offsetY and blur
|
|
|
|
|
*/
|
|
|
|
|
_parseShadow: function(shadow) {
|
2014-02-16 21:36:03 +00:00
|
|
|
var shadowStr = shadow.trim(),
|
|
|
|
|
offsetsAndBlur = fabric.Shadow.reOffsetsAndBlur.exec(shadowStr) || [ ],
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
color = shadowStr.replace(fabric.Shadow.reOffsetsAndBlur, '') || 'rgb(0,0,0)';
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
color: color.trim(),
|
|
|
|
|
offsetX: parseInt(offsetsAndBlur[1], 10) || 0,
|
|
|
|
|
offsetY: parseInt(offsetsAndBlur[2], 10) || 0,
|
|
|
|
|
blur: parseInt(offsetsAndBlur[3], 10) || 0
|
|
|
|
|
};
|
|
|
|
|
},
|
2013-07-08 10:39:19 +00:00
|
|
|
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
/**
|
2013-09-05 16:09:34 +00:00
|
|
|
* Returns a string representation of an instance
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
* @see http://www.w3.org/TR/css-text-decor-3/#text-shadow
|
2013-09-05 16:09:34 +00:00
|
|
|
* @return {String} Returns CSS3 text-shadow declaration
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
*/
|
2013-09-05 16:09:34 +00:00
|
|
|
toString: function() {
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
return [this.offsetX, this.offsetY, this.blur, this.color].join('px ');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/* _TO_SVG_START_ */
|
|
|
|
|
/**
|
|
|
|
|
* Returns SVG representation of a shadow
|
2013-09-17 20:42:58 +00:00
|
|
|
* @param {fabric.Object} object
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
* @return {String} SVG representation of a shadow
|
|
|
|
|
*/
|
|
|
|
|
toSVG: function(object) {
|
|
|
|
|
var mode = 'SourceAlpha';
|
|
|
|
|
|
|
|
|
|
if (object && (object.fill === this.color || object.stroke === this.color)) {
|
|
|
|
|
mode = 'SourceGraphic';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
'<filter id="SVGID_' + this.id + '" y="-40%" height="180%">' +
|
|
|
|
|
'<feGaussianBlur in="' + mode + '" stdDeviation="' +
|
|
|
|
|
(this.blur ? this.blur / 3 : 0) +
|
|
|
|
|
'"></feGaussianBlur>' +
|
|
|
|
|
'<feOffset dx="' + this.offsetX + '" dy="' + this.offsetY + '"></feOffset>' +
|
|
|
|
|
'<feMerge>' +
|
|
|
|
|
'<feMergeNode></feMergeNode>' +
|
|
|
|
|
'<feMergeNode in="SourceGraphic"></feMergeNode>' +
|
|
|
|
|
'</feMerge>' +
|
|
|
|
|
'</filter>');
|
|
|
|
|
},
|
|
|
|
|
/* _TO_SVG_END_ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns object representation of a shadow
|
|
|
|
|
* @return {Object} Object representation of a shadow instance
|
|
|
|
|
*/
|
|
|
|
|
toObject: function() {
|
2013-10-25 07:04:48 +00:00
|
|
|
if (this.includeDefaultValues) {
|
|
|
|
|
return {
|
|
|
|
|
color: this.color,
|
|
|
|
|
blur: this.blur,
|
|
|
|
|
offsetX: this.offsetX,
|
|
|
|
|
offsetY: this.offsetY
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
var obj = { }, proto = fabric.Shadow.prototype;
|
|
|
|
|
if (this.color !== proto.color) {
|
|
|
|
|
obj.color = this.color;
|
|
|
|
|
}
|
|
|
|
|
if (this.blur !== proto.blur) {
|
|
|
|
|
obj.blur = this.blur;
|
|
|
|
|
}
|
|
|
|
|
if (this.offsetX !== proto.offsetX) {
|
|
|
|
|
obj.offsetX = this.offsetX;
|
|
|
|
|
}
|
|
|
|
|
if (this.offsetY !== proto.offsetY) {
|
|
|
|
|
obj.offsetY = this.offsetY;
|
|
|
|
|
}
|
|
|
|
|
return obj;
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
}
|
|
|
|
|
});
|
2013-07-08 10:39:19 +00:00
|
|
|
|
2013-02-04 19:47:02 +00:00
|
|
|
/**
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
* Regex matching shadow offsetX, offsetY and blur (ex: "2px 2px 10px rgba(0,0,0,0.2)", "rgb(0,255,0) 2px 2px")
|
|
|
|
|
* @static
|
|
|
|
|
* @field
|
|
|
|
|
* @memberOf fabric.Shadow
|
2013-02-04 19:47:02 +00:00
|
|
|
*/
|
[BACK_INCOMPAT] `fabric.Text#textShadow` has been removed - new `fabric.Text.shadow` property (type of fabric.Shadow)
[BACK_INCOMPAT] `fabric.BaseBrush`shadow properties are combined into one property => `fabric.BaseBrush.shadow`(shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY no longer exist)
Removed fabric.Text.getText method => is generated with `fabric.util.createAccessors`
`fabric.Shadow` can now initialized with string or object (e.g. '10px 10px 5px rgb(0,0,255)', 'rgb(0,0,255) 10px 10px 5px', {color: 'gb(0,0,255)', offsetX: 10, offsetY: 10, blur: 5})
`fabric.Shadow.getShadow`to get css3 declaration of shadow (String)
`fabric.Object.set('shadow', value)`is now the same as `fabric.Shadow.setShadow(value)`
Add unit tests
2013-09-03 17:11:21 +00:00
|
|
|
fabric.Shadow.reOffsetsAndBlur = /(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/;
|
|
|
|
|
|
|
|
|
|
})(typeof exports !== 'undefined' ? exports : this);
|