fabric-rails 1.0.12 → 1.0.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/CHANGELOG.md +16 -0
  2. data/README.md +1 -1
  3. data/lib/fabric/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/event.js +1909 -0
  5. data/vendor/assets/javascripts/fabric.js +64 -16464
  6. data/vendor/assets/javascripts/fabric/HEADER.js +31 -0
  7. data/vendor/assets/javascripts/fabric/canvas.class.js +1007 -0
  8. data/vendor/assets/javascripts/fabric/canvas_animation.mixin.js +113 -0
  9. data/vendor/assets/javascripts/fabric/canvas_events.mixin.js +482 -0
  10. data/vendor/assets/javascripts/fabric/canvas_gestures.mixin.js +79 -0
  11. data/vendor/assets/javascripts/fabric/canvas_serialization.mixin.js +311 -0
  12. data/vendor/assets/javascripts/fabric/circle.class.js +182 -0
  13. data/vendor/assets/javascripts/fabric/color.class.js +284 -0
  14. data/vendor/assets/javascripts/fabric/ellipse.class.js +169 -0
  15. data/vendor/assets/javascripts/fabric/freedrawing.class.js +256 -0
  16. data/vendor/assets/javascripts/fabric/gradient.class.js +211 -0
  17. data/vendor/assets/javascripts/fabric/group.class.js +556 -0
  18. data/vendor/assets/javascripts/fabric/image.class.js +418 -0
  19. data/vendor/assets/javascripts/fabric/image_filters.js +809 -0
  20. data/vendor/assets/javascripts/fabric/intersection.class.js +178 -0
  21. data/vendor/assets/javascripts/fabric/line.class.js +188 -0
  22. data/vendor/assets/javascripts/fabric/log.js +26 -0
  23. data/vendor/assets/javascripts/fabric/node.js +149 -0
  24. data/vendor/assets/javascripts/fabric/object.class.js +1068 -0
  25. data/vendor/assets/javascripts/fabric/object_geometry.mixin.js +308 -0
  26. data/vendor/assets/javascripts/fabric/object_interactivity.mixin.js +496 -0
  27. data/vendor/assets/javascripts/fabric/object_origin.mixin.js +207 -0
  28. data/vendor/assets/javascripts/fabric/object_straightening.mixin.js +94 -0
  29. data/vendor/assets/javascripts/fabric/observable.mixin.js +91 -0
  30. data/vendor/assets/javascripts/fabric/parser.js +750 -0
  31. data/vendor/assets/javascripts/fabric/path.class.js +794 -0
  32. data/vendor/assets/javascripts/fabric/path_group.class.js +240 -0
  33. data/vendor/assets/javascripts/fabric/pattern.class.js +69 -0
  34. data/vendor/assets/javascripts/fabric/point.class.js +327 -0
  35. data/vendor/assets/javascripts/fabric/polygon.class.js +184 -0
  36. data/vendor/assets/javascripts/fabric/polyline.class.js +157 -0
  37. data/vendor/assets/javascripts/fabric/rect.class.js +298 -0
  38. data/vendor/assets/javascripts/fabric/scout.js +45 -0
  39. data/vendor/assets/javascripts/fabric/shadow.class.js +70 -0
  40. data/vendor/assets/javascripts/fabric/stateful.js +88 -0
  41. data/vendor/assets/javascripts/fabric/static_canvas.class.js +1298 -0
  42. data/vendor/assets/javascripts/fabric/text.class.js +934 -0
  43. data/vendor/assets/javascripts/fabric/triangle.class.js +108 -0
  44. data/vendor/assets/javascripts/fabric/util/anim_ease.js +360 -0
  45. data/vendor/assets/javascripts/fabric/util/dom_event.js +237 -0
  46. data/vendor/assets/javascripts/fabric/util/dom_misc.js +245 -0
  47. data/vendor/assets/javascripts/fabric/util/dom_request.js +72 -0
  48. data/vendor/assets/javascripts/fabric/util/dom_style.js +71 -0
  49. data/vendor/assets/javascripts/fabric/util/lang_array.js +250 -0
  50. data/vendor/assets/javascripts/fabric/util/lang_class.js +97 -0
  51. data/vendor/assets/javascripts/fabric/util/lang_function.js +35 -0
  52. data/vendor/assets/javascripts/fabric/util/lang_object.js +34 -0
  53. data/vendor/assets/javascripts/fabric/util/lang_string.js +60 -0
  54. data/vendor/assets/javascripts/fabric/util/misc.js +406 -0
  55. data/vendor/assets/javascripts/json2.js +491 -0
  56. metadata +53 -2
@@ -0,0 +1,108 @@
1
+ (function(global) {
2
+
3
+ "use strict";
4
+
5
+ var fabric = global.fabric || (global.fabric = { });
6
+
7
+ if (fabric.Triangle) {
8
+ fabric.warn('fabric.Triangle is already defined');
9
+ return;
10
+ }
11
+
12
+ /**
13
+ * Triangle class
14
+ * @class Triangle
15
+ * @extends fabric.Object
16
+ */
17
+ fabric.Triangle = fabric.util.createClass(fabric.Object, /** @scope fabric.Triangle.prototype */ {
18
+
19
+ /**
20
+ * Type of an object
21
+ * @property
22
+ * @type String
23
+ */
24
+ type: 'triangle',
25
+
26
+ /**
27
+ * Constructor
28
+ * @method initialize
29
+ * @param {Object} [options] Options object
30
+ * @return {Object} thisArg
31
+ */
32
+ initialize: function(options) {
33
+ options = options || { };
34
+
35
+ this.callSuper('initialize', options);
36
+
37
+ this.set('width', options.width || 100)
38
+ .set('height', options.height || 100);
39
+ },
40
+
41
+ /**
42
+ * @private
43
+ * @method _render
44
+ * @param ctx {CanvasRenderingContext2D} Context to render on
45
+ */
46
+ _render: function(ctx) {
47
+ var widthBy2 = this.width / 2,
48
+ heightBy2 = this.height / 2;
49
+
50
+ ctx.beginPath();
51
+ ctx.moveTo(-widthBy2, heightBy2);
52
+ ctx.lineTo(0, -heightBy2);
53
+ ctx.lineTo(widthBy2, heightBy2);
54
+ ctx.closePath();
55
+
56
+ if (this.fill) {
57
+ ctx.fill();
58
+ }
59
+ if (this.stroke) {
60
+ ctx.stroke();
61
+ }
62
+ },
63
+
64
+ /**
65
+ * Returns complexity of an instance
66
+ * @method complexity
67
+ * @return {Number} complexity of this instance
68
+ */
69
+ complexity: function() {
70
+ return 1;
71
+ },
72
+
73
+ /**
74
+ * Returns SVG representation of an instance
75
+ * @method toSVG
76
+ * @return {String} svg representation of an instance
77
+ */
78
+ toSVG: function() {
79
+
80
+ var widthBy2 = this.width / 2,
81
+ heightBy2 = this.height / 2;
82
+
83
+ var points = [
84
+ -widthBy2 + " " + heightBy2,
85
+ "0 " + -heightBy2,
86
+ widthBy2 + " " + heightBy2
87
+ ].join(",");
88
+
89
+ return '<polygon ' +
90
+ 'points="' + points + '" ' +
91
+ 'style="' + this.getSvgStyles() + '" ' +
92
+ 'transform="' + this.getSvgTransform() + '" ' +
93
+ '/>';
94
+ }
95
+ });
96
+
97
+ /**
98
+ * Returns fabric.Triangle instance from an object representation
99
+ * @static
100
+ * @method Canvas.Trangle.fromObject
101
+ * @param object {Object} object to create an instance from
102
+ * @return {Object} instance of Canvas.Triangle
103
+ */
104
+ fabric.Triangle.fromObject = function(object) {
105
+ return new fabric.Triangle(object);
106
+ };
107
+
108
+ })(typeof exports !== 'undefined' ? exports : this);
@@ -0,0 +1,360 @@
1
+ (function() {
2
+
3
+ /**
4
+ * Quadratic easing in
5
+ * @method easeInQuad
6
+ * @memberOf fabric.util.ease
7
+ */
8
+ function easeInQuad(t, b, c, d) {
9
+ return c*(t/=d)*t + b;
10
+ }
11
+
12
+ /**
13
+ * Quadratic easing out
14
+ * @method easeOutQuad
15
+ * @memberOf fabric.util.ease
16
+ */
17
+ function easeOutQuad(t, b, c, d) {
18
+ return -c *(t/=d)*(t-2) + b;
19
+ }
20
+
21
+ /**
22
+ * Quadratic easing in and out
23
+ * @method easeInOutQuad
24
+ * @memberOf fabric.util.ease
25
+ */
26
+ function easeInOutQuad(t, b, c, d) {
27
+ t /= (d/2);
28
+ if (t < 1) return c/2*t*t + b;
29
+ return -c/2 * ((--t)*(t-2) - 1) + b;
30
+ }
31
+
32
+ /**
33
+ * Cubic easing in
34
+ * @method easeInCubic
35
+ * @memberOf fabric.util.ease
36
+ */
37
+ function easeInCubic(t, b, c, d) {
38
+ return c*(t/=d)*t*t + b;
39
+ }
40
+
41
+ /**
42
+ * Cubic easing out
43
+ * @method easeOutCubic
44
+ * @memberOf fabric.util.ease
45
+ */
46
+ function easeOutCubic(t, b, c, d) {
47
+ return c*((t=t/d-1)*t*t + 1) + b;
48
+ }
49
+
50
+ /**
51
+ * Cubic easing in and out
52
+ * @method easeInOutCubic
53
+ * @memberOf fabric.util.ease
54
+ */
55
+ function easeInOutCubic(t, b, c, d) {
56
+ t /= d/2;
57
+ if (t < 1) return c/2*t*t*t + b;
58
+ return c/2*((t-=2)*t*t + 2) + b;
59
+ }
60
+
61
+ /**
62
+ * Quartic easing in
63
+ * @method easeInQuart
64
+ * @memberOf fabric.util.ease
65
+ */
66
+ function easeInQuart(t, b, c, d) {
67
+ return c*(t/=d)*t*t*t + b;
68
+ }
69
+
70
+ /**
71
+ * Quartic easing out
72
+ * @method easeOutQuart
73
+ * @memberOf fabric.util.ease
74
+ */
75
+ function easeOutQuart(t, b, c, d) {
76
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
77
+ }
78
+
79
+ /**
80
+ * Quartic easing in and out
81
+ * @method easeInOutQuart
82
+ * @memberOf fabric.util.ease
83
+ */
84
+ function easeInOutQuart(t, b, c, d) {
85
+ t /= d/2;
86
+ if (t < 1) return c/2*t*t*t*t + b;
87
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
88
+ }
89
+
90
+ /**
91
+ * Quintic easing in
92
+ * @method easeInQuint
93
+ * @memberOf fabric.util.ease
94
+ */
95
+ function easeInQuint(t, b, c, d) {
96
+ return c*(t/=d)*t*t*t*t + b;
97
+ }
98
+
99
+ /**
100
+ * Quintic easing out
101
+ * @method easeOutQuint
102
+ * @memberOf fabric.util.ease
103
+ */
104
+ function easeOutQuint(t, b, c, d) {
105
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
106
+ }
107
+
108
+ /**
109
+ * Quintic easing in and out
110
+ * @method easeInOutQuint
111
+ * @memberOf fabric.util.ease
112
+ */
113
+ function easeInOutQuint(t, b, c, d) {
114
+ t /= d/2;
115
+ if (t < 1) return c/2*t*t*t*t*t + b;
116
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
117
+ }
118
+
119
+ /**
120
+ * Sinusoidal easing in
121
+ * @method easeInSine
122
+ * @memberOf fabric.util.ease
123
+ */
124
+ function easeInSine(t, b, c, d) {
125
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
126
+ }
127
+
128
+ /**
129
+ * Sinusoidal easing out
130
+ * @method easeOutSine
131
+ * @memberOf fabric.util.ease
132
+ */
133
+ function easeOutSine(t, b, c, d) {
134
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
135
+ }
136
+
137
+ /**
138
+ * Sinusoidal easing in and out
139
+ * @method easeInOutSine
140
+ * @memberOf fabric.util.ease
141
+ */
142
+ function easeInOutSine(t, b, c, d) {
143
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
144
+ }
145
+
146
+ /**
147
+ * Exponential easing in
148
+ * @method easeInExpo
149
+ * @memberOf fabric.util.ease
150
+ */
151
+ function easeInExpo(t, b, c, d) {
152
+ return (t===0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
153
+ }
154
+
155
+ /**
156
+ * Exponential easing out
157
+ * @method easeOutExpo
158
+ * @memberOf fabric.util.ease
159
+ */
160
+ function easeOutExpo(t, b, c, d) {
161
+ return (t===d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
162
+ }
163
+
164
+ /**
165
+ * Exponential easing in and out
166
+ * @method easeInOutExpo
167
+ * @memberOf fabric.util.ease
168
+ */
169
+ function easeInOutExpo(t, b, c, d) {
170
+ if (t===0) return b;
171
+ if (t===d) return b+c;
172
+ t /= d/2;
173
+ if (t < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
174
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
175
+ }
176
+
177
+ /**
178
+ * Circular easing in
179
+ * @method easeInCirc
180
+ * @memberOf fabric.util.ease
181
+ */
182
+ function easeInCirc(t, b, c, d) {
183
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
184
+ }
185
+
186
+ /**
187
+ * Circular easing out
188
+ * @method easeOutCirc
189
+ * @memberOf fabric.util.ease
190
+ */
191
+ function easeOutCirc(t, b, c, d) {
192
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
193
+ }
194
+
195
+ /**
196
+ * Circular easing in and out
197
+ * @method easeInOutCirc
198
+ * @memberOf fabric.util.ease
199
+ */
200
+ function easeInOutCirc(t, b, c, d) {
201
+ t /= d/2;
202
+ if (t < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
203
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
204
+ }
205
+
206
+ /**
207
+ * Elastic easing in
208
+ * @method easeInElastic
209
+ * @memberOf fabric.util.ease
210
+ */
211
+ function easeInElastic(t, b, c, d) {
212
+ var s=1.70158;var p=0;var a=c;
213
+ if (t===0) return b;
214
+ t /= d;
215
+ if (t===1) return b+c;
216
+ if (!p) p=d*0.3;
217
+ if (a < Math.abs(c)) { a=c; s=p/4; }
218
+ else s = p/(2*Math.PI) * Math.asin (c/a);
219
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
220
+ }
221
+
222
+ /**
223
+ * Elastic easing out
224
+ * @method easeOutElastic
225
+ * @memberOf fabric.util.ease
226
+ */
227
+ function easeOutElastic(t, b, c, d) {
228
+ var s=1.70158;var p=0;var a=c;
229
+ if (t===0) return b;
230
+ t /= d;
231
+ if (t===1) return b+c;
232
+ if (!p) p=d*0.3;
233
+ if (a < Math.abs(c)) { a=c; s=p/4; }
234
+ else s = p/(2*Math.PI) * Math.asin (c/a);
235
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
236
+ }
237
+
238
+ /**
239
+ * Elastic easing in and out
240
+ * @method easeInOutElastic
241
+ * @memberOf fabric.util.ease
242
+ */
243
+ function easeInOutElastic(t, b, c, d) {
244
+ var s=1.70158;var p=0;var a=c;
245
+ if (t===0) return b;
246
+ t /= d/2;
247
+ if (t===2) return b+c;
248
+ if (!p) p=d*(0.3*1.5);
249
+ if (a < Math.abs(c)) { a=c; s=p/4; }
250
+ else s = p/(2*Math.PI) * Math.asin (c/a);
251
+ if (t < 1) return -0.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
252
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*0.5 + c + b;
253
+ }
254
+
255
+ /**
256
+ * Backwards easing in
257
+ * @method easeInBack
258
+ * @memberOf fabric.util.ease
259
+ */
260
+ function easeInBack(t, b, c, d, s) {
261
+ if (s === undefined) s = 1.70158;
262
+ return c*(t/=d)*t*((s+1)*t - s) + b;
263
+ }
264
+
265
+ /**
266
+ * Backwards easing out
267
+ * @method easeOutBack
268
+ * @memberOf fabric.util.ease
269
+ */
270
+ function easeOutBack(t, b, c, d, s) {
271
+ if (s === undefined) s = 1.70158;
272
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
273
+ }
274
+
275
+ /**
276
+ * Backwards easing in and out
277
+ * @method easeInOutBack
278
+ * @memberOf fabric.util.ease
279
+ */
280
+ function easeInOutBack(t, b, c, d, s) {
281
+ if (s === undefined) s = 1.70158;
282
+ t /= d/2;
283
+ if (t < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
284
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
285
+ }
286
+
287
+ /**
288
+ * Bouncing easing in
289
+ * @method easeInBounce
290
+ * @memberOf fabric.util.ease
291
+ */
292
+ function easeInBounce(t, b, c, d) {
293
+ return c - easeOutBounce (d-t, 0, c, d) + b;
294
+ }
295
+
296
+ /**
297
+ * Bouncing easing out
298
+ * @method easeOutBounce
299
+ * @memberOf fabric.util.ease
300
+ */
301
+ function easeOutBounce(t, b, c, d) {
302
+ if ((t/=d) < (1/2.75)) {
303
+ return c*(7.5625*t*t) + b;
304
+ } else if (t < (2/2.75)) {
305
+ return c*(7.5625*(t-=(1.5/2.75))*t + 0.75) + b;
306
+ } else if (t < (2.5/2.75)) {
307
+ return c*(7.5625*(t-=(2.25/2.75))*t + 0.9375) + b;
308
+ } else {
309
+ return c*(7.5625*(t-=(2.625/2.75))*t + 0.984375) + b;
310
+ }
311
+ }
312
+
313
+ /**
314
+ * Bouncing easing in and out
315
+ * @method easeInOutBounce
316
+ * @memberOf fabric.util.ease
317
+ */
318
+ function easeInOutBounce(t, b, c, d) {
319
+ if (t < d/2) return easeInBounce (t*2, 0, c, d) * 0.5 + b;
320
+ return easeOutBounce (t*2-d, 0, c, d) * 0.5 + c*0.5 + b;
321
+ }
322
+
323
+ /**
324
+ * See <a href="http://gizma.com/easing/">Easing Equations by Robert Penner</a>
325
+ * @namespace fabric.util.ease
326
+ */
327
+ fabric.util.ease = {
328
+ easeInQuad: easeInQuad,
329
+ easeOutQuad: easeOutQuad,
330
+ easeInOutQuad: easeInOutQuad,
331
+ easeInCubic: easeInCubic,
332
+ easeOutCubic: easeOutCubic,
333
+ easeInOutCubic: easeInOutCubic,
334
+ easeInQuart: easeInQuart,
335
+ easeOutQuart: easeOutQuart,
336
+ easeInOutQuart: easeInOutQuart,
337
+ easeInQuint: easeInQuint,
338
+ easeOutQuint: easeOutQuint,
339
+ easeInOutQuint: easeInOutQuint,
340
+ easeInSine: easeInSine,
341
+ easeOutSine: easeOutSine,
342
+ easeInOutSine: easeInOutSine,
343
+ easeInExpo: easeInExpo,
344
+ easeOutExpo: easeOutExpo,
345
+ easeInOutExpo: easeInOutExpo,
346
+ easeInCirc: easeInCirc,
347
+ easeOutCirc: easeOutCirc,
348
+ easeInOutCirc: easeInOutCirc,
349
+ easeInElastic: easeInElastic,
350
+ easeOutElastic: easeOutElastic,
351
+ easeInOutElastic: easeInOutElastic,
352
+ easeInBack: easeInBack,
353
+ easeOutBack: easeOutBack,
354
+ easeInOutBack: easeInOutBack,
355
+ easeInBounce: easeInBounce,
356
+ easeOutBounce: easeOutBounce,
357
+ easeInOutBounce: easeInOutBounce
358
+ };
359
+
360
+ }());