Normalize option setting in all classes. Fix #287.

This commit is contained in:
kangax 2012-10-17 01:17:51 +02:00
parent 4f1f7cc118
commit 514f064710
9 changed files with 19 additions and 29 deletions

23
dist/all.js vendored
View file

@ -9381,6 +9381,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
* @return {fabric.Line} thisArg
*/
initialize: function(points, options) {
options = options || { };
if (!points) {
points = [0, 0, 0, 0];
}
@ -10017,6 +10019,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
* @return {Object} thisArg
*/
initialize: function(options) {
options = options || { };
this._initStateProperties();
this.callSuper('initialize', options);
this._initRxRy();
@ -10647,10 +10651,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
fabric.warn('fabric.Path is already defined');
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Path requires fabric.Object');
return;
}
/**
* @private
@ -11551,6 +11551,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
* @return {Object} thisArg
*/
initialize: function(objects, options) {
options = options || { };
this.objects = objects || [];
this.originalState = { };
@ -12016,11 +12018,6 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Object is required for fabric.Image initialization');
return;
}
/**
* @class Image
* @extends fabric.Object
@ -13075,10 +13072,6 @@ fabric.Image.filters.Tint.fromObject = function(object) {
fabric.warn('fabric.Text is already defined');
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Text requires fabric.Object');
return;
}
/**
* @class Text
@ -13181,9 +13174,11 @@ fabric.Image.filters.Tint.fromObject = function(object) {
* @return {fabric.Text} thisArg
*/
initialize: function(text, options) {
options = options || { };
this._initStateProperties();
this.text = text;
this.setOptions(options || { });
this.setOptions(options);
this._theta = this.angle * Math.PI / 180;
this._initDimensions();
this.setCoords();

2
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -33,6 +33,8 @@
* @return {Object} thisArg
*/
initialize: function(objects, options) {
options = options || { };
this.objects = objects || [];
this.originalState = { };

View file

@ -13,11 +13,6 @@
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Object is required for fabric.Image initialization');
return;
}
/**
* @class Image
* @extends fabric.Object

View file

@ -31,6 +31,8 @@
* @return {fabric.Line} thisArg
*/
initialize: function(points, options) {
options = options || { };
if (!points) {
points = [0, 0, 0, 0];
}

View file

@ -130,10 +130,6 @@
fabric.warn('fabric.Path is already defined');
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Path requires fabric.Object');
return;
}
/**
* @private

View file

@ -40,6 +40,8 @@
* @return {Object} thisArg
*/
initialize: function(options) {
options = options || { };
this._initStateProperties();
this.callSuper('initialize', options);
this._initRxRy();

View file

@ -11,10 +11,6 @@
fabric.warn('fabric.Text is already defined');
return;
}
if (!fabric.Object) {
fabric.warn('fabric.Text requires fabric.Object');
return;
}
/**
* @class Text
@ -117,9 +113,11 @@
* @return {fabric.Text} thisArg
*/
initialize: function(text, options) {
options = options || { };
this._initStateProperties();
this.text = text;
this.setOptions(options || { });
this.setOptions(options);
this._theta = this.angle * Math.PI / 180;
this._initDimensions();
this.setCoords();