mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-10 09:20:58 +00:00
Move brushes to /brushes and mixins to /mixins. Organize ATTRIBUTE_NAMES to use fabric.SHARED_ATTRIBUTES.
This commit is contained in:
parent
743a103e8e
commit
1ed4e40bdf
31 changed files with 55 additions and 134 deletions
32
build.js
32
build.js
|
|
@ -102,8 +102,8 @@ var filesToInclude = [
|
|||
ifSpecifiedInclude('gestures', 'lib/event.js'),
|
||||
|
||||
'src/log.js',
|
||||
'src/observable.mixin.js',
|
||||
'src/collection.mixin.js',
|
||||
'src/mixins/observable.mixin.js',
|
||||
'src/mixins/collection.mixin.js',
|
||||
|
||||
'src/util/misc.js',
|
||||
'src/util/lang_array.js',
|
||||
|
|
@ -129,28 +129,28 @@ var filesToInclude = [
|
|||
|
||||
'src/static_canvas.class.js',
|
||||
|
||||
ifSpecifiedInclude('freedrawing', 'src/base_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/brushes/base_brush.class.js'),
|
||||
|
||||
ifSpecifiedInclude('freedrawing', 'src/pencil_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/circle_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/spray_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/pattern_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/brushes/pencil_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/brushes/circle_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/brushes/spray_brush.class.js'),
|
||||
ifSpecifiedInclude('freedrawing', 'src/brushes/pattern_brush.class.js'),
|
||||
|
||||
ifSpecifiedInclude('interaction', 'src/canvas.class.js'),
|
||||
ifSpecifiedInclude('interaction', 'src/canvas_events.mixin.js'),
|
||||
ifSpecifiedInclude('interaction', 'src/mixins/canvas_events.mixin.js'),
|
||||
|
||||
'src/canvas_animation.mixin.js',
|
||||
'src/mixins/canvas_animation.mixin.js',
|
||||
|
||||
ifSpecifiedInclude('serialization', 'src/canvas_serialization.mixin.js'),
|
||||
ifSpecifiedInclude('gestures', 'src/canvas_gestures.mixin.js'),
|
||||
ifSpecifiedInclude('serialization', 'src/mixins/canvas_serialization.mixin.js'),
|
||||
ifSpecifiedInclude('gestures', 'src/mixins/canvas_gestures.mixin.js'),
|
||||
|
||||
'src/object.class.js',
|
||||
'src/object_origin.mixin.js',
|
||||
'src/object_geometry.mixin.js',
|
||||
'src/mixins/object_origin.mixin.js',
|
||||
'src/mixins/object_geometry.mixin.js',
|
||||
|
||||
ifSpecifiedInclude('stateful', 'src/stateful.mixin.js'),
|
||||
ifSpecifiedInclude('stateful', 'src/mixins/stateful.mixin.js'),
|
||||
|
||||
ifSpecifiedInclude('interaction', 'src/object_interactivity.mixin.js'),
|
||||
ifSpecifiedInclude('interaction', 'src/mixins/object_interactivity.mixin.js'),
|
||||
|
||||
'src/line.class.js',
|
||||
'src/circle.class.js',
|
||||
|
|
@ -164,7 +164,7 @@ var filesToInclude = [
|
|||
'src/group.class.js',
|
||||
'src/image.class.js',
|
||||
|
||||
ifSpecifiedInclude('object_straightening', 'src/object_straightening.mixin.js'),
|
||||
ifSpecifiedInclude('object_straightening', 'src/mixins/object_straightening.mixin.js'),
|
||||
|
||||
ifSpecifiedInclude('image_filters', 'src/image_filters.js'),
|
||||
|
||||
|
|
|
|||
51
dist/all.js
vendored
51
dist/all.js
vendored
|
|
@ -3914,6 +3914,13 @@ fabric.util.string = {
|
|||
clone = fabric.util.object.clone,
|
||||
multiplyTransformMatrices = fabric.util.multiplyTransformMatrices;
|
||||
|
||||
fabric.SHARED_ATTRIBUTES = [
|
||||
"transform",
|
||||
"fill", "fill-rule", "fill-opacity",
|
||||
"opacity",
|
||||
"stroke", "stroke-dasharray", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-width"
|
||||
];
|
||||
|
||||
var attributesMap = {
|
||||
'cx': 'left',
|
||||
'x': 'left',
|
||||
|
|
@ -12141,10 +12148,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/shapes.html#LineElement
|
||||
*/
|
||||
fabric.Line.ATTRIBUTE_NAMES = (
|
||||
'x1 y1 x2 y2 stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Line.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x1 y1 x2 y2'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns fabric.Line instance from an SVG element
|
||||
|
|
@ -12312,10 +12316,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#CircleElement
|
||||
*/
|
||||
fabric.Circle.ATTRIBUTE_NAMES = (
|
||||
'cx cy r fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Circle.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('cx cy r'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Circle} instance from an SVG element
|
||||
|
|
@ -12636,10 +12637,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/shapes.html#EllipseElement
|
||||
*/
|
||||
fabric.Ellipse.ATTRIBUTE_NAMES = (
|
||||
'cx cy rx ry fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Ellipse.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('cx cy rx ry'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Ellipse} instance from an SVG element
|
||||
|
|
@ -12897,10 +12895,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`)
|
||||
* @static
|
||||
*/
|
||||
fabric.Rect.ATTRIBUTE_NAMES = (
|
||||
'x y width height rx ry fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Rect.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x y rx ry width height'.split(' '));
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
|
@ -13079,10 +13074,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#PolylineElement
|
||||
*/
|
||||
fabric.Polyline.ATTRIBUTE_NAMES = (
|
||||
'fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Polyline.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat();
|
||||
|
||||
/**
|
||||
* Returns fabric.Polyline instance from an SVG element
|
||||
|
|
@ -13286,10 +13278,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#PolygonElement
|
||||
*/
|
||||
fabric.Polygon.ATTRIBUTE_NAMES = (
|
||||
'fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Polygon.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat();
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Polygon} instance from an SVG element
|
||||
|
|
@ -14126,10 +14115,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/paths.html#PathElement
|
||||
*/
|
||||
fabric.Path.ATTRIBUTE_NAMES = (
|
||||
'd fill fill-opacity opacity fill-rule stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Path.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat(['d']);
|
||||
|
||||
/**
|
||||
* Creates an instance of fabric.Path from an SVG <path> element
|
||||
|
|
@ -15302,7 +15288,7 @@ fabric.util.object.extend(fabric.Object.prototype, /** @lends fabric.Object.prot
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/struct.html#ImageElement
|
||||
*/
|
||||
fabric.Image.ATTRIBUTE_NAMES = 'x y width height fill fill-opacity opacity transform xlink:href'.split(' ');
|
||||
fabric.Image.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x y width height xlink:href'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Image} instance from an SVG element
|
||||
|
|
@ -17098,11 +17084,8 @@ fabric.Image.filters.Pixelate.fromObject = function(object) {
|
|||
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Text.fromElement})
|
||||
* @static
|
||||
*/
|
||||
fabric.Text.ATTRIBUTE_NAMES = (
|
||||
'x y fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform ' +
|
||||
'font-family font-style font-weight font-size text-decoration'
|
||||
).split(' ');
|
||||
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
|
||||
|
|
|
|||
10
dist/all.min.js
vendored
10
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -133,10 +133,7 @@
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#CircleElement
|
||||
*/
|
||||
fabric.Circle.ATTRIBUTE_NAMES = (
|
||||
'cx cy r fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Circle.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('cx cy r'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Circle} instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -141,10 +141,7 @@
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/shapes.html#EllipseElement
|
||||
*/
|
||||
fabric.Ellipse.ATTRIBUTE_NAMES = (
|
||||
'cx cy rx ry fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Ellipse.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('cx cy rx ry'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Ellipse} instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/struct.html#ImageElement
|
||||
*/
|
||||
fabric.Image.ATTRIBUTE_NAMES = 'x y width height fill fill-opacity opacity transform xlink:href'.split(' ');
|
||||
fabric.Image.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x y width height xlink:href'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Image} instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -176,10 +176,7 @@
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/shapes.html#LineElement
|
||||
*/
|
||||
fabric.Line.ATTRIBUTE_NAMES = (
|
||||
'x1 y1 x2 y2 stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Line.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x1 y1 x2 y2'.split(' '));
|
||||
|
||||
/**
|
||||
* Returns fabric.Line instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -13,6 +13,13 @@
|
|||
clone = fabric.util.object.clone,
|
||||
multiplyTransformMatrices = fabric.util.multiplyTransformMatrices;
|
||||
|
||||
fabric.SHARED_ATTRIBUTES = [
|
||||
"transform",
|
||||
"fill", "fill-rule", "fill-opacity",
|
||||
"opacity",
|
||||
"stroke", "stroke-dasharray", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-width"
|
||||
];
|
||||
|
||||
var attributesMap = {
|
||||
'cx': 'left',
|
||||
'x': 'left',
|
||||
|
|
|
|||
|
|
@ -796,10 +796,7 @@
|
|||
* @static
|
||||
* @see http://www.w3.org/TR/SVG/paths.html#PathElement
|
||||
*/
|
||||
fabric.Path.ATTRIBUTE_NAMES = (
|
||||
'd fill fill-opacity opacity fill-rule stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Path.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat(['d']);
|
||||
|
||||
/**
|
||||
* Creates an instance of fabric.Path from an SVG <path> element
|
||||
|
|
|
|||
|
|
@ -162,10 +162,7 @@
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#PolygonElement
|
||||
*/
|
||||
fabric.Polygon.ATTRIBUTE_NAMES = (
|
||||
'fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Polygon.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat();
|
||||
|
||||
/**
|
||||
* Returns {@link fabric.Polygon} instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -133,10 +133,7 @@
|
|||
* @static
|
||||
* @see: http://www.w3.org/TR/SVG/shapes.html#PolylineElement
|
||||
*/
|
||||
fabric.Polyline.ATTRIBUTE_NAMES = (
|
||||
'fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Polyline.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat();
|
||||
|
||||
/**
|
||||
* Returns fabric.Polyline instance from an SVG element
|
||||
|
|
|
|||
|
|
@ -213,10 +213,7 @@
|
|||
* List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`)
|
||||
* @static
|
||||
*/
|
||||
fabric.Rect.ATTRIBUTE_NAMES = (
|
||||
'x y width height rx ry fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform'
|
||||
).split(' ');
|
||||
fabric.Rect.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat('x y rx ry width height'.split(' '));
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
|
|
|||
45
src/scout.js
45
src/scout.js
|
|
@ -1,45 +0,0 @@
|
|||
/** @ignore */
|
||||
var scout = (function () {
|
||||
var tests = { };
|
||||
return {
|
||||
addTest: function (moduleName, test) {
|
||||
tests[moduleName] = test;
|
||||
},
|
||||
fetch: function () {
|
||||
var modulesToFetch = [ ];
|
||||
for (var moduleName in tests) {
|
||||
if (tests[moduleName]()) {
|
||||
modulesToFetch.push(moduleName);
|
||||
}
|
||||
}
|
||||
return modulesToFetch.join(',');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
scout.addTest('json2', function () {
|
||||
return typeof JSON === 'undefined';
|
||||
});
|
||||
scout.addTest('indexOf', function () {
|
||||
return typeof Array.prototype.indexOf === 'undefined';
|
||||
});
|
||||
scout.addTest('forEach', function () {
|
||||
return typeof Array.prototype.forEach === 'undefined';
|
||||
});
|
||||
scout.addTest('map', function () {
|
||||
return typeof Array.prototype.map === 'undefined';
|
||||
});
|
||||
scout.addTest('every', function () {
|
||||
return typeof Array.prototype.every === 'undefined';
|
||||
});
|
||||
scout.addTest('some', function () {
|
||||
return typeof Array.prototype.some === 'undefined';
|
||||
});
|
||||
scout.addTest('filter', function () {
|
||||
return typeof Array.prototype.filter === 'undefined';
|
||||
});
|
||||
scout.addTest('reduce', function () {
|
||||
return typeof Array.prototype.reduce === 'undefined';
|
||||
});
|
||||
|
||||
scout.fetch();
|
||||
|
|
@ -907,11 +907,8 @@
|
|||
* List of attribute names to account for when parsing SVG element (used by {@link fabric.Text.fromElement})
|
||||
* @static
|
||||
*/
|
||||
fabric.Text.ATTRIBUTE_NAMES = (
|
||||
'x y fill fill-opacity opacity stroke stroke-width stroke-dasharray ' +
|
||||
'stroke-linejoin stroke-linecap stroke-miterlimit transform ' +
|
||||
'font-family font-style font-weight font-size text-decoration'
|
||||
).split(' ');
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue