Move shape classes (circle, line, rect, path, etc.) to /shapes dir

This commit is contained in:
kangax 2013-05-30 21:53:49 +02:00
parent a2c48ca712
commit b53209437f
13 changed files with 30 additions and 10 deletions

View file

@ -128,6 +128,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement})
* @static
@ -169,6 +170,7 @@
function isValidRadius(attributes) {
return (('radius' in attributes) && (attributes.radius > 0));
}
/* _FROM_SVG_END_ */
/**
* Returns {@link fabric.Circle} instance from an object representation

View file

@ -136,6 +136,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement})
* @static
@ -171,6 +172,7 @@
return ellipse;
};
/* _FROM_SVG_END_ */
/**
* Returns {@link fabric.Ellipse} instance from an object representation

View file

@ -446,6 +446,7 @@
});
};
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Image.fromElement})
* @static
@ -467,6 +468,7 @@
fabric.Image.fromURL(parsedAttributes['xlink:href'], callback,
extend((options ? fabric.util.object.clone(options) : { }), parsedAttributes));
};
/* _FROM_SVG_END_ */
/**
* Indicates that instances of this type are async

View file

@ -178,6 +178,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Line.fromElement})
* @static
@ -202,6 +203,7 @@
];
return new fabric.Line(points, extend(parsedAttributes, options));
};
/* _FROM_SVG_END_ */
/**
* Returns fabric.Line instance from an object representation

View file

@ -486,6 +486,7 @@
return this.toObject(propertiesToInclude);
},
/* _TO_SVG_START_ */
/**
* Returns styles-string for svg-export
* @return {String}
@ -537,6 +538,7 @@
return [ translatePart, anglePart, scalePart, flipXPart, flipYPart ].join('');
},
/* _TO_SVG_END_ */
/**
* @private

View file

@ -793,6 +793,7 @@
return new fabric.Path(object.path, object);
};
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by `fabric.Path.fromElement`)
* @static
@ -811,5 +812,6 @@
var parsedAttributes = fabric.parseAttributes(element, fabric.Path.ATTRIBUTE_NAMES);
return new fabric.Path(parsedAttributes.d, extend(parsedAttributes, options));
};
/* _FROM_SVG_END_ */
})(typeof exports !== 'undefined' ? exports : this);

View file

@ -158,6 +158,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`)
* @static
@ -194,6 +195,7 @@
return new fabric.Polygon(points, extend(parsedAttributes, options), true);
};
/* _FROM_SVG_END_ */
/**
* Returns fabric.Polygon instance from an object representation

View file

@ -129,6 +129,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Polyline.fromElement})
* @static
@ -165,6 +166,7 @@
return new fabric.Polyline(points, fabric.util.object.extend(parsedAttributes, options), true);
};
/* _FROM_SVG_END_ */
/**
* Returns fabric.Polyline instance from an object representation

View file

@ -209,6 +209,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`)
* @static
@ -244,6 +245,7 @@
return rect;
};
/* _FROM_SVG_END_ */
/**
* Returns {@link fabric.Rect} instance from an object representation

View file

@ -938,6 +938,7 @@
}
});
/* _FROM_SVG_START_ */
/**
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Text.fromElement})
* @static
@ -945,16 +946,6 @@
fabric.Text.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat(
'x y font-family font-style font-weight font-size text-decoration'.split(' '));
/**
* Returns fabric.Text instance from an object representation
* @static
* @param object {Object} object Object to create an instance from
* @return {fabric.Text} Instance of fabric.Text
*/
fabric.Text.fromObject = function(object) {
return new fabric.Text(object.text, clone(object));
};
/**
* Returns fabric.Text instance from an SVG element (<b>not yet implemented</b>)
* @static
@ -986,6 +977,17 @@
return text;
};
/* _FROM_SVG_END_ */
/**
* Returns fabric.Text instance from an object representation
* @static
* @param object {Object} object Object to create an instance from
* @return {fabric.Text} Instance of fabric.Text
*/
fabric.Text.fromObject = function(object) {
return new fabric.Text(object.text, clone(object));
};
fabric.util.createAccessors(fabric.Text);