fabric-rails 1.0.12.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/CHANGELOG.md +4 -0
  2. data/README.md +1 -1
  3. data/lib/fabric/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/cufon.js +1226 -0
  5. data/vendor/assets/javascripts/event.js +20 -20
  6. data/vendor/assets/javascripts/excanvas.js +1464 -0
  7. data/vendor/assets/javascripts/fabric.js +56 -33
  8. data/vendor/assets/javascripts/fabric/HEADER.js +2 -4
  9. data/vendor/assets/javascripts/fabric/brushes/base_brush.class.js +96 -0
  10. data/vendor/assets/javascripts/fabric/brushes/circle_brush.class.js +99 -0
  11. data/vendor/assets/javascripts/fabric/brushes/pattern_brush.class.js +55 -0
  12. data/vendor/assets/javascripts/fabric/{freedrawing.class.js → brushes/pencil_brush.class.js} +73 -65
  13. data/vendor/assets/javascripts/fabric/brushes/spray_brush.class.js +157 -0
  14. data/vendor/assets/javascripts/fabric/canvas.class.js +154 -135
  15. data/vendor/assets/javascripts/fabric/color.class.js +195 -29
  16. data/vendor/assets/javascripts/fabric/filters/brightness_filter.class.js +70 -0
  17. data/vendor/assets/javascripts/fabric/filters/convolute_filter.class.js +122 -0
  18. data/vendor/assets/javascripts/fabric/filters/gradienttransparency_filter.class.js +69 -0
  19. data/vendor/assets/javascripts/fabric/filters/grayscale_filter.class.js +61 -0
  20. data/vendor/assets/javascripts/fabric/filters/invert_filter.class.js +57 -0
  21. data/vendor/assets/javascripts/fabric/filters/noise_filter.class.js +73 -0
  22. data/vendor/assets/javascripts/fabric/filters/pixelate_filter.class.js +98 -0
  23. data/vendor/assets/javascripts/fabric/filters/removewhite_filter.class.js +86 -0
  24. data/vendor/assets/javascripts/fabric/filters/sepia2_filter.class.js +61 -0
  25. data/vendor/assets/javascripts/fabric/filters/sepia_filter.class.js +58 -0
  26. data/vendor/assets/javascripts/fabric/filters/tint_filter.class.js +80 -0
  27. data/vendor/assets/javascripts/fabric/gradient.class.js +232 -80
  28. data/vendor/assets/javascripts/fabric/intersection.class.js +10 -28
  29. data/vendor/assets/javascripts/fabric/log.js +0 -2
  30. data/vendor/assets/javascripts/fabric/{canvas_animation.mixin.js → mixins/canvas_animation.mixin.js} +3 -6
  31. data/vendor/assets/javascripts/fabric/mixins/canvas_dataurl_exporter.mixin.js +137 -0
  32. data/vendor/assets/javascripts/fabric/{canvas_events.mixin.js → mixins/canvas_events.mixin.js} +97 -144
  33. data/vendor/assets/javascripts/fabric/{canvas_gestures.mixin.js → mixins/canvas_gestures.mixin.js} +4 -8
  34. data/vendor/assets/javascripts/fabric/{canvas_serialization.mixin.js → mixins/canvas_serialization.mixin.js} +19 -14
  35. data/vendor/assets/javascripts/fabric/mixins/collection.mixin.js +137 -0
  36. data/vendor/assets/javascripts/fabric/{object_geometry.mixin.js → mixins/object_geometry.mixin.js} +130 -47
  37. data/vendor/assets/javascripts/fabric/{object_interactivity.mixin.js → mixins/object_interactivity.mixin.js} +21 -102
  38. data/vendor/assets/javascripts/fabric/{object_origin.mixin.js → mixins/object_origin.mixin.js} +36 -26
  39. data/vendor/assets/javascripts/fabric/{object_straightening.mixin.js → mixins/object_straightening.mixin.js} +4 -9
  40. data/vendor/assets/javascripts/fabric/{observable.mixin.js → mixins/observable.mixin.js} +27 -35
  41. data/vendor/assets/javascripts/fabric/mixins/stateful.mixin.js +45 -0
  42. data/vendor/assets/javascripts/fabric/node.js +62 -26
  43. data/vendor/assets/javascripts/fabric/parser.js +181 -58
  44. data/vendor/assets/javascripts/fabric/pattern.class.js +43 -14
  45. data/vendor/assets/javascripts/fabric/point.class.js +4 -43
  46. data/vendor/assets/javascripts/fabric/shadow.class.js +19 -19
  47. data/vendor/assets/javascripts/fabric/{circle.class.js → shapes/circle.class.js} +32 -29
  48. data/vendor/assets/javascripts/fabric/{ellipse.class.js → shapes/ellipse.class.js} +45 -27
  49. data/vendor/assets/javascripts/fabric/{group.class.js → shapes/group.class.js} +67 -169
  50. data/vendor/assets/javascripts/fabric/{image.class.js → shapes/image.class.js} +134 -72
  51. data/vendor/assets/javascripts/fabric/{line.class.js → shapes/line.class.js} +67 -36
  52. data/vendor/assets/javascripts/fabric/{object.class.js → shapes/object.class.js} +394 -252
  53. data/vendor/assets/javascripts/fabric/{path.class.js → shapes/path.class.js} +89 -174
  54. data/vendor/assets/javascripts/fabric/{path_group.class.js → shapes/path_group.class.js} +12 -18
  55. data/vendor/assets/javascripts/fabric/{polygon.class.js → shapes/polygon.class.js} +64 -38
  56. data/vendor/assets/javascripts/fabric/{polyline.class.js → shapes/polyline.class.js} +64 -39
  57. data/vendor/assets/javascripts/fabric/{rect.class.js → shapes/rect.class.js} +78 -112
  58. data/vendor/assets/javascripts/fabric/{text.class.js → shapes/text.class.js} +264 -270
  59. data/vendor/assets/javascripts/fabric/shapes/text.cufon.js +79 -0
  60. data/vendor/assets/javascripts/fabric/{triangle.class.js → shapes/triangle.class.js} +46 -26
  61. data/vendor/assets/javascripts/fabric/static_canvas.class.js +134 -358
  62. data/vendor/assets/javascripts/fabric/util/anim_ease.js +2 -31
  63. data/vendor/assets/javascripts/fabric/util/dom_event.js +21 -7
  64. data/vendor/assets/javascripts/fabric/util/dom_misc.js +49 -39
  65. data/vendor/assets/javascripts/fabric/util/dom_request.js +1 -2
  66. data/vendor/assets/javascripts/fabric/util/dom_style.js +1 -2
  67. data/vendor/assets/javascripts/fabric/util/lang_array.js +19 -13
  68. data/vendor/assets/javascripts/fabric/util/lang_class.js +1 -2
  69. data/vendor/assets/javascripts/fabric/util/lang_function.js +3 -1
  70. data/vendor/assets/javascripts/fabric/util/lang_object.js +5 -5
  71. data/vendor/assets/javascripts/fabric/util/lang_string.js +7 -5
  72. data/vendor/assets/javascripts/fabric/util/misc.js +207 -42
  73. metadata +47 -29
  74. data/vendor/assets/javascripts/fabric/image_filters.js +0 -809
  75. data/vendor/assets/javascripts/fabric/scout.js +0 -45
  76. data/vendor/assets/javascripts/fabric/stateful.js +0 -88
@@ -12,119 +12,14 @@
12
12
  a: 7
13
13
  };
14
14
 
15
- function drawArc(ctx, x, y, coords) {
16
- var rx = coords[0];
17
- var ry = coords[1];
18
- var rot = coords[2];
19
- var large = coords[3];
20
- var sweep = coords[4];
21
- var ex = coords[5];
22
- var ey = coords[6];
23
- var segs = arcToSegments(ex, ey, rx, ry, large, sweep, rot, x, y);
24
- for (var i=0; i<segs.length; i++) {
25
- var bez = segmentToBezier.apply(this, segs[i]);
26
- ctx.bezierCurveTo.apply(ctx, bez);
27
- }
28
- }
29
-
30
- var arcToSegmentsCache = { },
31
- segmentToBezierCache = { },
32
- _join = Array.prototype.join,
33
- argsString;
34
-
35
- // Generous contribution by Raph Levien, from libsvg-0.1.0.tar.gz
36
- function arcToSegments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
37
- argsString = _join.call(arguments);
38
- if (arcToSegmentsCache[argsString]) {
39
- return arcToSegmentsCache[argsString];
40
- }
41
-
42
- var th = rotateX * (Math.PI/180);
43
- var sin_th = Math.sin(th);
44
- var cos_th = Math.cos(th);
45
- rx = Math.abs(rx);
46
- ry = Math.abs(ry);
47
- var px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5;
48
- var py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5;
49
- var pl = (px*px) / (rx*rx) + (py*py) / (ry*ry);
50
- if (pl > 1) {
51
- pl = Math.sqrt(pl);
52
- rx *= pl;
53
- ry *= pl;
54
- }
55
-
56
- var a00 = cos_th / rx;
57
- var a01 = sin_th / rx;
58
- var a10 = (-sin_th) / ry;
59
- var a11 = (cos_th) / ry;
60
- var x0 = a00 * ox + a01 * oy;
61
- var y0 = a10 * ox + a11 * oy;
62
- var x1 = a00 * x + a01 * y;
63
- var y1 = a10 * x + a11 * y;
64
-
65
- var d = (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0);
66
- var sfactor_sq = 1 / d - 0.25;
67
- if (sfactor_sq < 0) sfactor_sq = 0;
68
- var sfactor = Math.sqrt(sfactor_sq);
69
- if (sweep === large) sfactor = -sfactor;
70
- var xc = 0.5 * (x0 + x1) - sfactor * (y1-y0);
71
- var yc = 0.5 * (y0 + y1) + sfactor * (x1-x0);
72
-
73
- var th0 = Math.atan2(y0-yc, x0-xc);
74
- var th1 = Math.atan2(y1-yc, x1-xc);
75
-
76
- var th_arc = th1-th0;
77
- if (th_arc < 0 && sweep === 1){
78
- th_arc += 2*Math.PI;
79
- } else if (th_arc > 0 && sweep === 0) {
80
- th_arc -= 2 * Math.PI;
81
- }
82
-
83
- var segments = Math.ceil(Math.abs(th_arc / (Math.PI * 0.5 + 0.001)));
84
- var result = [];
85
- for (var i=0; i<segments; i++) {
86
- var th2 = th0 + i * th_arc / segments;
87
- var th3 = th0 + (i+1) * th_arc / segments;
88
- result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th];
89
- }
90
-
91
- return (arcToSegmentsCache[argsString] = result);
92
- }
93
-
94
- function segmentToBezier(cx, cy, th0, th1, rx, ry, sin_th, cos_th) {
95
- argsString = _join.call(arguments);
96
- if (segmentToBezierCache[argsString]) {
97
- return segmentToBezierCache[argsString];
98
- }
99
-
100
- var a00 = cos_th * rx;
101
- var a01 = -sin_th * ry;
102
- var a10 = sin_th * rx;
103
- var a11 = cos_th * ry;
104
-
105
- var th_half = 0.5 * (th1 - th0);
106
- var t = (8/3) * Math.sin(th_half * 0.5) * Math.sin(th_half * 0.5) / Math.sin(th_half);
107
- var x1 = cx + Math.cos(th0) - t * Math.sin(th0);
108
- var y1 = cy + Math.sin(th0) + t * Math.cos(th0);
109
- var x3 = cx + Math.cos(th1);
110
- var y3 = cy + Math.sin(th1);
111
- var x2 = x3 + t * Math.sin(th1);
112
- var y2 = y3 - t * Math.cos(th1);
113
-
114
- return (segmentToBezierCache[argsString] = [
115
- a00 * x1 + a01 * y1, a10 * x1 + a11 * y1,
116
- a00 * x2 + a01 * y2, a10 * x2 + a11 * y2,
117
- a00 * x3 + a01 * y3, a10 * x3 + a11 * y3
118
- ]);
119
- }
120
-
121
15
  "use strict";
122
16
 
123
17
  var fabric = global.fabric || (global.fabric = { }),
124
18
  min = fabric.util.array.min,
125
19
  max = fabric.util.array.max,
126
20
  extend = fabric.util.object.extend,
127
- _toString = Object.prototype.toString;
21
+ _toString = Object.prototype.toString,
22
+ drawArc = fabric.util.drawArc;
128
23
 
129
24
  if (fabric.Path) {
130
25
  fabric.warn('fabric.Path is already defined');
@@ -153,23 +48,23 @@
153
48
 
154
49
  /**
155
50
  * Path class
156
- * @class Path
51
+ * @class fabric.Path
157
52
  * @extends fabric.Object
158
53
  */
159
- fabric.Path = fabric.util.createClass(fabric.Object, /** @scope fabric.Path.prototype */ {
54
+ fabric.Path = fabric.util.createClass(fabric.Object, /** @lends fabric.Path.prototype */ {
160
55
 
161
56
  /**
162
57
  * Type of an object
163
- * @property
164
58
  * @type String
59
+ * @default
165
60
  */
166
61
  type: 'path',
167
62
 
168
63
  /**
169
64
  * Constructor
170
- * @method initialize
171
65
  * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens)
172
66
  * @param {Object} [options] Options object
67
+ * @return {fabric.Path} thisArg
173
68
  */
174
69
  initialize: function(path, options) {
175
70
  options = options || { };
@@ -201,13 +96,15 @@
201
96
 
202
97
  /**
203
98
  * @private
204
- * @method _initializePath
99
+ * @param {Object} [options] Options object
205
100
  */
206
101
  _initializePath: function (options) {
207
- var isWidthSet = 'width' in options,
208
- isHeightSet = 'height' in options,
102
+ var isWidthSet = 'width' in options && options.width != null,
103
+ isHeightSet = 'height' in options && options.width != null,
209
104
  isLeftSet = 'left' in options,
210
- isTopSet = 'top' in options;
105
+ isTopSet = 'top' in options,
106
+ origLeft = isLeftSet ? this.left : 0,
107
+ origTop = isTopSet ? this.top : 0;
211
108
 
212
109
  if (!isWidthSet || !isHeightSet) {
213
110
  extend(this, this._parseDimensions());
@@ -226,23 +123,23 @@
226
123
  this.left = this.width / 2;
227
124
  }
228
125
  }
229
- this.pathOffset = this._calculatePathOffset(isTopSet || isLeftSet); //Save top-left coords as offset
126
+ this.pathOffset = this.pathOffset || this._calculatePathOffset(origLeft, origTop); //Save top-left coords as offset
230
127
  },
231
128
 
232
129
  /**
233
130
  * @private
234
- * @method _calculatePathOffset
131
+ * @param {Boolean} positionSet When false, path offset is returned otherwise 0
235
132
  */
236
- _calculatePathOffset: function (positionSet) {
133
+ _calculatePathOffset: function (origLeft, origTop) {
237
134
  return {
238
- x: positionSet ? 0 : this.left - (this.width / 2),
239
- y: positionSet ? 0 : this.top - (this.height / 2)
135
+ x: this.left - origLeft - (this.width / 2),
136
+ y: this.top - origTop - (this.height / 2)
240
137
  };
241
138
  },
242
139
 
243
140
  /**
244
141
  * @private
245
- * @method _render
142
+ * @param {CanvasRenderingContext2D} ctx context to render path on
246
143
  */
247
144
  _render: function(ctx) {
248
145
  var current, // current instruction
@@ -524,11 +421,13 @@
524
421
 
525
422
  /**
526
423
  * Renders path on a specified context
527
- * @method render
528
424
  * @param {CanvasRenderingContext2D} ctx context to render path on
529
- * @param {Boolean} noTransform When true, context is not transformed
425
+ * @param {Boolean} [noTransform] When true, context is not transformed
530
426
  */
531
427
  render: function(ctx, noTransform) {
428
+ // do not render if object is not visible
429
+ if (!this.visible) return;
430
+
532
431
  ctx.save();
533
432
  var m = this.transformMatrix;
534
433
  if (m) {
@@ -549,26 +448,25 @@
549
448
  }
550
449
 
551
450
  if (this.stroke) {
451
+ ctx.lineWidth = this.strokeWidth;
452
+ ctx.lineCap = this.strokeLineCap;
453
+ ctx.lineJoin = this.strokeLineJoin;
454
+ ctx.miterLimit = this.strokeMiterLimit;
552
455
  ctx.strokeStyle = this.stroke.toLive
553
456
  ? this.stroke.toLive(ctx)
554
457
  : this.stroke;
555
458
  }
556
- ctx.beginPath();
557
459
 
558
460
  this._setShadow(ctx);
559
- this._render(ctx);
461
+ this.clipTo && fabric.util.clipContext(this, ctx);
462
+ ctx.beginPath();
560
463
 
561
- if (this.fill) {
562
- ctx.fill();
563
- }
464
+ this._render(ctx);
465
+ this._renderFill(ctx);
466
+ this._renderStroke(ctx);
467
+ this.clipTo && ctx.restore();
564
468
  this._removeShadow(ctx);
565
469
 
566
- if (this.stroke) {
567
- ctx.strokeStyle = this.stroke;
568
- ctx.lineWidth = this.strokeWidth;
569
- ctx.lineCap = ctx.lineJoin = 'round';
570
- ctx.stroke();
571
- }
572
470
  if (!noTransform && this.active) {
573
471
  this.drawBorders(ctx);
574
472
  this.drawControls(ctx);
@@ -578,7 +476,6 @@
578
476
 
579
477
  /**
580
478
  * Returns string representation of an instance
581
- * @method toString
582
479
  * @return {String} string representation of an instance
583
480
  */
584
481
  toString: function() {
@@ -588,13 +485,13 @@
588
485
 
589
486
  /**
590
487
  * Returns object representation of an instance
591
- * @method toObject
592
- * @param {Array} propertiesToInclude
488
+ * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
593
489
  * @return {Object} object representation of an instance
594
490
  */
595
491
  toObject: function(propertiesToInclude) {
596
492
  var o = extend(this.callSuper('toObject', propertiesToInclude), {
597
- path: this.path
493
+ path: this.path,
494
+ pathOffset: this.pathOffset
598
495
  });
599
496
  if (this.sourcePath) {
600
497
  o.sourcePath = this.sourcePath;
@@ -607,8 +504,7 @@
607
504
 
608
505
  /**
609
506
  * Returns dataless object representation of an instance
610
- * @method toDatalessObject
611
- * @param {Array} propertiesToInclude
507
+ * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output
612
508
  * @return {Object} object representation of an instance
613
509
  */
614
510
  toDatalessObject: function(propertiesToInclude) {
@@ -620,32 +516,45 @@
620
516
  return o;
621
517
  },
622
518
 
519
+ /* _TO_SVG_START_ */
623
520
  /**
624
521
  * Returns svg representation of an instance
625
- * @method toSVG
626
522
  * @return {String} svg representation of an instance
627
523
  */
628
524
  toSVG: function() {
629
- var chunks = [];
525
+ var chunks = [],
526
+ markup = [];
527
+
630
528
  for (var i = 0, len = this.path.length; i < len; i++) {
631
529
  chunks.push(this.path[i].join(' '));
632
530
  }
633
531
  var path = chunks.join(' ');
634
532
 
635
- return [
533
+ if (this.fill && this.fill.toLive) {
534
+ markup.push(this.fill.toSVG(this, true));
535
+ }
536
+ if (this.stroke && this.stroke.toLive) {
537
+ markup.push(this.stroke.toSVG(this, true));
538
+ }
539
+
540
+ markup.push(
636
541
  '<g transform="', (this.group ? '' : this.getSvgTransform()), '">',
637
542
  '<path ',
638
- 'd="', path, '" ',
639
- 'style="', this.getSvgStyles(), '" ',
640
- 'transform="translate(', (-this.width / 2), ' ', (-this.height/2), ')" />',
543
+ 'd="', path,
544
+ '" style="', this.getSvgStyles(),
545
+ '" transform="translate(', (-this.width / 2), ' ', (-this.height/2), ')',
546
+ '" stroke-linecap="round" ',
547
+ '/>',
641
548
  '</g>'
642
- ].join('');
549
+ );
550
+
551
+ return markup.join('');
643
552
  },
553
+ /* _TO_SVG_END_ */
644
554
 
645
555
  /**
646
556
  * Returns number representation of an instance complexity
647
- * @method complexity
648
- * @return {Number} complexity
557
+ * @return {Number} complexity of this instance
649
558
  */
650
559
  complexity: function() {
651
560
  return this.path.length;
@@ -653,36 +562,45 @@
653
562
 
654
563
  /**
655
564
  * @private
656
- * @method _parsePath
657
565
  */
658
566
  _parsePath: function() {
659
567
  var result = [ ],
568
+ coords = [ ],
660
569
  currentPath,
661
- chunks,
662
- parsed;
570
+ parsed,
571
+ re = /(-?\.\d+)|(-?\d+(\.\d+)?)/g,
572
+ match,
573
+ coordsStr;
663
574
 
664
- for (var i = 0, chunksParsed, len = this.path.length; i < len; i++) {
575
+ for (var i = 0, coordsParsed, len = this.path.length; i < len; i++) {
665
576
  currentPath = this.path[i];
666
- chunks = currentPath.slice(1).trim().replace(/(\d)-/g, '$1###-').split(/\s|,|###/);
667
- chunksParsed = [ currentPath.charAt(0) ];
668
577
 
669
- for (var j = 0, jlen = chunks.length; j < jlen; j++) {
670
- parsed = parseFloat(chunks[j]);
578
+ coordsStr = currentPath.slice(1).trim();
579
+ coords.length = 0;
580
+
581
+ while ((match = re.exec(coordsStr))) {
582
+ coords.push(match[0]);
583
+ }
584
+
585
+ coordsParsed = [ currentPath.charAt(0) ];
586
+
587
+ for (var j = 0, jlen = coords.length; j < jlen; j++) {
588
+ parsed = parseFloat(coords[j]);
671
589
  if (!isNaN(parsed)) {
672
- chunksParsed.push(parsed);
590
+ coordsParsed.push(parsed);
673
591
  }
674
592
  }
675
593
 
676
- var command = chunksParsed[0].toLowerCase(),
594
+ var command = coordsParsed[0].toLowerCase(),
677
595
  commandLength = commandLengths[command];
678
596
 
679
- if (chunksParsed.length - 1 > commandLength) {
680
- for (var k = 1, klen = chunksParsed.length; k < klen; k += commandLength) {
681
- result.push([ chunksParsed[0] ].concat(chunksParsed.slice(k, k + commandLength)));
597
+ if (coordsParsed.length - 1 > commandLength) {
598
+ for (var k = 1, klen = coordsParsed.length; k < klen; k += commandLength) {
599
+ result.push([ coordsParsed[0] ].concat(coordsParsed.slice(k, k + commandLength)));
682
600
  }
683
601
  }
684
602
  else {
685
- result.push(chunksParsed);
603
+ result.push(coordsParsed);
686
604
  }
687
605
  }
688
606
 
@@ -690,7 +608,7 @@
690
608
  },
691
609
 
692
610
  /**
693
- * @method _parseDimensions
611
+ * @private
694
612
  */
695
613
  _parseDimensions: function() {
696
614
  var aX = [],
@@ -748,15 +666,12 @@
748
666
  deltaY = maxY - minY;
749
667
 
750
668
  var o = {
751
- top: minY + deltaY / 2,
752
- left: minX + deltaX / 2,
753
- bottom: max(aY) - deltaY,
754
- right: max(aX) - deltaX
669
+ left: this.left + (minX + deltaX / 2),
670
+ top: this.top + (minY + deltaY / 2),
671
+ width: deltaX,
672
+ height: deltaY
755
673
  };
756
674
 
757
- o.width = deltaX;
758
- o.height = deltaY;
759
-
760
675
  return o;
761
676
  }
762
677
  });
@@ -764,24 +679,23 @@
764
679
  /**
765
680
  * Creates an instance of fabric.Path from an object
766
681
  * @static
767
- * @method fabric.Path.fromObject
768
682
  * @return {fabric.Path} Instance of fabric.Path
769
683
  */
770
684
  fabric.Path.fromObject = function(object) {
771
685
  return new fabric.Path(object.path, object);
772
686
  };
773
687
 
688
+ /* _FROM_SVG_START_ */
774
689
  /**
775
690
  * List of attribute names to account for when parsing SVG element (used by `fabric.Path.fromElement`)
776
691
  * @static
777
692
  * @see http://www.w3.org/TR/SVG/paths.html#PathElement
778
693
  */
779
- fabric.Path.ATTRIBUTE_NAMES = 'd fill fill-opacity opacity fill-rule stroke stroke-width transform'.split(' ');
694
+ fabric.Path.ATTRIBUTE_NAMES = fabric.SHARED_ATTRIBUTES.concat(['d']);
780
695
 
781
696
  /**
782
697
  * Creates an instance of fabric.Path from an SVG <path> element
783
698
  * @static
784
- * @method fabric.Path.fromElement
785
699
  * @param {SVGElement} element to parse
786
700
  * @param {Object} [options] Options object
787
701
  * @return {fabric.Path} Instance of fabric.Path
@@ -790,5 +704,6 @@
790
704
  var parsedAttributes = fabric.parseAttributes(element, fabric.Path.ATTRIBUTE_NAMES);
791
705
  return new fabric.Path(parsedAttributes.d, extend(parsedAttributes, options));
792
706
  };
707
+ /* _FROM_SVG_END_ */
793
708
 
794
709
  })(typeof exports !== 'undefined' ? exports : this);