fabric-rails 1.0.12 → 1.0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/fabric/rails/version.rb +2 -2
- data/vendor/assets/javascripts/event.js +1909 -0
- data/vendor/assets/javascripts/fabric.js +64 -16464
- data/vendor/assets/javascripts/fabric/HEADER.js +31 -0
- data/vendor/assets/javascripts/fabric/canvas.class.js +1007 -0
- data/vendor/assets/javascripts/fabric/canvas_animation.mixin.js +113 -0
- data/vendor/assets/javascripts/fabric/canvas_events.mixin.js +482 -0
- data/vendor/assets/javascripts/fabric/canvas_gestures.mixin.js +79 -0
- data/vendor/assets/javascripts/fabric/canvas_serialization.mixin.js +311 -0
- data/vendor/assets/javascripts/fabric/circle.class.js +182 -0
- data/vendor/assets/javascripts/fabric/color.class.js +284 -0
- data/vendor/assets/javascripts/fabric/ellipse.class.js +169 -0
- data/vendor/assets/javascripts/fabric/freedrawing.class.js +256 -0
- data/vendor/assets/javascripts/fabric/gradient.class.js +211 -0
- data/vendor/assets/javascripts/fabric/group.class.js +556 -0
- data/vendor/assets/javascripts/fabric/image.class.js +418 -0
- data/vendor/assets/javascripts/fabric/image_filters.js +809 -0
- data/vendor/assets/javascripts/fabric/intersection.class.js +178 -0
- data/vendor/assets/javascripts/fabric/line.class.js +188 -0
- data/vendor/assets/javascripts/fabric/log.js +26 -0
- data/vendor/assets/javascripts/fabric/node.js +149 -0
- data/vendor/assets/javascripts/fabric/object.class.js +1068 -0
- data/vendor/assets/javascripts/fabric/object_geometry.mixin.js +308 -0
- data/vendor/assets/javascripts/fabric/object_interactivity.mixin.js +496 -0
- data/vendor/assets/javascripts/fabric/object_origin.mixin.js +207 -0
- data/vendor/assets/javascripts/fabric/object_straightening.mixin.js +94 -0
- data/vendor/assets/javascripts/fabric/observable.mixin.js +91 -0
- data/vendor/assets/javascripts/fabric/parser.js +750 -0
- data/vendor/assets/javascripts/fabric/path.class.js +794 -0
- data/vendor/assets/javascripts/fabric/path_group.class.js +240 -0
- data/vendor/assets/javascripts/fabric/pattern.class.js +69 -0
- data/vendor/assets/javascripts/fabric/point.class.js +327 -0
- data/vendor/assets/javascripts/fabric/polygon.class.js +184 -0
- data/vendor/assets/javascripts/fabric/polyline.class.js +157 -0
- data/vendor/assets/javascripts/fabric/rect.class.js +298 -0
- data/vendor/assets/javascripts/fabric/scout.js +45 -0
- data/vendor/assets/javascripts/fabric/shadow.class.js +70 -0
- data/vendor/assets/javascripts/fabric/stateful.js +88 -0
- data/vendor/assets/javascripts/fabric/static_canvas.class.js +1298 -0
- data/vendor/assets/javascripts/fabric/text.class.js +934 -0
- data/vendor/assets/javascripts/fabric/triangle.class.js +108 -0
- data/vendor/assets/javascripts/fabric/util/anim_ease.js +360 -0
- data/vendor/assets/javascripts/fabric/util/dom_event.js +237 -0
- data/vendor/assets/javascripts/fabric/util/dom_misc.js +245 -0
- data/vendor/assets/javascripts/fabric/util/dom_request.js +72 -0
- data/vendor/assets/javascripts/fabric/util/dom_style.js +71 -0
- data/vendor/assets/javascripts/fabric/util/lang_array.js +250 -0
- data/vendor/assets/javascripts/fabric/util/lang_class.js +97 -0
- data/vendor/assets/javascripts/fabric/util/lang_function.js +35 -0
- data/vendor/assets/javascripts/fabric/util/lang_object.js +34 -0
- data/vendor/assets/javascripts/fabric/util/lang_string.js +60 -0
- data/vendor/assets/javascripts/fabric/util/misc.js +406 -0
- data/vendor/assets/javascripts/json2.js +491 -0
- metadata +53 -2
@@ -0,0 +1,256 @@
|
|
1
|
+
(function(global) {
|
2
|
+
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
var fabric = global.fabric || (global.fabric = { });
|
6
|
+
|
7
|
+
var utilMin = fabric.util.array.min,
|
8
|
+
utilMax = fabric.util.array.max;
|
9
|
+
|
10
|
+
if (fabric.FreeDrawing) {
|
11
|
+
fabric.warn('fabric.FreeDrawing is already defined');
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Free drawing class
|
17
|
+
* Free Drawer handles scribbling on a fabric canvas
|
18
|
+
* It converts the hand writting to a SVG Path and adds this path to the canvas
|
19
|
+
*
|
20
|
+
* @class FreeDrawing
|
21
|
+
* @memberOf fabric
|
22
|
+
*/
|
23
|
+
fabric.FreeDrawing = fabric.util.createClass( /** @scope fabric.FreeDrawing.prototype */ {
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Constructor
|
27
|
+
* @metod initialize
|
28
|
+
* @param fabricCanvas {fabric.Canvas}
|
29
|
+
* @return {fabric.FreeDrawing}
|
30
|
+
*/
|
31
|
+
initialize: function(fabricCanvas) {
|
32
|
+
this.canvas = fabricCanvas;
|
33
|
+
this._points = [];
|
34
|
+
},
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @private
|
38
|
+
* @method _addPoint
|
39
|
+
*
|
40
|
+
*/
|
41
|
+
_addPoint: function(point) {
|
42
|
+
this._points.push(point);
|
43
|
+
},
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Clear points array and set contextTop canvas
|
47
|
+
* style.
|
48
|
+
*
|
49
|
+
* @private
|
50
|
+
* @method _reset
|
51
|
+
*
|
52
|
+
*/
|
53
|
+
_reset: function() {
|
54
|
+
this._points.length = 0;
|
55
|
+
var ctx = this.canvas.contextTop;
|
56
|
+
|
57
|
+
// set freehanddrawing line canvas parameters
|
58
|
+
ctx.strokeStyle = this.canvas.freeDrawingColor;
|
59
|
+
ctx.lineWidth = this.canvas.freeDrawingLineWidth;
|
60
|
+
ctx.lineCap = ctx.lineJoin = 'round';
|
61
|
+
},
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @method _prepareForDrawing
|
65
|
+
*/
|
66
|
+
_prepareForDrawing: function(pointer) {
|
67
|
+
|
68
|
+
this.canvas._isCurrentlyDrawing = true;
|
69
|
+
this.canvas.discardActiveObject().renderAll();
|
70
|
+
|
71
|
+
var p = new fabric.Point(pointer.x, pointer.y);
|
72
|
+
this._reset();
|
73
|
+
this._addPoint(p);
|
74
|
+
this.canvas.contextTop.moveTo(p.x, p.y);
|
75
|
+
},
|
76
|
+
|
77
|
+
/**
|
78
|
+
* @private
|
79
|
+
* @method _captureDrawingPath
|
80
|
+
*
|
81
|
+
* @param point {pointer} (fabric.util.pointer) actual mouse position
|
82
|
+
* related to the canvas.
|
83
|
+
*/
|
84
|
+
_captureDrawingPath: function(pointer) {
|
85
|
+
var pointerPoint = new fabric.Point(pointer.x, pointer.y);
|
86
|
+
this._addPoint(pointerPoint);
|
87
|
+
},
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Draw a smooth path on the topCanvas using
|
91
|
+
* quadraticCurveTo.
|
92
|
+
*
|
93
|
+
* @private
|
94
|
+
* @method _render
|
95
|
+
*
|
96
|
+
*/
|
97
|
+
_render: function() {
|
98
|
+
var ctx = this.canvas.contextTop;
|
99
|
+
ctx.beginPath();
|
100
|
+
|
101
|
+
var p1 = this._points[0];
|
102
|
+
var p2 = this._points[1];
|
103
|
+
|
104
|
+
ctx.moveTo(p1.x, p1.y);
|
105
|
+
|
106
|
+
for (var i = 1, len = this._points.length; i < len; i++) {
|
107
|
+
// we pick the point between pi+1 & pi+2 as the
|
108
|
+
// end point and p1 as our control point.
|
109
|
+
var midPoint = p1.midPointFrom(p2);
|
110
|
+
ctx.quadraticCurveTo(p1.x, p1.y, midPoint.x, midPoint.y);
|
111
|
+
|
112
|
+
p1 = this._points[i];
|
113
|
+
p2 = this._points[i+1];
|
114
|
+
}
|
115
|
+
// Draw last line as a straight line while
|
116
|
+
// we wait for the next point to be able to calculate
|
117
|
+
// the bezier control point
|
118
|
+
ctx.lineTo(p1.x, p1.y);
|
119
|
+
ctx.stroke();
|
120
|
+
},
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Return an SVG path based on our
|
124
|
+
* captured points and their boundinb box.
|
125
|
+
*
|
126
|
+
* @private
|
127
|
+
* @method _getSVGPathData
|
128
|
+
*
|
129
|
+
*/
|
130
|
+
_getSVGPathData: function() {
|
131
|
+
this.box = this.getPathBoundingBox(this._points);
|
132
|
+
return this.convertPointsToSVGPath(
|
133
|
+
this._points, this.box.minx, this.box.maxx, this.box.miny, this.box.maxy);
|
134
|
+
},
|
135
|
+
|
136
|
+
/**
|
137
|
+
* Returns bounding box of a path based on given points
|
138
|
+
* @method getPathBoundingBox
|
139
|
+
* @param {Array} points
|
140
|
+
* @return {Object} object with minx, miny, maxx, maxy
|
141
|
+
*/
|
142
|
+
getPathBoundingBox: function(points) {
|
143
|
+
var xBounds = [],
|
144
|
+
yBounds = [],
|
145
|
+
p1 = points[0],
|
146
|
+
p2 = points[1],
|
147
|
+
startPoint = p1;
|
148
|
+
|
149
|
+
for (var i = 1, len = points.length; i < len; i++) {
|
150
|
+
var midPoint = p1.midPointFrom(p2);
|
151
|
+
// with startPoint, p1 as control point, midpoint as end point
|
152
|
+
xBounds.push(startPoint.x);
|
153
|
+
xBounds.push(midPoint.x);
|
154
|
+
yBounds.push(startPoint.y);
|
155
|
+
yBounds.push(midPoint.y);
|
156
|
+
|
157
|
+
p1 = points[i];
|
158
|
+
p2 = points[i+1];
|
159
|
+
startPoint = midPoint;
|
160
|
+
} // end for
|
161
|
+
|
162
|
+
xBounds.push(p1.x);
|
163
|
+
yBounds.push(p1.y);
|
164
|
+
|
165
|
+
return {
|
166
|
+
minx: utilMin(xBounds),
|
167
|
+
miny: utilMin(yBounds),
|
168
|
+
maxx: utilMax(xBounds),
|
169
|
+
maxy: utilMax(yBounds)
|
170
|
+
};
|
171
|
+
},
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Converts points to SVG path
|
175
|
+
* @method convertPointsToSVGPath
|
176
|
+
* @param {Array} points Array of points
|
177
|
+
* @return {String} SVG path
|
178
|
+
*/
|
179
|
+
convertPointsToSVGPath: function(points, minX, maxX, minY, maxY) {
|
180
|
+
var path = [];
|
181
|
+
var p1 = new fabric.Point(points[0].x - minX, points[0].y - minY);
|
182
|
+
var p2 = new fabric.Point(points[1].x - minX, points[1].y - minY);
|
183
|
+
|
184
|
+
path.push('M ', points[0].x - minX, ' ', points[0].y - minY, ' ');
|
185
|
+
for (var i = 1, len = points.length; i < len; i++) {
|
186
|
+
var midPoint = p1.midPointFrom(p2);
|
187
|
+
// p1 is our bezier control point
|
188
|
+
// midpoint is our endpoint
|
189
|
+
// start point is p(i-1) value.
|
190
|
+
path.push('Q ', p1.x, ' ', p1.y, ' ', midPoint.x, ' ', midPoint.y, ' ');
|
191
|
+
p1 = new fabric.Point(points[i].x - minX, points[i].y - minY);
|
192
|
+
if ((i+1) < points.length) {
|
193
|
+
p2 = new fabric.Point(points[i+1].x - minX, points[i+1].y - minY);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
path.push('L ', p1.x, ' ', p1.y, ' ');
|
197
|
+
return path;
|
198
|
+
},
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Creates fabric.Path object to add on canvas
|
202
|
+
* @method createPath
|
203
|
+
* @param {String} pathData Path data
|
204
|
+
* @return {fabric.Path} path to add on canvas
|
205
|
+
*/
|
206
|
+
createPath: function(pathData) {
|
207
|
+
var path = new fabric.Path(pathData);
|
208
|
+
path.fill = null;
|
209
|
+
path.stroke = this.canvas.freeDrawingColor;
|
210
|
+
path.strokeWidth = this.canvas.freeDrawingLineWidth;
|
211
|
+
return path;
|
212
|
+
},
|
213
|
+
|
214
|
+
/**
|
215
|
+
* On mouseup after drawing the path on contextTop canvas
|
216
|
+
* we use the points captured to create an new fabric path object
|
217
|
+
* and add it to the fabric canvas.
|
218
|
+
*
|
219
|
+
* @method _finalizeAndAddPath
|
220
|
+
*/
|
221
|
+
_finalizeAndAddPath: function() {
|
222
|
+
this.canvas._isCurrentlyDrawing = false;
|
223
|
+
var ctx = this.canvas.contextTop;
|
224
|
+
ctx.closePath();
|
225
|
+
|
226
|
+
var pathData = this._getSVGPathData().join('');
|
227
|
+
if (pathData === "M 0 0 Q 0 0 0 0 L 0 0") {
|
228
|
+
// do not create 0 width/height paths, as they are
|
229
|
+
// rendered inconsistently across browsers
|
230
|
+
// Firefox 4, for example, renders a dot,
|
231
|
+
// whereas Chrome 10 renders nothing
|
232
|
+
this.canvas.renderAll();
|
233
|
+
return;
|
234
|
+
}
|
235
|
+
|
236
|
+
// set path origin coordinates based on our bounding box
|
237
|
+
var originLeft = this.box.minx + (this.box.maxx - this.box.minx) /2;
|
238
|
+
var originTop = this.box.miny + (this.box.maxy - this.box.miny) /2;
|
239
|
+
|
240
|
+
this.canvas.contextTop.arc(originLeft, originTop, 3, 0, Math.PI * 2, false);
|
241
|
+
|
242
|
+
var path = this.createPath(pathData);
|
243
|
+
path.set({ left: originLeft, top: originTop });
|
244
|
+
|
245
|
+
this.canvas.add(path);
|
246
|
+
path.setCoords();
|
247
|
+
|
248
|
+
this.canvas.contextTop && this.canvas.clearContext(this.canvas.contextTop);
|
249
|
+
this.canvas.renderAll();
|
250
|
+
|
251
|
+
// fire event 'path' created
|
252
|
+
this.canvas.fire('path:created', { path: path });
|
253
|
+
}
|
254
|
+
});
|
255
|
+
|
256
|
+
})(typeof exports !== 'undefined' ? exports : this);
|
@@ -0,0 +1,211 @@
|
|
1
|
+
(function() {
|
2
|
+
|
3
|
+
function getColorStopFromStyle(el) {
|
4
|
+
var style = el.getAttribute('style');
|
5
|
+
|
6
|
+
if (style) {
|
7
|
+
var keyValuePairs = style.split(/\s*;\s*/);
|
8
|
+
|
9
|
+
if (keyValuePairs[keyValuePairs.length-1] === '') {
|
10
|
+
keyValuePairs.pop();
|
11
|
+
}
|
12
|
+
|
13
|
+
for (var i = keyValuePairs.length; i--; ) {
|
14
|
+
|
15
|
+
var split = keyValuePairs[i].split(/\s*:\s*/),
|
16
|
+
key = split[0].trim(),
|
17
|
+
value = split[1].trim();
|
18
|
+
|
19
|
+
if (key === 'stop-color') {
|
20
|
+
return value;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Gradient class
|
28
|
+
* @class Gradient
|
29
|
+
* @memberOf fabric
|
30
|
+
*/
|
31
|
+
fabric.Gradient = fabric.util.createClass(/** @scope fabric.Gradient.prototype */ {
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Constructor
|
35
|
+
* @method initialize
|
36
|
+
* @param [options] Options object with x1, y1, x2, y2 and colorStops
|
37
|
+
* @return {fabric.Gradient} thisArg
|
38
|
+
*/
|
39
|
+
initialize: function(options) {
|
40
|
+
|
41
|
+
options || (options = { });
|
42
|
+
|
43
|
+
this.x1 = options.x1 || 0;
|
44
|
+
this.y1 = options.y1 || 0;
|
45
|
+
this.x2 = options.x2 || 0;
|
46
|
+
this.y2 = options.y2 || 0;
|
47
|
+
|
48
|
+
this.colorStops = options.colorStops;
|
49
|
+
},
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Returns object representation of a gradient
|
53
|
+
* @method toObject
|
54
|
+
* @return {Object}
|
55
|
+
*/
|
56
|
+
toObject: function() {
|
57
|
+
return {
|
58
|
+
x1: this.x1,
|
59
|
+
x2: this.x2,
|
60
|
+
y1: this.y1,
|
61
|
+
y2: this.y2,
|
62
|
+
colorStops: this.colorStops
|
63
|
+
};
|
64
|
+
},
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Returns an instance of CanvasGradient
|
68
|
+
* @method toLive
|
69
|
+
* @param ctx
|
70
|
+
* @return {CanvasGradient}
|
71
|
+
*/
|
72
|
+
toLive: function(ctx) {
|
73
|
+
var gradient = ctx.createLinearGradient(
|
74
|
+
this.x1, this.y1, this.x2 || ctx.canvas.width, this.y2);
|
75
|
+
|
76
|
+
for (var position in this.colorStops) {
|
77
|
+
var colorValue = this.colorStops[position];
|
78
|
+
gradient.addColorStop(parseFloat(position), colorValue);
|
79
|
+
}
|
80
|
+
|
81
|
+
return gradient;
|
82
|
+
}
|
83
|
+
});
|
84
|
+
|
85
|
+
fabric.util.object.extend(fabric.Gradient, {
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Returns {@link fabric.Gradient} instance from an SVG element
|
89
|
+
* @method fromElement
|
90
|
+
* @static
|
91
|
+
* @memberof fabric.Gradient
|
92
|
+
* @see http://www.w3.org/TR/SVG/pservers.html#LinearGradientElement
|
93
|
+
*/
|
94
|
+
fromElement: function(el, instance) {
|
95
|
+
|
96
|
+
/**
|
97
|
+
* @example:
|
98
|
+
*
|
99
|
+
* <linearGradient id="grad1">
|
100
|
+
* <stop offset="0%" stop-color="white"/>
|
101
|
+
* <stop offset="100%" stop-color="black"/>
|
102
|
+
* </linearGradient>
|
103
|
+
*
|
104
|
+
* OR
|
105
|
+
*
|
106
|
+
* <linearGradient id="grad1">
|
107
|
+
* <stop offset="0%" style="stop-color:rgb(255,255,255)"/>
|
108
|
+
* <stop offset="100%" style="stop-color:rgb(0,0,0)"/>
|
109
|
+
* </linearGradient>
|
110
|
+
*
|
111
|
+
*/
|
112
|
+
|
113
|
+
var colorStopEls = el.getElementsByTagName('stop'),
|
114
|
+
offset,
|
115
|
+
colorStops = { },
|
116
|
+
coords = {
|
117
|
+
x1: el.getAttribute('x1') || 0,
|
118
|
+
y1: el.getAttribute('y1') || 0,
|
119
|
+
x2: el.getAttribute('x2') || '100%',
|
120
|
+
y2: el.getAttribute('y2') || 0
|
121
|
+
};
|
122
|
+
|
123
|
+
for (var i = colorStopEls.length; i--; ) {
|
124
|
+
el = colorStopEls[i];
|
125
|
+
offset = el.getAttribute('offset');
|
126
|
+
|
127
|
+
// convert percents to absolute values
|
128
|
+
offset = parseFloat(offset) / (/%$/.test(offset) ? 100 : 1);
|
129
|
+
colorStops[offset] = getColorStopFromStyle(el) || el.getAttribute('stop-color');
|
130
|
+
}
|
131
|
+
|
132
|
+
_convertPercentUnitsToValues(instance, coords);
|
133
|
+
|
134
|
+
return new fabric.Gradient({
|
135
|
+
x1: coords.x1,
|
136
|
+
y1: coords.y1,
|
137
|
+
x2: coords.x2,
|
138
|
+
y2: coords.y2,
|
139
|
+
colorStops: colorStops
|
140
|
+
});
|
141
|
+
},
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Returns {@link fabric.Gradient} instance from its object representation
|
145
|
+
* @method forObject
|
146
|
+
* @static
|
147
|
+
* @param obj
|
148
|
+
* @param [options]
|
149
|
+
* @memberof fabric.Gradient
|
150
|
+
*/
|
151
|
+
forObject: function(obj, options) {
|
152
|
+
options || (options = { });
|
153
|
+
_convertPercentUnitsToValues(obj, options);
|
154
|
+
return new fabric.Gradient(options);
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
function _convertPercentUnitsToValues(object, options) {
|
159
|
+
for (var prop in options) {
|
160
|
+
if (typeof options[prop] === 'string' && /^\d+%$/.test(options[prop])) {
|
161
|
+
var percents = parseFloat(options[prop], 10);
|
162
|
+
if (prop === 'x1' || prop === 'x2') {
|
163
|
+
options[prop] = fabric.util.toFixed(object.width * percents / 100, 2);
|
164
|
+
}
|
165
|
+
else if (prop === 'y1' || prop === 'y2') {
|
166
|
+
options[prop] = fabric.util.toFixed(object.height * percents / 100, 2);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
// normalize rendering point (should be from top/left corner rather than center of the shape)
|
170
|
+
if (prop === 'x1' || prop === 'x2') {
|
171
|
+
options[prop] -= fabric.util.toFixed(object.width / 2, 2);
|
172
|
+
}
|
173
|
+
else if (prop === 'y1' || prop === 'y2') {
|
174
|
+
options[prop] -= fabric.util.toFixed(object.height / 2, 2);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Parses an SVG document, returning all of the gradient declarations found in it
|
181
|
+
* @static
|
182
|
+
* @function
|
183
|
+
* @memberOf fabric
|
184
|
+
* @method getGradientDefs
|
185
|
+
* @param {SVGDocument} doc SVG document to parse
|
186
|
+
* @return {Object} Gradient definitions; key corresponds to element id, value -- to gradient definition element
|
187
|
+
*/
|
188
|
+
function getGradientDefs(doc) {
|
189
|
+
var linearGradientEls = doc.getElementsByTagName('linearGradient'),
|
190
|
+
radialGradientEls = doc.getElementsByTagName('radialGradient'),
|
191
|
+
el, i,
|
192
|
+
gradientDefs = { };
|
193
|
+
|
194
|
+
i = linearGradientEls.length;
|
195
|
+
for (; i--; ) {
|
196
|
+
el = linearGradientEls[i];
|
197
|
+
gradientDefs[el.getAttribute('id')] = el;
|
198
|
+
}
|
199
|
+
|
200
|
+
i = radialGradientEls.length;
|
201
|
+
for (; i--; ) {
|
202
|
+
el = radialGradientEls[i];
|
203
|
+
gradientDefs[el.getAttribute('id')] = el;
|
204
|
+
}
|
205
|
+
|
206
|
+
return gradientDefs;
|
207
|
+
}
|
208
|
+
|
209
|
+
fabric.getGradientDefs = getGradientDefs;
|
210
|
+
|
211
|
+
})();
|