fabric-rails 0.0.6 → 0.0.7

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.7 (4 September 2012)
2
+
3
+ - fabric.js version 0.9.5
4
+
1
5
  ## 0.0.6 (27 August 2012)
2
6
 
3
7
  - fabric.js version 0.9.3
data/Gemfile.lock CHANGED
@@ -1,36 +1,36 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fabric-rails (0.0.6)
4
+ fabric-rails (0.0.7)
5
5
  railties (>= 3.2.0, < 5.0)
6
6
  thor (~> 0.14)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- actionpack (3.2.8)
12
- activemodel (= 3.2.8)
13
- activesupport (= 3.2.8)
11
+ actionpack (3.2.1)
12
+ activemodel (= 3.2.1)
13
+ activesupport (= 3.2.1)
14
14
  builder (~> 3.0.0)
15
15
  erubis (~> 2.7.0)
16
- journey (~> 1.0.4)
16
+ journey (~> 1.0.1)
17
17
  rack (~> 1.4.0)
18
- rack-cache (~> 1.2)
18
+ rack-cache (~> 1.1)
19
19
  rack-test (~> 0.6.1)
20
- sprockets (~> 2.1.3)
21
- activemodel (3.2.8)
22
- activesupport (= 3.2.8)
20
+ sprockets (~> 2.1.2)
21
+ activemodel (3.2.1)
22
+ activesupport (= 3.2.1)
23
23
  builder (~> 3.0.0)
24
- activesupport (3.2.8)
24
+ activesupport (3.2.1)
25
25
  i18n (~> 0.6)
26
26
  multi_json (~> 1.0)
27
27
  builder (3.0.0)
28
28
  erubis (2.7.0)
29
29
  hike (1.2.1)
30
30
  i18n (0.6.0)
31
- journey (1.0.4)
32
- json (1.7.5)
33
- multi_json (1.3.6)
31
+ journey (1.0.3)
32
+ json (1.6.5)
33
+ multi_json (1.1.0)
34
34
  rack (1.4.1)
35
35
  rack-cache (1.2)
36
36
  rack (>= 0.4)
@@ -38,21 +38,21 @@ GEM
38
38
  rack
39
39
  rack-test (0.6.1)
40
40
  rack (>= 1.0)
41
- railties (3.2.8)
42
- actionpack (= 3.2.8)
43
- activesupport (= 3.2.8)
41
+ railties (3.2.1)
42
+ actionpack (= 3.2.1)
43
+ activesupport (= 3.2.1)
44
44
  rack-ssl (~> 1.3.2)
45
45
  rake (>= 0.8.7)
46
46
  rdoc (~> 3.4)
47
- thor (>= 0.14.6, < 2.0)
47
+ thor (~> 0.14.6)
48
48
  rake (0.9.2.2)
49
49
  rdoc (3.12)
50
50
  json (~> 1.4)
51
- sprockets (2.1.3)
51
+ sprockets (2.1.2)
52
52
  hike (~> 1.2)
53
53
  rack (~> 1.0)
54
54
  tilt (~> 1.1, != 1.3.0)
55
- thor (0.16.0)
55
+ thor (0.14.6)
56
56
  tilt (1.3.3)
57
57
 
58
58
  PLATFORMS
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  This gem provides:
6
6
 
7
- * fabric.js 0.9.3
7
+ * fabric.js 0.9.5
8
8
 
9
9
  ## Installation
10
10
 
@@ -1,6 +1,6 @@
1
1
  module Fabric
2
2
  module Rails
3
- VERSION = "0.0.6"
4
- FABRIC_VERSION = "0.9.3"
3
+ VERSION = "0.0.7"
4
+ FABRIC_VERSION = "0.9.5"
5
5
  end
6
6
  end
@@ -1,7 +1,7 @@
1
1
  /* build: `node build.js modules=ALL` */
2
2
  /*! Fabric.js Copyright 2008-2012, Printio (Juriy Zaytsev, Maxim Chernyak) */
3
3
 
4
- var fabric = fabric || { version: "0.9.3" };
4
+ var fabric = fabric || { version: "0.9.5" };
5
5
 
6
6
  if (typeof exports != 'undefined') {
7
7
  exports.fabric = fabric;
@@ -1984,14 +1984,17 @@ fabric.Observable.off = fabric.Observable.stopObserving;
1984
1984
  return fabric[fabric.util.string.camelize(fabric.util.string.capitalize(type))];
1985
1985
  }
1986
1986
 
1987
- var enlivenedObjects = [ ],
1988
- numLoadedAsyncObjects = 0,
1989
- // get length of all images
1990
- numTotalAsyncObjects = objects.filter(function (o) {
1991
- return getKlass(o.type).async;
1992
- }).length;
1987
+ function onLoaded() {
1988
+ if (++numLoadedObjects === numTotalObjects) {
1989
+ if (callback) {
1990
+ callback(enlivenedObjects);
1991
+ }
1992
+ }
1993
+ }
1993
1994
 
1994
- var _this = this;
1995
+ var enlivenedObjects = [ ],
1996
+ numLoadedObjects = 0,
1997
+ numTotalObjects = objects.length;
1995
1998
 
1996
1999
  objects.forEach(function (o, index) {
1997
2000
  if (!o.type) {
@@ -2001,21 +2004,14 @@ fabric.Observable.off = fabric.Observable.stopObserving;
2001
2004
  if (klass.async) {
2002
2005
  klass.fromObject(o, function (o) {
2003
2006
  enlivenedObjects[index] = o;
2004
- if (++numLoadedAsyncObjects === numTotalAsyncObjects) {
2005
- if (callback) {
2006
- callback(enlivenedObjects);
2007
- }
2008
- }
2007
+ onLoaded();
2009
2008
  });
2010
2009
  }
2011
2010
  else {
2012
2011
  enlivenedObjects[index] = klass.fromObject(o);
2012
+ onLoaded();
2013
2013
  }
2014
2014
  });
2015
-
2016
- if (numTotalAsyncObjects === 0 && callback) {
2017
- callback(enlivenedObjects);
2018
- }
2019
2015
  }
2020
2016
 
2021
2017
  function groupSVGElements(elements, options, path) {
@@ -4957,6 +4953,13 @@ fabric.util.string = {
4957
4953
  */
4958
4954
  clipTo: null,
4959
4955
 
4956
+ /**
4957
+ * Indicates whether object controls (borders/corners) are rendered above overlay image
4958
+ * @property
4959
+ * @type Boolean
4960
+ */
4961
+ controlsAboveOverlay: false,
4962
+
4960
4963
  /**
4961
4964
  * Callback; invoked right before object is about to be scaled/rotated
4962
4965
  * @method onBeforeScaleRotate
@@ -5212,7 +5215,18 @@ fabric.util.string = {
5212
5215
  * @private
5213
5216
  */
5214
5217
  _draw: function (ctx, object) {
5215
- object && object.render(ctx);
5218
+ if (!object) return;
5219
+
5220
+ if (this.controlsAboveOverlay) {
5221
+ var hasBorders = object.hasBorders, hasCorners = object.hasCorners;
5222
+ object.hasBorders = object.hasCorners = false;
5223
+ object.render(ctx);
5224
+ object.hasBorders = hasBorders;
5225
+ object.hasCorners = hasCorners;
5226
+ }
5227
+ else {
5228
+ object.render(ctx);
5229
+ }
5216
5230
  },
5217
5231
 
5218
5232
  /**
@@ -5375,7 +5389,11 @@ fabric.util.string = {
5375
5389
  }
5376
5390
 
5377
5391
  if (this.overlayImage) {
5378
- (this.contextTop || this.contextContainer).drawImage(this.overlayImage, 0, 0);
5392
+ this.contextContainer.drawImage(this.overlayImage, 0, 0);
5393
+ }
5394
+
5395
+ if (this.controlsAboveOverlay) {
5396
+ this.drawControls(this.contextContainer);
5379
5397
  }
5380
5398
 
5381
5399
  if (this.onFpsUpdate) {
@@ -5399,7 +5417,7 @@ fabric.util.string = {
5399
5417
  this.clearContext(this.contextTop || this.contextContainer);
5400
5418
 
5401
5419
  if (this.overlayImage) {
5402
- (this.contextTop || this.contextContainer).drawImage(this.overlayImage, 0, 0);
5420
+ this.contextContainer.drawImage(this.overlayImage, 0, 0);
5403
5421
  }
5404
5422
 
5405
5423
  // we render the top context - last object
@@ -5419,6 +5437,31 @@ fabric.util.string = {
5419
5437
  return this;
5420
5438
  },
5421
5439
 
5440
+ /**
5441
+ * Draws objects' controls (borders/corners)
5442
+ * @method drawControls
5443
+ * @param {Object} ctx context to render controls on
5444
+ */
5445
+ drawControls: function(ctx) {
5446
+ var activeGroup = this.getActiveGroup();
5447
+ if (activeGroup) {
5448
+ ctx.save();
5449
+ fabric.Group.prototype.transform.call(activeGroup, ctx);
5450
+ activeGroup.drawBorders(ctx).drawCorners(ctx);
5451
+ ctx.restore();
5452
+ }
5453
+ else {
5454
+ for (var i = 0, len = this._objects.length; i < len; ++i) {
5455
+ if (!this._objects[i].active) continue;
5456
+
5457
+ ctx.save();
5458
+ fabric.Object.prototype.transform.call(this._objects[i], ctx);
5459
+ this._objects[i].drawBorders(ctx).drawCorners(ctx);
5460
+ ctx.restore();
5461
+ }
5462
+ }
5463
+ },
5464
+
5422
5465
  /**
5423
5466
  * Exports canvas element to a dataurl image.
5424
5467
  * @method toDataURL
@@ -6502,7 +6545,7 @@ fabric.util.string = {
6502
6545
  ey: pointer.y,
6503
6546
  left: target.left,
6504
6547
  top: target.top,
6505
- theta: target.theta,
6548
+ theta: target._theta,
6506
6549
  width: target.width * target.scaleX
6507
6550
  };
6508
6551
 
@@ -6705,7 +6748,7 @@ fabric.util.string = {
6705
6748
  var lastAngle = atan2(t.ey - t.top - o.top, t.ex - t.left - o.left),
6706
6749
  curAngle = atan2(y - t.top - o.top, x - t.left - o.left);
6707
6750
 
6708
- t.target.set('theta', (curAngle - lastAngle) + t.theta);
6751
+ t.target._theta = (curAngle - lastAngle) + t.theta;
6709
6752
  },
6710
6753
 
6711
6754
  /**
@@ -7486,58 +7529,141 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7486
7529
 
7487
7530
  /**
7488
7531
  * @property
7489
- * @type Boolean
7532
+ * @type Number
7490
7533
  */
7491
- includeDefaultValues: true,
7534
+ top: 0,
7492
7535
 
7493
7536
  /**
7494
- * @constant
7537
+ * @property
7495
7538
  * @type Number
7496
7539
  */
7497
- NUM_FRACTION_DIGITS: 2,
7540
+ left: 0,
7498
7541
 
7499
7542
  /**
7500
- * @constant
7543
+ * @property
7501
7544
  * @type Number
7502
7545
  */
7503
- MIN_SCALE_LIMIT: 0.1,
7546
+ width: 0,
7504
7547
 
7505
7548
  /**
7506
- * List of properties to consider when checking if state of an object is changed (fabric.Object#hasStateChanged);
7507
- * as well as for history (undo/redo) purposes
7508
7549
  * @property
7509
- * @type Array
7550
+ * @type Number
7510
7551
  */
7511
- stateProperties: (
7512
- 'top left width height scaleX scaleY flipX flipY ' +
7513
- 'theta angle opacity cornersize fill overlayFill ' +
7514
- 'stroke strokeWidth strokeDashArray fillRule ' +
7515
- 'borderScaleFactor transformMatrix selectable'
7516
- ).split(' '),
7517
-
7518
- top: 0,
7519
- left: 0,
7520
- width: 0,
7521
7552
  height: 0,
7553
+
7554
+ /**
7555
+ * @property
7556
+ * @type Number
7557
+ */
7522
7558
  scaleX: 1,
7559
+
7560
+ /**
7561
+ * @property
7562
+ * @type Number
7563
+ */
7523
7564
  scaleY: 1,
7565
+
7566
+ /**
7567
+ * @property
7568
+ * @type Boolean
7569
+ */
7524
7570
  flipX: false,
7571
+
7572
+ /**
7573
+ * @property
7574
+ * @type Boolean
7575
+ */
7525
7576
  flipY: false,
7526
- theta: 0,
7577
+
7578
+ /**
7579
+ * @property
7580
+ * @type Number
7581
+ */
7527
7582
  opacity: 1,
7583
+
7584
+ /**
7585
+ * @property
7586
+ * @type Number
7587
+ */
7528
7588
  angle: 0,
7589
+
7590
+ /**
7591
+ * @property
7592
+ * @type Number
7593
+ */
7529
7594
  cornersize: 12,
7595
+
7596
+ /**
7597
+ * @property
7598
+ * @type Number
7599
+ */
7530
7600
  padding: 0,
7601
+
7602
+ /**
7603
+ * @property
7604
+ * @type String
7605
+ */
7531
7606
  borderColor: 'rgba(102,153,255,0.75)',
7607
+
7608
+ /**
7609
+ * @property
7610
+ * @type String
7611
+ */
7532
7612
  cornerColor: 'rgba(102,153,255,0.5)',
7613
+
7614
+ /**
7615
+ * @property
7616
+ * @type String
7617
+ */
7533
7618
  fill: 'rgb(0,0,0)',
7619
+
7620
+ /**
7621
+ * @property
7622
+ * @type String
7623
+ */
7534
7624
  fillRule: 'source-over',
7625
+
7626
+ /**
7627
+ * @property
7628
+ * @type String
7629
+ */
7535
7630
  overlayFill: null,
7631
+
7632
+ /**
7633
+ * @property
7634
+ * @type String
7635
+ */
7536
7636
  stroke: null,
7637
+
7638
+ /**
7639
+ * @property
7640
+ * @type Number
7641
+ */
7537
7642
  strokeWidth: 1,
7643
+
7644
+ /**
7645
+ * @property
7646
+ * @type Array
7647
+ */
7538
7648
  strokeDashArray: null,
7649
+
7650
+ /**
7651
+ * @property
7652
+ * @type Number
7653
+ */
7539
7654
  borderOpacityWhenMoving: 0.4,
7655
+
7656
+ /**
7657
+ * @property
7658
+ * @type Number
7659
+ */
7540
7660
  borderScaleFactor: 1,
7661
+
7662
+ /**
7663
+ * Transform matrix
7664
+ * @property
7665
+ * @type Array
7666
+ */
7541
7667
  transformMatrix: null,
7542
7668
 
7543
7669
  /**
@@ -7575,6 +7701,28 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7575
7701
  */
7576
7702
  rotatingPointOffset: 40,
7577
7703
 
7704
+ /**
7705
+ * @private
7706
+ * @property
7707
+ * @type Number
7708
+ */
7709
+ _theta: 0,
7710
+
7711
+ includeDefaultValues: true,
7712
+
7713
+ /**
7714
+ * List of properties to consider when checking if state of an object is changed (fabric.Object#hasStateChanged);
7715
+ * as well as for history (undo/redo) purposes
7716
+ * @property
7717
+ * @type Array
7718
+ */
7719
+ stateProperties: (
7720
+ 'top left width height scaleX scaleY flipX flipY ' +
7721
+ 'theta angle opacity cornersize fill overlayFill ' +
7722
+ 'stroke strokeWidth strokeDashArray fillRule ' +
7723
+ 'borderScaleFactor transformMatrix selectable'
7724
+ ).split(' '),
7725
+
7578
7726
  /**
7579
7727
  * @method callSuper
7580
7728
  * @param {String} methodName
@@ -7628,7 +7776,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7628
7776
  transform: function(ctx) {
7629
7777
  ctx.globalAlpha = this.opacity;
7630
7778
  ctx.translate(this.left, this.top);
7631
- ctx.rotate(this.theta);
7779
+ ctx.rotate(this._theta);
7632
7780
  ctx.scale(
7633
7781
  this.scaleX * (this.flipX ? -1 : 1),
7634
7782
  this.scaleY * (this.flipY ? -1 : 1)
@@ -7642,23 +7790,25 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7642
7790
  */
7643
7791
  toObject: function() {
7644
7792
 
7793
+ var NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS;
7794
+
7645
7795
  var object = {
7646
7796
  type: this.type,
7647
- left: toFixed(this.left, this.NUM_FRACTION_DIGITS),
7648
- top: toFixed(this.top, this.NUM_FRACTION_DIGITS),
7649
- width: toFixed(this.width, this.NUM_FRACTION_DIGITS),
7650
- height: toFixed(this.height, this.NUM_FRACTION_DIGITS),
7797
+ left: toFixed(this.left, NUM_FRACTION_DIGITS),
7798
+ top: toFixed(this.top, NUM_FRACTION_DIGITS),
7799
+ width: toFixed(this.width, NUM_FRACTION_DIGITS),
7800
+ height: toFixed(this.height, NUM_FRACTION_DIGITS),
7651
7801
  fill: (this.fill && this.fill.toObject) ? this.fill.toObject() : this.fill,
7652
7802
  overlayFill: this.overlayFill,
7653
7803
  stroke: this.stroke,
7654
7804
  strokeWidth: this.strokeWidth,
7655
7805
  strokeDashArray: this.strokeDashArray,
7656
- scaleX: toFixed(this.scaleX, this.NUM_FRACTION_DIGITS),
7657
- scaleY: toFixed(this.scaleY, this.NUM_FRACTION_DIGITS),
7658
- angle: toFixed(this.getAngle(), this.NUM_FRACTION_DIGITS),
7806
+ scaleX: toFixed(this.scaleX, NUM_FRACTION_DIGITS),
7807
+ scaleY: toFixed(this.scaleY, NUM_FRACTION_DIGITS),
7808
+ angle: toFixed(this.getAngle(), NUM_FRACTION_DIGITS),
7659
7809
  flipX: this.flipX,
7660
7810
  flipY: this.flipY,
7661
- opacity: toFixed(this.opacity, this.NUM_FRACTION_DIGITS),
7811
+ opacity: toFixed(this.opacity, NUM_FRACTION_DIGITS),
7662
7812
  selectable: this.selectable,
7663
7813
  hasControls: this.hasControls,
7664
7814
  hasBorders: this.hasBorders,
@@ -7780,10 +7930,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7780
7930
 
7781
7931
  _set: function(key, value) {
7782
7932
  var shouldConstrainValue = (key === 'scaleX' || key === 'scaleY') &&
7783
- value < this.MIN_SCALE_LIMIT;
7933
+ value < fabric.Object.MIN_SCALE_LIMIT;
7784
7934
 
7785
7935
  if (shouldConstrainValue) {
7786
- value = this.MIN_SCALE_LIMIT;
7936
+ value = fabric.Object.MIN_SCALE_LIMIT;
7787
7937
  }
7788
7938
  if (key === 'angle') {
7789
7939
  this.setAngle(value);
@@ -7962,7 +8112,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7962
8112
  * @return {Number} angle value
7963
8113
  */
7964
8114
  getAngle: function() {
7965
- return this.theta * 180 / Math.PI;
8115
+ return this._theta * 180 / Math.PI;
7966
8116
  },
7967
8117
 
7968
8118
  /**
@@ -7972,7 +8122,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7972
8122
  * @return {Object} thisArg
7973
8123
  */
7974
8124
  setAngle: function(value) {
7975
- this.theta = value / 180 * Math.PI;
8125
+ this._theta = value / 180 * Math.PI;
7976
8126
  this.angle = value;
7977
8127
  return this;
7978
8128
  },
@@ -7985,8 +8135,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7985
8135
  */
7986
8136
  setCoords: function() {
7987
8137
 
7988
- this.currentWidth = (this.width + this.strokeWidth) * this.scaleX;
7989
- this.currentHeight = (this.height + this.strokeWidth) * this.scaleY;
8138
+ var strokeWidth = this.strokeWidth > 1 ? this.strokeWidth : 0;
8139
+
8140
+ this.currentWidth = (this.width + strokeWidth) * this.scaleX;
8141
+ this.currentHeight = (this.height + strokeWidth) * this.scaleY;
7990
8142
 
7991
8143
  this._hypotenuse = Math.sqrt(
7992
8144
  Math.pow(this.currentWidth / 2, 2) +
@@ -7995,9 +8147,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
7995
8147
  this._angle = Math.atan(this.currentHeight / this.currentWidth);
7996
8148
 
7997
8149
  // offset added for rotate and scale actions
7998
- var offsetX = Math.cos(this._angle + this.theta) * this._hypotenuse,
7999
- offsetY = Math.sin(this._angle + this.theta) * this._hypotenuse,
8000
- theta = this.theta,
8150
+ var offsetX = Math.cos(this._angle + this._theta) * this._hypotenuse,
8151
+ offsetY = Math.sin(this._angle + this._theta) * this._hypotenuse,
8152
+ theta = this._theta,
8001
8153
  sinTh = Math.sin(theta),
8002
8154
  cosTh = Math.cos(theta);
8003
8155
 
@@ -8097,15 +8249,17 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
8097
8249
  drawBorders: function(ctx) {
8098
8250
  if (!this.hasBorders) return;
8099
8251
 
8100
- var padding2 = this.padding * 2;
8252
+ var padding2 = this.padding * 2,
8253
+ MIN_SCALE_LIMIT = fabric.Object.MIN_SCALE_LIMIT,
8254
+ strokeWidth = this.strokeWidth > 1 ? this.strokeWidth : 0;
8101
8255
 
8102
8256
  ctx.save();
8103
8257
 
8104
8258
  ctx.globalAlpha = this.isMoving ? this.borderOpacityWhenMoving : 1;
8105
8259
  ctx.strokeStyle = this.borderColor;
8106
8260
 
8107
- var scaleX = 1 / (this.scaleX < this.MIN_SCALE_LIMIT ? this.MIN_SCALE_LIMIT : this.scaleX),
8108
- scaleY = 1 / (this.scaleY < this.MIN_SCALE_LIMIT ? this.MIN_SCALE_LIMIT : this.scaleY);
8261
+ var scaleX = 1 / (this.scaleX < MIN_SCALE_LIMIT ? MIN_SCALE_LIMIT : this.scaleX),
8262
+ scaleY = 1 / (this.scaleY < MIN_SCALE_LIMIT ? MIN_SCALE_LIMIT : this.scaleY);
8109
8263
 
8110
8264
  ctx.lineWidth = 1 / this.borderScaleFactor;
8111
8265
 
@@ -8115,14 +8269,14 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
8115
8269
  h = this.getHeight();
8116
8270
 
8117
8271
  ctx.strokeRect(
8118
- ~~(-(w / 2) - this.padding - this.strokeWidth / 2 * this.scaleX) + 0.5, // offset needed to make lines look sharper
8119
- ~~(-(h / 2) - this.padding - this.strokeWidth / 2 * this.scaleY) + 0.5,
8120
- ~~(w + padding2 + this.strokeWidth * this.scaleX),
8121
- ~~(h + padding2 + this.strokeWidth * this.scaleY)
8272
+ ~~(-(w / 2) - this.padding - strokeWidth / 2 * this.scaleX) + 0.5, // offset needed to make lines look sharper
8273
+ ~~(-(h / 2) - this.padding - strokeWidth / 2 * this.scaleY) + 0.5,
8274
+ ~~(w + padding2 + strokeWidth * this.scaleX),
8275
+ ~~(h + padding2 + strokeWidth * this.scaleY)
8122
8276
  );
8123
8277
 
8124
8278
  if (this.hasRotatingPoint && !this.hideCorners && !this.lockRotation) {
8125
- var rotateHeight = (this.flipY ? h : -h) / 2;
8279
+ var rotateHeight = (this.flipY ? h + strokeWidth * this.scaleY : -h - strokeWidth * this.scaleY) / 2;
8126
8280
  var rotateWidth = (-w/2);
8127
8281
 
8128
8282
  ctx.beginPath();
@@ -8280,7 +8434,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
8280
8434
  _left = left + this.width/2 - scaleOffsetX;
8281
8435
 
8282
8436
  _top = this.flipY ?
8283
- (top + height + (this.rotatingPointOffset / this.scaleY) - sizeY/2 - strokeWidth2)
8437
+ (top + height + (this.rotatingPointOffset / this.scaleY) - sizeY/2 + strokeWidth2)
8284
8438
  : (top - (this.rotatingPointOffset / this.scaleY) - sizeY/2 - strokeWidth2);
8285
8439
 
8286
8440
  ctx.fillRect(_left, _top, sizeX, sizeY);
@@ -8635,8 +8789,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
8635
8789
  cornerHypotenuse = Math.sqrt(2 * Math.pow(this.cornersize, 2)) / 2,
8636
8790
  cosHalfOffset = cornerHypotenuse * Math.cos(theta),
8637
8791
  sinHalfOffset = cornerHypotenuse * Math.sin(theta),
8638
- sinTh = Math.sin(this.theta),
8639
- cosTh = Math.cos(this.theta);
8792
+ sinTh = Math.sin(this._theta),
8793
+ cosTh = Math.cos(this._theta);
8640
8794
 
8641
8795
  coords.tl.corner = {
8642
8796
  tl: {
@@ -8989,6 +9143,24 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
8989
9143
 
8990
9144
  extend(fabric.Object.prototype, fabric.Observable);
8991
9145
 
9146
+ extend(fabric.Object, {
9147
+
9148
+ /**
9149
+ * @static
9150
+ * @constant
9151
+ * @type Number
9152
+ */
9153
+ NUM_FRACTION_DIGITS: 2,
9154
+
9155
+ /**
9156
+ * @static
9157
+ * @constant
9158
+ * @type Number
9159
+ */
9160
+ MIN_SCALE_LIMIT: 0.1
9161
+
9162
+ });
9163
+
8992
9164
  })(typeof exports != 'undefined' ? exports : this);
8993
9165
 
8994
9166
  (function(global) {
@@ -10023,8 +10195,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
10023
10195
  maxX = max(points, 'x'),
10024
10196
  maxY = max(points, 'y');
10025
10197
 
10026
- this.width = maxX - minX;
10027
- this.height = maxY - minY;
10198
+ this.width = (maxX - minX) || 1;
10199
+ this.height = (maxY - minY) || 1;
10200
+
10028
10201
  this.minX = minX;
10029
10202
  this.minY = minY;
10030
10203
  },
@@ -10852,8 +11025,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
10852
11025
  var minX = min(aX),
10853
11026
  minY = min(aY),
10854
11027
  deltaX = 0,
10855
- deltaY = 0,
10856
- strokeWidthOffset = this.strokeWidth > 1 ? (this.strokeWidth * 2) : 0;
11028
+ deltaY = 0;
10857
11029
 
10858
11030
  var o = {
10859
11031
  top: minY - deltaY,
@@ -10862,8 +11034,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
10862
11034
  right: max(aX) - deltaX
10863
11035
  };
10864
11036
 
10865
- o.width = o.right - o.left + strokeWidthOffset;
10866
- o.height = o.bottom - o.top + strokeWidthOffset;
11037
+ o.width = o.right - o.left;
11038
+ o.height = o.bottom - o.top;
10867
11039
 
10868
11040
  return o;
10869
11041
  }
@@ -13611,4 +13783,4 @@ fabric.Image.filters.Tint.fromObject = function(object) {
13611
13783
  fabric.Canvas.prototype.setHeight = fabric.StaticCanvas.prototype.setHeight;
13612
13784
  }
13613
13785
 
13614
- })();
13786
+ })();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fabric-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &70255214594200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -24,18 +24,10 @@ dependencies:
24
24
  version: '5.0'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: 3.2.0
33
- - - <
34
- - !ruby/object:Gem::Version
35
- version: '5.0'
27
+ version_requirements: *70255214594200
36
28
  - !ruby/object:Gem::Dependency
37
29
  name: thor
38
- requirement: !ruby/object:Gem::Requirement
30
+ requirement: &70255214627500 !ruby/object:Gem::Requirement
39
31
  none: false
40
32
  requirements:
41
33
  - - ~>
@@ -43,12 +35,7 @@ dependencies:
43
35
  version: '0.14'
44
36
  type: :runtime
45
37
  prerelease: false
46
- version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
- requirements:
49
- - - ~>
50
- - !ruby/object:Gem::Version
51
- version: '0.14'
38
+ version_requirements: *70255214627500
52
39
  description: This gem provides fabric.js for your Rails 3 application via the asset
53
40
  pipeline.
54
41
  email:
@@ -82,9 +69,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
69
  - - ! '>='
83
70
  - !ruby/object:Gem::Version
84
71
  version: '0'
85
- segments:
86
- - 0
87
- hash: -240717121770573638
88
72
  required_rubygems_version: !ruby/object:Gem::Requirement
89
73
  none: false
90
74
  requirements:
@@ -93,8 +77,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
77
  version: 1.3.6
94
78
  requirements: []
95
79
  rubyforge_project: fabric-rails
96
- rubygems_version: 1.8.24
80
+ rubygems_version: 1.8.15
97
81
  signing_key:
98
82
  specification_version: 3
99
83
  summary: Easily use fabric.js with Rails 3
100
84
  test_files: []
85
+ has_rdoc: