Commit 054a763f by Dmitry Baranovskiy

Tweaks to previous merge

parent b1c60797
...@@ -3866,7 +3866,10 @@ ...@@ -3866,7 +3866,10 @@
= (number) length. = (number) length.
\*/ \*/
elproto.getTotalLength = function () { elproto.getTotalLength = function () {
var path = this.getPath(); if(!path){ return; } var path = this.getPath();
if (!path) {
return;
}
if (this.node.getTotalLength) { if (this.node.getTotalLength) {
return this.node.getTotalLength(); return this.node.getTotalLength();
...@@ -3892,7 +3895,10 @@ ...@@ -3892,7 +3895,10 @@
o } o }
\*/ \*/
elproto.getPointAtLength = function (length) { elproto.getPointAtLength = function (length) {
var path = this.getPath(); if(!path){ return; } var path = this.getPath();
if (!path) {
return;
}
return getPointAtLength(path, length); return getPointAtLength(path, length);
}; };
...@@ -3900,18 +3906,20 @@ ...@@ -3900,18 +3906,20 @@
* Element.getPath * Element.getPath
[ method ] [ method ]
** **
* Return path of element. Only works for element of "path" type and simple elements like "circle". * Returns path of the element. Only works for elements of “path” type and simple elements like circle.
= (object) path
** **
\*/ \*/
elproto.getPath = function() { elproto.getPath = function () {
var path; var path,
getPath = R._getPath[this.type];
if (this.type === "path") { if (this.type == "text" || this.type == "set") {
path = this.attrs.path return;
}
} else if(R._getPath[this.type] instanceof Function) {
path = R._getPath[this.type](this);
if (getPath) {
path = getPath(this);
} }
return path; return path;
...@@ -3930,7 +3938,10 @@ ...@@ -3930,7 +3938,10 @@
= (string) pathstring for the segment = (string) pathstring for the segment
\*/ \*/
elproto.getSubpath = function (from, to) { elproto.getSubpath = function (from, to) {
var path = this.getPath(); if(!path){ return; } var path = this.getPath();
if (!path) {
return;
}
return R.getSubpath(path, from, to); return R.getSubpath(path, from, to);
}; };
......
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