Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty rows in text and BBox calculations after transform #1027

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dev/raphael.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,9 @@
sy = 1,
_ = el._,
m = new Matrix;
if (_.transform + '' != tdata + '') {
_.dirtyT = 1;
}
_.transform = tdata || [];
if (tdata) {
for (var i = 0, ii = tdata.length; i < ii; i++) {
Expand Down Expand Up @@ -2304,7 +2307,6 @@
} else if (command == "m" && tlen == 7) {
m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
}
_.dirtyT = 1;
el.matrix = m;
}
}
Expand Down
10 changes: 8 additions & 2 deletions dev/raphael.svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,13 +605,19 @@
}
var texts = Str(params.text).split("\n"),
tspans = [],
tspan;
tspan,
row = 1;
for (var i = 0, ii = texts.length; i < ii; i++) {
if (texts[i].trim() == "") {
++row;
continue;
}
tspan = $("tspan");
i && $(tspan, {dy: fontSize * leading, x: a.x});
i && $(tspan, {dy: fontSize * leading * row, x: a.x});
tspan.appendChild(R._g.doc.createTextNode(texts[i]));
node.appendChild(tspan);
tspans[i] = tspan;
row = 1;
}
} else {
tspans = node.getElementsByTagName("tspan");
Expand Down
6 changes: 3 additions & 3 deletions raphael-min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions raphael-nodeps-min.js

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions raphael-nodeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,9 @@
sy = 1,
_ = el._,
m = new Matrix;
if (_.transform + '' != tdata + '') {
_.dirtyT = 1;
}
_.transform = tdata || [];
if (tdata) {
for (var i = 0, ii = tdata.length; i < ii; i++) {
Expand Down Expand Up @@ -2304,7 +2307,6 @@
} else if (command == "m" && tlen == 7) {
m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
}
_.dirtyT = 1;
el.matrix = m;
}
}
Expand Down Expand Up @@ -6020,13 +6022,19 @@
}
var texts = Str(params.text).split("\n"),
tspans = [],
tspan;
tspan,
row = 1;
for (var i = 0, ii = texts.length; i < ii; i++) {
if (texts[i].trim() == "") {
++row;
continue;
}
tspan = $("tspan");
i && $(tspan, {dy: fontSize * leading, x: a.x});
i && $(tspan, {dy: fontSize * leading * row, x: a.x});
tspan.appendChild(R._g.doc.createTextNode(texts[i]));
node.appendChild(tspan);
tspans[i] = tspan;
row = 1;
}
} else {
tspans = node.getElementsByTagName("tspan");
Expand Down
14 changes: 11 additions & 3 deletions raphael.js
Original file line number Diff line number Diff line change
Expand Up @@ -2628,6 +2628,9 @@
sy = 1,
_ = el._,
m = new Matrix;
if (_.transform + '' != tdata + '') {
_.dirtyT = 1;
}
_.transform = tdata || [];
if (tdata) {
for (var i = 0, ii = tdata.length; i < ii; i++) {
Expand Down Expand Up @@ -2686,7 +2689,6 @@
} else if (command == "m" && tlen == 7) {
m.add(t[1], t[2], t[3], t[4], t[5], t[6]);
}
_.dirtyT = 1;
el.matrix = m;
}
}
Expand Down Expand Up @@ -6402,13 +6404,19 @@
}
var texts = Str(params.text).split("\n"),
tspans = [],
tspan;
tspan,
row = 1;
for (var i = 0, ii = texts.length; i < ii; i++) {
if (texts[i].trim() == "") {
++row;
continue;
}
tspan = $("tspan");
i && $(tspan, {dy: fontSize * leading, x: a.x});
i && $(tspan, {dy: fontSize * leading * row, x: a.x});
tspan.appendChild(R._g.doc.createTextNode(texts[i]));
node.appendChild(tspan);
tspans[i] = tspan;
row = 1;
}
} else {
tspans = node.getElementsByTagName("tspan");
Expand Down