Commit 59524ab7 by Dmitry Baranovskiy

Splitting fixes

parent f7cbfd3d
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3895,9 +3895,14 @@ ...@@ -3895,9 +3895,14 @@
var prev = i && font.glyphs[letters[i - 1]] || {}, var prev = i && font.glyphs[letters[i - 1]] || {},
curr = font.glyphs[letters[i]]; curr = font.glyphs[letters[i]];
shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0; shift += i ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0;
curr && curr.d && out.push(this.path(curr.d).attr({fill: "#000", stroke: "none", transform: [["t", shift, 0]]})); curr && curr.d && out.push(this.path(curr.d).attr({
fill: "#000",
stroke: "none",
transform: [["t", shift * scale, 0]]
}));
} }
out.scale(scale, scale, top, height).translate(x - top, y - height); out.transform(["...s", scale, scale, top, height, "t", (x - top) / scale, (y - height) / scale]);
// out.scale(scale, scale, top, height).translate(x - top, y - height);
} }
return out; return out;
}; };
......
...@@ -4236,7 +4236,9 @@ window.Raphael.svg && function (R) { ...@@ -4236,7 +4236,9 @@ window.Raphael.svg && function (R) {
math = Math, math = Math,
mmax = math.max, mmax = math.max,
abs = math.abs, abs = math.abs,
pow = math.pow,
separator = /[, ]+/, separator = /[, ]+/,
eve = R.eve,
E = ""; E = "";
// SVG // SVG
var xlink = "http://www.w3.org/1999/xlink", var xlink = "http://www.w3.org/1999/xlink",
...@@ -4276,7 +4278,7 @@ window.Raphael.svg && function (R) { ...@@ -4276,7 +4278,7 @@ window.Raphael.svg && function (R) {
oid = oid && oid.match(rgGrad); oid = oid && oid.match(rgGrad);
if (oid && !--gradients[oid[1]]) { if (oid && !--gradients[oid[1]]) {
delete gradients[oid[1]]; delete gradients[oid[1]];
paper.defs.removeChild(g.doc.getElementById(oid[1])); paper.defs.removeChild(R._g.doc.getElementById(oid[1]));
} }
}, },
addGradientFill = function (element, gradient) { addGradientFill = function (element, gradient) {
...@@ -4430,7 +4432,7 @@ window.Raphael.svg && function (R) { ...@@ -4430,7 +4432,7 @@ window.Raphael.svg && function (R) {
if (type != "none") { if (type != "none") {
var pathId = "raphael-marker-" + type, var pathId = "raphael-marker-" + type,
markerId = "raphael-marker-" + se + type + w + h; markerId = "raphael-marker-" + se + type + w + h;
if (!g.doc.getElementById(pathId)) { if (!R._g.doc.getElementById(pathId)) {
p.defs.appendChild($($("path"), { p.defs.appendChild($($("path"), {
"stroke-linecap": "round", "stroke-linecap": "round",
d: markers[type], d: markers[type],
...@@ -4440,7 +4442,7 @@ window.Raphael.svg && function (R) { ...@@ -4440,7 +4442,7 @@ window.Raphael.svg && function (R) {
} else { } else {
markerCounter[pathId]++; markerCounter[pathId]++;
} }
var marker = g.doc.getElementById(markerId), var marker = R._g.doc.getElementById(markerId),
use; use;
if (!marker) { if (!marker) {
marker = $($("marker"), { marker = $($("marker"), {
...@@ -4499,7 +4501,7 @@ window.Raphael.svg && function (R) { ...@@ -4499,7 +4501,7 @@ window.Raphael.svg && function (R) {
delete o._.arrows[se + "String"]; delete o._.arrows[se + "String"];
} }
for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) { for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) {
var item = g.doc.getElementById(attr); var item = R._g.doc.getElementById(attr);
item && item.parentNode.removeChild(item); item && item.parentNode.removeChild(item);
} }
} }
...@@ -4522,7 +4524,7 @@ window.Raphael.svg && function (R) { ...@@ -4522,7 +4524,7 @@ window.Raphael.svg && function (R) {
node = o.node, node = o.node,
attrs = o.attrs, attrs = o.attrs,
addDashes = function (o, value) { addDashes = function (o, value) {
value = dasharray[lowerCase.call(value)]; value = dasharray[Str(value).toLowerCase()];
if (value) { if (value) {
var width = o.attrs["stroke-width"] || "1", var width = o.attrs["stroke-width"] || "1",
butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0, butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
...@@ -4549,7 +4551,7 @@ window.Raphael.svg && function (R) { ...@@ -4549,7 +4551,7 @@ window.Raphael.svg && function (R) {
case "title": case "title":
case "target": case "target":
var pn = node.parentNode; var pn = node.parentNode;
if (lowerCase.call(pn.tagName) != "a") { if (pn.tagName.toLowerCase() != "a") {
var hl = $("a"); var hl = $("a");
pn.insertBefore(hl, node); pn.insertBefore(hl, node);
hl.appendChild(node); hl.appendChild(node);
...@@ -4592,7 +4594,7 @@ window.Raphael.svg && function (R) { ...@@ -4592,7 +4594,7 @@ window.Raphael.svg && function (R) {
o.clip = rc; o.clip = rc;
} }
if (!value) { if (!value) {
var clip = g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E)); var clip = R._g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E));
clip && clip.parentNode.removeChild(clip); clip && clip.parentNode.removeChild(clip);
$(node, {"clip-path": E}); $(node, {"clip-path": E});
delete o.clip; delete o.clip;
...@@ -4722,7 +4724,7 @@ window.Raphael.svg && function (R) { ...@@ -4722,7 +4724,7 @@ window.Raphael.svg && function (R) {
$(node, {"fill-opacity": attrs["fill-opacity"]}); $(node, {"fill-opacity": attrs["fill-opacity"]});
} else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) { } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) {
if ("opacity" in attrs || "fill-opacity" in attrs) { if ("opacity" in attrs || "fill-opacity" in attrs) {
var gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
if (gradient) { if (gradient) {
var stops = gradient.getElementsByTagName("stop"); var stops = gradient.getElementsByTagName("stop");
$(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)}); $(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)});
...@@ -4752,7 +4754,7 @@ window.Raphael.svg && function (R) { ...@@ -4752,7 +4754,7 @@ window.Raphael.svg && function (R) {
// fall // fall
case "fill-opacity": case "fill-opacity":
if (attrs.gradient) { if (attrs.gradient) {
gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
if (gradient) { if (gradient) {
stops = gradient.getElementsByTagName("stop"); stops = gradient.getElementsByTagName("stop");
$(stops[stops.length - 1], {"stop-opacity": value}); $(stops[stops.length - 1], {"stop-opacity": value});
...@@ -5567,6 +5569,7 @@ window.Raphael.vml && function (R) { ...@@ -5567,6 +5569,7 @@ window.Raphael.vml && function (R) {
abs = math.abs, abs = math.abs,
fillString = "fill", fillString = "fill",
separator = /[, ]+/, separator = /[, ]+/,
eve = R.eve,
S = " ", S = " ",
E = ""; E = "";
// VML // VML
...@@ -5586,7 +5589,7 @@ window.Raphael.vml && function (R) { ...@@ -5586,7 +5589,7 @@ window.Raphael.vml && function (R) {
if (command == R._pathToAbsolute && !Str(path).match(total)) { if (command == R._pathToAbsolute && !Str(path).match(total)) {
var res = Str(path).replace(bites, function (all, command, args) { var res = Str(path).replace(bites, function (all, command, args) {
var vals = [], var vals = [],
isMove = lowerCase.call(command) == "m", isMove = command.toLowerCase() == "m",
res = map[command]; res = map[command];
args.replace(val, function (value) { args.replace(val, function (value) {
if (isMove && vals.length == 2) { if (isMove && vals.length == 2) {
...@@ -5732,7 +5735,7 @@ window.Raphael.vml && function (R) { ...@@ -5732,7 +5735,7 @@ window.Raphael.vml && function (R) {
if (rect.length == 4) { if (rect.length == 4) {
rect[2] = +rect[2] + (+rect[0]); rect[2] = +rect[2] + (+rect[0]);
rect[3] = +rect[3] + (+rect[1]); rect[3] = +rect[3] + (+rect[1]);
var div = node.clipRect || g.doc.createElement("div"), var div = node.clipRect || R._g.doc.createElement("div"),
dstyle = div.style, dstyle = div.style,
group = node.parentNode; group = node.parentNode;
dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect); dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
...@@ -6484,7 +6487,7 @@ window.Raphael.vml && function (R) { ...@@ -6484,7 +6487,7 @@ window.Raphael.vml && function (R) {
R.prototype.clear = function () { R.prototype.clear = function () {
R.eve("clear", this); R.eve("clear", this);
this.canvas.innerHTML = E; this.canvas.innerHTML = E;
this.span = g.doc.createElement("span"); this.span = R._g.doc.createElement("span");
this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;"; this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
this.canvas.appendChild(this.span); this.canvas.appendChild(this.span);
this.bottom = this.top = null; this.bottom = this.top = null;
......
...@@ -15,7 +15,9 @@ window.Raphael.svg && function (R) { ...@@ -15,7 +15,9 @@ window.Raphael.svg && function (R) {
math = Math, math = Math,
mmax = math.max, mmax = math.max,
abs = math.abs, abs = math.abs,
pow = math.pow,
separator = /[, ]+/, separator = /[, ]+/,
eve = R.eve,
E = ""; E = "";
// SVG // SVG
var xlink = "http://www.w3.org/1999/xlink", var xlink = "http://www.w3.org/1999/xlink",
...@@ -55,7 +57,7 @@ window.Raphael.svg && function (R) { ...@@ -55,7 +57,7 @@ window.Raphael.svg && function (R) {
oid = oid && oid.match(rgGrad); oid = oid && oid.match(rgGrad);
if (oid && !--gradients[oid[1]]) { if (oid && !--gradients[oid[1]]) {
delete gradients[oid[1]]; delete gradients[oid[1]];
paper.defs.removeChild(g.doc.getElementById(oid[1])); paper.defs.removeChild(R._g.doc.getElementById(oid[1]));
} }
}, },
addGradientFill = function (element, gradient) { addGradientFill = function (element, gradient) {
...@@ -209,7 +211,7 @@ window.Raphael.svg && function (R) { ...@@ -209,7 +211,7 @@ window.Raphael.svg && function (R) {
if (type != "none") { if (type != "none") {
var pathId = "raphael-marker-" + type, var pathId = "raphael-marker-" + type,
markerId = "raphael-marker-" + se + type + w + h; markerId = "raphael-marker-" + se + type + w + h;
if (!g.doc.getElementById(pathId)) { if (!R._g.doc.getElementById(pathId)) {
p.defs.appendChild($($("path"), { p.defs.appendChild($($("path"), {
"stroke-linecap": "round", "stroke-linecap": "round",
d: markers[type], d: markers[type],
...@@ -219,7 +221,7 @@ window.Raphael.svg && function (R) { ...@@ -219,7 +221,7 @@ window.Raphael.svg && function (R) {
} else { } else {
markerCounter[pathId]++; markerCounter[pathId]++;
} }
var marker = g.doc.getElementById(markerId), var marker = R._g.doc.getElementById(markerId),
use; use;
if (!marker) { if (!marker) {
marker = $($("marker"), { marker = $($("marker"), {
...@@ -278,7 +280,7 @@ window.Raphael.svg && function (R) { ...@@ -278,7 +280,7 @@ window.Raphael.svg && function (R) {
delete o._.arrows[se + "String"]; delete o._.arrows[se + "String"];
} }
for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) { for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) {
var item = g.doc.getElementById(attr); var item = R._g.doc.getElementById(attr);
item && item.parentNode.removeChild(item); item && item.parentNode.removeChild(item);
} }
} }
...@@ -301,7 +303,7 @@ window.Raphael.svg && function (R) { ...@@ -301,7 +303,7 @@ window.Raphael.svg && function (R) {
node = o.node, node = o.node,
attrs = o.attrs, attrs = o.attrs,
addDashes = function (o, value) { addDashes = function (o, value) {
value = dasharray[lowerCase.call(value)]; value = dasharray[Str(value).toLowerCase()];
if (value) { if (value) {
var width = o.attrs["stroke-width"] || "1", var width = o.attrs["stroke-width"] || "1",
butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0, butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0,
...@@ -328,7 +330,7 @@ window.Raphael.svg && function (R) { ...@@ -328,7 +330,7 @@ window.Raphael.svg && function (R) {
case "title": case "title":
case "target": case "target":
var pn = node.parentNode; var pn = node.parentNode;
if (lowerCase.call(pn.tagName) != "a") { if (pn.tagName.toLowerCase() != "a") {
var hl = $("a"); var hl = $("a");
pn.insertBefore(hl, node); pn.insertBefore(hl, node);
hl.appendChild(node); hl.appendChild(node);
...@@ -371,7 +373,7 @@ window.Raphael.svg && function (R) { ...@@ -371,7 +373,7 @@ window.Raphael.svg && function (R) {
o.clip = rc; o.clip = rc;
} }
if (!value) { if (!value) {
var clip = g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E)); var clip = R._g.doc.getElementById(node.getAttribute("clip-path").replace(/(^url\(#|\)$)/g, E));
clip && clip.parentNode.removeChild(clip); clip && clip.parentNode.removeChild(clip);
$(node, {"clip-path": E}); $(node, {"clip-path": E});
delete o.clip; delete o.clip;
...@@ -501,7 +503,7 @@ window.Raphael.svg && function (R) { ...@@ -501,7 +503,7 @@ window.Raphael.svg && function (R) {
$(node, {"fill-opacity": attrs["fill-opacity"]}); $(node, {"fill-opacity": attrs["fill-opacity"]});
} else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) { } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) {
if ("opacity" in attrs || "fill-opacity" in attrs) { if ("opacity" in attrs || "fill-opacity" in attrs) {
var gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
if (gradient) { if (gradient) {
var stops = gradient.getElementsByTagName("stop"); var stops = gradient.getElementsByTagName("stop");
$(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)}); $(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)});
...@@ -531,7 +533,7 @@ window.Raphael.svg && function (R) { ...@@ -531,7 +533,7 @@ window.Raphael.svg && function (R) {
// fall // fall
case "fill-opacity": case "fill-opacity":
if (attrs.gradient) { if (attrs.gradient) {
gradient = g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E));
if (gradient) { if (gradient) {
stops = gradient.getElementsByTagName("stop"); stops = gradient.getElementsByTagName("stop");
$(stops[stops.length - 1], {"stop-opacity": value}); $(stops[stops.length - 1], {"stop-opacity": value});
......
...@@ -18,6 +18,7 @@ window.Raphael.vml && function (R) { ...@@ -18,6 +18,7 @@ window.Raphael.vml && function (R) {
abs = math.abs, abs = math.abs,
fillString = "fill", fillString = "fill",
separator = /[, ]+/, separator = /[, ]+/,
eve = R.eve,
S = " ", S = " ",
E = ""; E = "";
// VML // VML
...@@ -37,7 +38,7 @@ window.Raphael.vml && function (R) { ...@@ -37,7 +38,7 @@ window.Raphael.vml && function (R) {
if (command == R._pathToAbsolute && !Str(path).match(total)) { if (command == R._pathToAbsolute && !Str(path).match(total)) {
var res = Str(path).replace(bites, function (all, command, args) { var res = Str(path).replace(bites, function (all, command, args) {
var vals = [], var vals = [],
isMove = lowerCase.call(command) == "m", isMove = command.toLowerCase() == "m",
res = map[command]; res = map[command];
args.replace(val, function (value) { args.replace(val, function (value) {
if (isMove && vals.length == 2) { if (isMove && vals.length == 2) {
...@@ -183,7 +184,7 @@ window.Raphael.vml && function (R) { ...@@ -183,7 +184,7 @@ window.Raphael.vml && function (R) {
if (rect.length == 4) { if (rect.length == 4) {
rect[2] = +rect[2] + (+rect[0]); rect[2] = +rect[2] + (+rect[0]);
rect[3] = +rect[3] + (+rect[1]); rect[3] = +rect[3] + (+rect[1]);
var div = node.clipRect || g.doc.createElement("div"), var div = node.clipRect || R._g.doc.createElement("div"),
dstyle = div.style, dstyle = div.style,
group = node.parentNode; group = node.parentNode;
dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect); dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect);
...@@ -935,7 +936,7 @@ window.Raphael.vml && function (R) { ...@@ -935,7 +936,7 @@ window.Raphael.vml && function (R) {
R.prototype.clear = function () { R.prototype.clear = function () {
R.eve("clear", this); R.eve("clear", this);
this.canvas.innerHTML = E; this.canvas.innerHTML = E;
this.span = g.doc.createElement("span"); this.span = R._g.doc.createElement("span");
this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;"; this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";
this.canvas.appendChild(this.span); this.canvas.appendChild(this.span);
this.bottom = this.top = null; this.bottom = this.top = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment