fabric-rails 0.0.5 → 0.0.6
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 +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/fabric/rails/version.rb +2 -2
- data/vendor/assets/javascripts/fabric.js +36 -30
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/fabric/rails/version.rb
CHANGED
@@ -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.
|
4
|
+
var fabric = fabric || { version: "0.9.3" };
|
5
5
|
|
6
6
|
if (typeof exports != 'undefined') {
|
7
7
|
exports.fabric = fabric;
|
@@ -4224,12 +4224,12 @@ fabric.util.string = {
|
|
4224
4224
|
|
4225
4225
|
for (var i = linearGradientEls.length; i--; ) {
|
4226
4226
|
el = linearGradientEls[i];
|
4227
|
-
gradientDefs[el.id] = el;
|
4227
|
+
gradientDefs[el.getAttribute('id')] = el;
|
4228
4228
|
}
|
4229
4229
|
|
4230
4230
|
for (var i = radialGradientEls.length; i--; ) {
|
4231
4231
|
el = radialGradientEls[i];
|
4232
|
-
gradientDefs[el.id] = el;
|
4232
|
+
gradientDefs[el.getAttribute('id')] = el;
|
4233
4233
|
}
|
4234
4234
|
|
4235
4235
|
return gradientDefs;
|
@@ -7985,8 +7985,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
7985
7985
|
*/
|
7986
7986
|
setCoords: function() {
|
7987
7987
|
|
7988
|
-
this.currentWidth = this.width * this.scaleX;
|
7989
|
-
this.currentHeight = this.height * this.scaleY;
|
7988
|
+
this.currentWidth = (this.width + this.strokeWidth) * this.scaleX;
|
7989
|
+
this.currentHeight = (this.height + this.strokeWidth) * this.scaleY;
|
7990
7990
|
|
7991
7991
|
this._hypotenuse = Math.sqrt(
|
7992
7992
|
Math.pow(this.currentWidth / 2, 2) +
|
@@ -8097,8 +8097,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
8097
8097
|
drawBorders: function(ctx) {
|
8098
8098
|
if (!this.hasBorders) return;
|
8099
8099
|
|
8100
|
-
var
|
8101
|
-
padding2 = padding * 2;
|
8100
|
+
var padding2 = this.padding * 2;
|
8102
8101
|
|
8103
8102
|
ctx.save();
|
8104
8103
|
|
@@ -8116,10 +8115,10 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
8116
8115
|
h = this.getHeight();
|
8117
8116
|
|
8118
8117
|
ctx.strokeRect(
|
8119
|
-
~~(-(w / 2) - padding) + 0.5, // offset needed to make lines look sharper
|
8120
|
-
~~(-(h / 2) - padding) + 0.5,
|
8121
|
-
~~(w + padding2),
|
8122
|
-
~~(h + padding2)
|
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)
|
8123
8122
|
);
|
8124
8123
|
|
8125
8124
|
if (this.hasRotatingPoint && !this.hideCorners && !this.lockRotation) {
|
@@ -8208,6 +8207,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
8208
8207
|
|
8209
8208
|
var size = this.cornersize,
|
8210
8209
|
size2 = size / 2,
|
8210
|
+
strokeWidth2 = this.strokeWidth / 2,
|
8211
8211
|
padding = this.padding,
|
8212
8212
|
left = -(this.width / 2),
|
8213
8213
|
top = -(this.height / 2),
|
@@ -8227,42 +8227,42 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
8227
8227
|
ctx.fillStyle = this.cornerColor;
|
8228
8228
|
|
8229
8229
|
// top-left
|
8230
|
-
_left = left - scaleOffsetX;
|
8231
|
-
_top = top - scaleOffsetY;
|
8230
|
+
_left = left - scaleOffsetX - strokeWidth2;
|
8231
|
+
_top = top - scaleOffsetY - strokeWidth2;
|
8232
8232
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8233
8233
|
|
8234
8234
|
// top-right
|
8235
|
-
_left = left + this.width - scaleOffsetX;
|
8236
|
-
_top = top - scaleOffsetY;
|
8235
|
+
_left = left + this.width - scaleOffsetX + strokeWidth2;
|
8236
|
+
_top = top - scaleOffsetY - strokeWidth2;
|
8237
8237
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8238
8238
|
|
8239
8239
|
// bottom-left
|
8240
|
-
_left = left - scaleOffsetX;
|
8241
|
-
_top = top + height + scaleOffsetSizeY;
|
8240
|
+
_left = left - scaleOffsetX - strokeWidth2;
|
8241
|
+
_top = top + height + scaleOffsetSizeY + strokeWidth2;
|
8242
8242
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8243
8243
|
|
8244
8244
|
// bottom-right
|
8245
|
-
_left = left + this.width + scaleOffsetSizeX;
|
8246
|
-
_top = top + height + scaleOffsetSizeY;
|
8245
|
+
_left = left + this.width + scaleOffsetSizeX + strokeWidth2;
|
8246
|
+
_top = top + height + scaleOffsetSizeY + strokeWidth2;
|
8247
8247
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8248
8248
|
|
8249
8249
|
// middle-top
|
8250
8250
|
_left = left + this.width/2 - scaleOffsetX;
|
8251
|
-
_top = top - scaleOffsetY;
|
8251
|
+
_top = top - scaleOffsetY - strokeWidth2;
|
8252
8252
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8253
8253
|
|
8254
8254
|
// middle-bottom
|
8255
8255
|
_left = left + this.width/2 - scaleOffsetX;
|
8256
|
-
_top = top + height + scaleOffsetSizeY;
|
8256
|
+
_top = top + height + scaleOffsetSizeY + strokeWidth2;
|
8257
8257
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8258
8258
|
|
8259
8259
|
// middle-right
|
8260
|
-
_left = left + this.width + scaleOffsetSizeX;
|
8260
|
+
_left = left + this.width + scaleOffsetSizeX + strokeWidth2;
|
8261
8261
|
_top = top + height/2 - scaleOffsetY;
|
8262
8262
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8263
8263
|
|
8264
8264
|
// middle-left
|
8265
|
-
_left = left - scaleOffsetX;
|
8265
|
+
_left = left - scaleOffsetX - strokeWidth2;
|
8266
8266
|
_top = top + height/2 - scaleOffsetY;
|
8267
8267
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8268
8268
|
|
@@ -8280,8 +8280,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
8280
8280
|
_left = left + this.width/2 - scaleOffsetX;
|
8281
8281
|
|
8282
8282
|
_top = this.flipY ?
|
8283
|
-
(top + height + (this.rotatingPointOffset / this.scaleY) - sizeY/2)
|
8284
|
-
: (top - (this.rotatingPointOffset / this.scaleY) - sizeY/2);
|
8283
|
+
(top + height + (this.rotatingPointOffset / this.scaleY) - sizeY/2 - strokeWidth2)
|
8284
|
+
: (top - (this.rotatingPointOffset / this.scaleY) - sizeY/2 - strokeWidth2);
|
8285
8285
|
|
8286
8286
|
ctx.fillRect(_left, _top, sizeX, sizeY);
|
8287
8287
|
}
|
@@ -10633,7 +10633,7 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
10633
10633
|
ctx.closePath();
|
10634
10634
|
break;
|
10635
10635
|
}
|
10636
|
-
|
10636
|
+
previous = current;
|
10637
10637
|
}
|
10638
10638
|
},
|
10639
10639
|
|
@@ -10852,7 +10852,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
10852
10852
|
var minX = min(aX),
|
10853
10853
|
minY = min(aY),
|
10854
10854
|
deltaX = 0,
|
10855
|
-
deltaY = 0
|
10855
|
+
deltaY = 0,
|
10856
|
+
strokeWidthOffset = this.strokeWidth > 1 ? (this.strokeWidth * 2) : 0;
|
10856
10857
|
|
10857
10858
|
var o = {
|
10858
10859
|
top: minY - deltaY,
|
@@ -10861,8 +10862,8 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
10861
10862
|
right: max(aX) - deltaX
|
10862
10863
|
};
|
10863
10864
|
|
10864
|
-
o.width = o.right - o.left;
|
10865
|
-
o.height = o.bottom - o.top;
|
10865
|
+
o.width = o.right - o.left + strokeWidthOffset;
|
10866
|
+
o.height = o.bottom - o.top + strokeWidthOffset;
|
10866
10867
|
|
10867
10868
|
return o;
|
10868
10869
|
}
|
@@ -11753,6 +11754,11 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
|
|
11753
11754
|
*/
|
11754
11755
|
render: function(ctx, noTransform) {
|
11755
11756
|
ctx.save();
|
11757
|
+
var m = this.transformMatrix;
|
11758
|
+
this._resetWidthHeight();
|
11759
|
+
if (m) {
|
11760
|
+
ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
|
11761
|
+
}
|
11756
11762
|
if (!noTransform) {
|
11757
11763
|
this.transform(ctx);
|
11758
11764
|
}
|
@@ -13605,4 +13611,4 @@ fabric.Image.filters.Tint.fromObject = function(object) {
|
|
13605
13611
|
fabric.Canvas.prototype.setHeight = fabric.StaticCanvas.prototype.setHeight;
|
13606
13612
|
}
|
13607
13613
|
|
13608
|
-
})();
|
13614
|
+
})();
|
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.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
version: '0'
|
85
85
|
segments:
|
86
86
|
- 0
|
87
|
-
hash:
|
87
|
+
hash: -240717121770573638
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|