mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-04 11:54:47 +00:00
Build distribution and bump version for previous change (removal of empty tspans).
This commit is contained in:
parent
89cdfa3884
commit
b6179a6f64
5 changed files with 49 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.7.19" };
|
||||
var fabric = fabric || { version: "0.7.20" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
78
dist/all.js
vendored
78
dist/all.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.7.19" };
|
||||
var fabric = fabric || { version: "0.7.20" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -11732,7 +11732,7 @@ fabric.Image.filters.Invert.fromObject = function() {
|
|||
*/
|
||||
toSVG: function() {
|
||||
|
||||
var textLines = this.text.split('\n'),
|
||||
var textLines = this.text.split(/\r?\n/),
|
||||
lineTopOffset = -this._fontAscent - ((this._fontAscent / 5) * this.lineHeight),
|
||||
|
||||
textLeftOffset = -(this.width/2),
|
||||
|
|
@ -11761,46 +11761,58 @@ fabric.Image.filters.Invert.fromObject = function() {
|
|||
},
|
||||
|
||||
_getSVGShadows: function(lineTopOffset, textLines) {
|
||||
var shadowSpans = [ ]
|
||||
for (var j = 0, jlen = this._shadows.length; j < jlen; j++) {
|
||||
for (var i = 0, ilen = textLines.length; i < ilen; i++) {
|
||||
var lineLeftOffset = (this._boundaries && this._boundaries[i]) ? this._boundaries[i].left : 0;
|
||||
shadowSpans.push(
|
||||
'<tspan x="',
|
||||
toFixed(lineLeftOffset + this._shadowOffsets[j][0], 2),
|
||||
(i === 0 ? '" y' : '" dy'), '="',
|
||||
toFixed(lineTopOffset + (i === 0 ? this._shadowOffsets[j][1] : 0), 2),
|
||||
'" ',
|
||||
this._getFillAttributes(this._shadows[j].color), '>',
|
||||
textLines[i],
|
||||
'</tspan>');
|
||||
var shadowSpans = [], j, i, jlen, ilen, lineTopOffsetMultiplier = 1;
|
||||
|
||||
for (j = 0, jlen = this._shadows.length; j < jlen; j++) {
|
||||
for (i = 0, ilen = textLines.length; i < ilen; i++) {
|
||||
if (textLines[i] !== '') {
|
||||
var lineLeftOffset = (this._boundaries && this._boundaries[i]) ? this._boundaries[i].left : 0;
|
||||
shadowSpans.push(
|
||||
'<tspan x="',
|
||||
toFixed((lineLeftOffset + lineTopOffsetMultiplier) + this._shadowOffsets[j][0], 2),
|
||||
(i === 0 ? '" y' : '" dy'), '="',
|
||||
toFixed(lineTopOffset + (i === 0 ? this._shadowOffsets[j][1] : 0), 2),
|
||||
'" ',
|
||||
this._getFillAttributes(this._shadows[j].color), '>',
|
||||
textLines[i],
|
||||
'</tspan>');
|
||||
lineTopOffsetMultiplier = 1;
|
||||
} else {
|
||||
// in some environments (e.g. IE 7 & 8) empty tspans are completely ignored, using a lineTopOffsetMultiplier
|
||||
// prevents empty tspans
|
||||
lineTopOffsetMultiplier++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return shadowSpans;
|
||||
},
|
||||
|
||||
_getSVGTextAndBg: function(lineTopOffset, textLeftOffset, textLines) {
|
||||
|
||||
var textSpans = [ ],
|
||||
textBgRects = [ ];
|
||||
var textSpans = [ ], textBgRects = [ ], i, lineLeftOffset, len, lineTopOffsetMultiplier = 1;
|
||||
|
||||
// text and background
|
||||
for (var i = 0, len = textLines.length; i < len; i++) {
|
||||
|
||||
var lineLeftOffset = (this._boundaries && this._boundaries[i]) ? toFixed(this._boundaries[i].left, 2) : 0;
|
||||
textSpans.push(
|
||||
'<tspan x="',
|
||||
lineLeftOffset, '" ',
|
||||
(i === 0 ? 'y' : 'dy'), '="',
|
||||
toFixed(lineTopOffset, 2), '" ',
|
||||
// doing this on <tspan> elements since setting opacity on containing <text> one doesn't work in Illustrator
|
||||
this._getFillAttributes(this.fill), '>',
|
||||
textLines[i],
|
||||
'</tspan>'
|
||||
);
|
||||
for (i = 0, len = textLines.length; i < len; i++) {
|
||||
if (textLines[i] !== '') {
|
||||
lineLeftOffset = (this._boundaries && this._boundaries[i]) ? toFixed(this._boundaries[i].left, 2) : 0;
|
||||
textSpans.push(
|
||||
'<tspan x="',
|
||||
lineLeftOffset, '" ',
|
||||
(i === 0 ? 'y' : 'dy'), '="',
|
||||
toFixed(lineTopOffset * lineTopOffsetMultiplier, 2) , '" ',
|
||||
// doing this on <tspan> elements since setting opacity on containing <text> one doesn't work in Illustrator
|
||||
this._getFillAttributes(this.fill), '>',
|
||||
textLines[i],
|
||||
'</tspan>'
|
||||
);
|
||||
lineTopOffsetMultiplier = 1;
|
||||
} else {
|
||||
// in some environments (e.g. IE 7 & 8) empty tspans are completely ignored, using a lineTopOffsetMultiplier
|
||||
// prevents empty tspans
|
||||
lineTopOffsetMultiplier++;
|
||||
}
|
||||
|
||||
if (!this.backgroundColor) continue;
|
||||
|
||||
|
||||
textBgRects.push(
|
||||
'<rect ',
|
||||
this._getFillAttributes(this.backgroundColor),
|
||||
|
|
@ -11820,7 +11832,7 @@ fabric.Image.filters.Invert.fromObject = function() {
|
|||
textBgRects: textBgRects
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
// Adobe Illustrator (at least CS5) is unable to render rgba()-based fill values
|
||||
// we work around it by "moving" alpha channel into opacity attribute and setting fill's alpha to 1
|
||||
_getFillAttributes: function(value) {
|
||||
|
|
|
|||
4
dist/all.min.js
vendored
4
dist/all.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
dist/all.min.js.gz
vendored
BIN
dist/all.min.js.gz
vendored
Binary file not shown.
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "fabric",
|
||||
"description": "Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.",
|
||||
"version": "0.7.19",
|
||||
"version": "0.7.20",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
Loading…
Reference in a new issue