fabric-rails 0.9.16 → 0.9.17

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.
@@ -1,6 +1,6 @@
1
1
  module Fabric
2
2
  module Rails
3
- VERSION = "0.9.16"
4
- FABRIC_VERSION = "0.9.16"
3
+ VERSION = "0.9.17"
4
+ FABRIC_VERSION = "0.9.17"
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.16" };
4
+ var fabric = fabric || { version: "0.9.17" };
5
5
 
6
6
  if (typeof exports != 'undefined') {
7
7
  exports.fabric = fabric;
@@ -5422,6 +5422,14 @@ fabric.util.string = {
5422
5422
 
5423
5423
  // delegate rendering to group selection (if one exists)
5424
5424
  if (activeGroup) {
5425
+ //Store objects in group preserving order, then replace
5426
+ var sortedObjects = [];
5427
+ this.forEachObject(function (object) {
5428
+ if (activeGroup.contains(object)) {
5429
+ sortedObjects.push(object);
5430
+ }
5431
+ });
5432
+ activeGroup._set('objects', sortedObjects);
5425
5433
  this._draw(this.contextTop, activeGroup);
5426
5434
  }
5427
5435
 
@@ -6382,11 +6390,10 @@ fabric.util.string = {
6382
6390
  this.onBeforeScaleRotate(target);
6383
6391
  }
6384
6392
 
6385
- this._setupCurrentTransform(e, target);
6386
-
6387
6393
  var shouldHandleGroupLogic = e.shiftKey && (activeGroup || this.getActiveObject()) && this.selection;
6388
6394
  if (shouldHandleGroupLogic) {
6389
6395
  this._handleGroupLogic(e, target);
6396
+ target = this.getActiveGroup();
6390
6397
  }
6391
6398
  else {
6392
6399
  if (target !== this.getActiveGroup()) {
@@ -6394,6 +6401,8 @@ fabric.util.string = {
6394
6401
  }
6395
6402
  this.setActiveObject(target, e);
6396
6403
  }
6404
+
6405
+ this._setupCurrentTransform(e, target);
6397
6406
  }
6398
6407
  // we must renderAll so that active image is placed on the top canvas
6399
6408
  this.renderAll();
@@ -6700,6 +6709,7 @@ fabric.util.string = {
6700
6709
  if (activeGroup) {
6701
6710
  if (activeGroup.contains(target)) {
6702
6711
  activeGroup.removeWithUpdate(target);
6712
+ this._resetObjectTransform(activeGroup);
6703
6713
  target.setActive(false);
6704
6714
  if (activeGroup.size() === 1) {
6705
6715
  // remove group alltogether if after removal it only contains 1 object
@@ -6708,6 +6718,7 @@ fabric.util.string = {
6708
6718
  }
6709
6719
  else {
6710
6720
  activeGroup.addWithUpdate(target);
6721
+ this._resetObjectTransform(activeGroup);
6711
6722
  }
6712
6723
  this.fire('selection:created', { target: activeGroup, e: e });
6713
6724
  activeGroup.setActive(true);
@@ -6887,6 +6898,16 @@ fabric.util.string = {
6887
6898
  this.upperCanvasEl.style.cursor = value;
6888
6899
  },
6889
6900
 
6901
+ /**
6902
+ * @private
6903
+ * @method _resetObjectTransform:
6904
+ */
6905
+ _resetObjectTransform: function (target) {
6906
+ target.scaleX = 1;
6907
+ target.scaleY = 1;
6908
+ target.setAngle(0);
6909
+ },
6910
+
6890
6911
  /**
6891
6912
  * Sets the cursor depending on where the canvas is being hovered.
6892
6913
  * Note: very buggy in Opera
@@ -11771,9 +11792,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
11771
11792
 
11772
11793
  var groupScaleFactor = Math.max(this.scaleX, this.scaleY);
11773
11794
 
11774
- for (var i = 0, len = this.objects.length; i < len; i++) {
11795
+ //The array is now sorted in order of highest first, so start from end.
11796
+ for (var i = this.objects.length; i > 0; i--) {
11775
11797
 
11776
- var object = this.objects[i];
11798
+ var object = this.objects[i-1];
11777
11799
  var originalScaleFactor = object.borderScaleFactor;
11778
11800
 
11779
11801
  object.borderScaleFactor = groupScaleFactor;
@@ -13078,7 +13100,7 @@ fabric.Image.filters.Tint.fromObject = function(object) {
13078
13100
  * @property
13079
13101
  * @type Number
13080
13102
  */
13081
- fontWeight: 100,
13103
+ fontWeight: 400,
13082
13104
 
13083
13105
  /**
13084
13106
  * @property
@@ -13355,7 +13377,7 @@ fabric.Image.filters.Tint.fromObject = function(object) {
13355
13377
  ctx.fillStyle = this.fill;
13356
13378
  ctx.strokeStyle = this.strokeStyle;
13357
13379
  ctx.lineWidth = this.strokeWidth;
13358
- ctx.textBaseline = 'top';
13380
+ ctx.textBaseline = 'alphabetic';
13359
13381
  ctx.textAlign = this.textAlign;
13360
13382
  ctx.font = this._getFontDeclaration();
13361
13383
  },
@@ -13426,7 +13448,7 @@ fabric.Image.filters.Tint.fromObject = function(object) {
13426
13448
  ctx.fillText(
13427
13449
  textLines[i],
13428
13450
  -this.width / 2,
13429
- (-this.height / 2) + (i * this.fontSize * this.lineHeight)
13451
+ (-this.height / 2) + (i * this.fontSize * this.lineHeight) + this.fontSize
13430
13452
  );
13431
13453
  }
13432
13454
  },
@@ -13441,7 +13463,7 @@ fabric.Image.filters.Tint.fromObject = function(object) {
13441
13463
  ctx.strokeText(
13442
13464
  textLines[i],
13443
13465
  -this.width / 2,
13444
- (-this.height / 2) + (i * this.fontSize * this.lineHeight)
13466
+ (-this.height / 2) + (i * this.fontSize * this.lineHeight) + this.fontSize
13445
13467
  );
13446
13468
  }
13447
13469
  }
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.9.16
4
+ version: 0.9.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: