mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-21 20:01:52 +00:00
Fix text offset issue when exporting to SVG.
This commit is contained in:
parent
21de5fdbd2
commit
93565f135d
6 changed files with 15 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.7.21" };
|
||||
var fabric = fabric || { version: "0.7.22" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
|
|||
9
dist/all.js
vendored
9
dist/all.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
/*! Fabric.js Copyright 2008-2012, Bitsonnet (Juriy Zaytsev, Maxim Chernyak) */
|
||||
|
||||
var fabric = fabric || { version: "0.7.21" };
|
||||
var fabric = fabric || { version: "0.7.22" };
|
||||
|
||||
if (typeof exports != 'undefined') {
|
||||
exports.fabric = fabric;
|
||||
|
|
@ -11737,7 +11737,10 @@ fabric.Image.filters.Invert.fromObject = function() {
|
|||
|
||||
textAndBg = this._getSVGTextAndBg(lineTopOffset, textLeftOffset, textLines),
|
||||
shadowSpans = this._getSVGShadows(lineTopOffset, textLines);
|
||||
|
||||
|
||||
// move top offset by an ascent
|
||||
textTopOffset += ((this._fontAscent / 5) * this.lineHeight);
|
||||
|
||||
return [
|
||||
'<g transform="', this.getSvgTransform(), '">',
|
||||
textAndBg.textBgRects.join(''),
|
||||
|
|
@ -11817,7 +11820,7 @@ fabric.Image.filters.Invert.fromObject = function() {
|
|||
toFixed(textLeftOffset + this._boundaries[i].left, 2),
|
||||
'" y="',
|
||||
/* an offset that seems to straighten things out */
|
||||
toFixed((lineTopOffset * i) - this.height / 2 + (this.lineHeight * 2.6), 2),
|
||||
toFixed((lineTopOffset * i) - this.height / 2, 2),
|
||||
'" width="',
|
||||
toFixed(this._boundaries[i].width, 2),
|
||||
'" height="',
|
||||
|
|
|
|||
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.21",
|
||||
"version": "0.7.22",
|
||||
"author": "Juriy Zaytsev <kangax@gmail.com>",
|
||||
"keywords": ["canvas", "graphic", "graphics", "SVG", "node-canvas", "parser", "HTML5", "object model"],
|
||||
"repository": "git://github.com/kangax/fabric.js",
|
||||
|
|
|
|||
|
|
@ -294,7 +294,10 @@
|
|||
|
||||
textAndBg = this._getSVGTextAndBg(lineTopOffset, textLeftOffset, textLines),
|
||||
shadowSpans = this._getSVGShadows(lineTopOffset, textLines);
|
||||
|
||||
|
||||
// move top offset by an ascent
|
||||
textTopOffset += ((this._fontAscent / 5) * this.lineHeight);
|
||||
|
||||
return [
|
||||
'<g transform="', this.getSvgTransform(), '">',
|
||||
textAndBg.textBgRects.join(''),
|
||||
|
|
@ -374,7 +377,7 @@
|
|||
toFixed(textLeftOffset + this._boundaries[i].left, 2),
|
||||
'" y="',
|
||||
/* an offset that seems to straighten things out */
|
||||
toFixed((lineTopOffset * i) - this.height / 2 + (this.lineHeight * 2.6), 2),
|
||||
toFixed((lineTopOffset * i) - this.height / 2, 2),
|
||||
'" width="',
|
||||
toFixed(this._boundaries[i].width, 2),
|
||||
'" height="',
|
||||
|
|
|
|||
Loading…
Reference in a new issue