Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
raphael
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nhn
raphael
Commits
65792bb0
Commit
65792bb0
authored
Jan 05, 2010
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace getSubpathsAtLength with getSubpath along with some refactoring
parent
f4ff8147
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
21 deletions
+29
-21
raphael.js
raphael.js
+29
-21
No files found.
raphael.js
View file @
65792bb0
...
@@ -58,7 +58,7 @@ window.Raphael = (function () {
...
@@ -58,7 +58,7 @@ window.Raphael = (function () {
toFloat
=
parseFloat
,
toFloat
=
parseFloat
,
toInt
=
parseInt
,
toInt
=
parseInt
,
upperCase
=
String
[
proto
].
toUpperCase
,
upperCase
=
String
[
proto
].
toUpperCase
,
availableAttrs
=
{
"clip-rect"
:
"0 0 1
0e9 10
e9"
,
cursor
:
"default"
,
cx
:
0
,
cy
:
0
,
fill
:
"#fff"
,
"fill-opacity"
:
1
,
font
:
'10px "Arial"'
,
"font-family"
:
'"Arial"'
,
"font-size"
:
"10"
,
"font-style"
:
"normal"
,
"font-weight"
:
400
,
gradient
:
0
,
height
:
0
,
href
:
"http://raphaeljs.com/"
,
opacity
:
1
,
path
:
"M0,0"
,
r
:
0
,
rotation
:
0
,
rx
:
0
,
ry
:
0
,
scale
:
"1 1"
,
src
:
""
,
stroke
:
"#000"
,
"stroke-dasharray"
:
""
,
"stroke-linecap"
:
"butt"
,
"stroke-linejoin"
:
"butt"
,
"stroke-miterlimit"
:
0
,
"stroke-opacity"
:
1
,
"stroke-width"
:
1
,
target
:
"_blank"
,
"text-anchor"
:
"middle"
,
title
:
"Raphael"
,
translation
:
"0 0"
,
width
:
0
,
x
:
0
,
y
:
0
},
availableAttrs
=
{
"clip-rect"
:
"0 0 1
e9 1
e9"
,
cursor
:
"default"
,
cx
:
0
,
cy
:
0
,
fill
:
"#fff"
,
"fill-opacity"
:
1
,
font
:
'10px "Arial"'
,
"font-family"
:
'"Arial"'
,
"font-size"
:
"10"
,
"font-style"
:
"normal"
,
"font-weight"
:
400
,
gradient
:
0
,
height
:
0
,
href
:
"http://raphaeljs.com/"
,
opacity
:
1
,
path
:
"M0,0"
,
r
:
0
,
rotation
:
0
,
rx
:
0
,
ry
:
0
,
scale
:
"1 1"
,
src
:
""
,
stroke
:
"#000"
,
"stroke-dasharray"
:
""
,
"stroke-linecap"
:
"butt"
,
"stroke-linejoin"
:
"butt"
,
"stroke-miterlimit"
:
0
,
"stroke-opacity"
:
1
,
"stroke-width"
:
1
,
target
:
"_blank"
,
"text-anchor"
:
"middle"
,
title
:
"Raphael"
,
translation
:
"0 0"
,
width
:
0
,
x
:
0
,
y
:
0
},
availableAnimAttrs
=
{
along
:
"along"
,
"clip-rect"
:
"csv"
,
cx
:
nu
,
cy
:
nu
,
fill
:
"colour"
,
"fill-opacity"
:
nu
,
"font-size"
:
nu
,
height
:
nu
,
opacity
:
nu
,
path
:
"path"
,
r
:
nu
,
rotation
:
"csv"
,
rx
:
nu
,
ry
:
nu
,
scale
:
"csv"
,
stroke
:
"colour"
,
"stroke-opacity"
:
nu
,
"stroke-width"
:
nu
,
translation
:
"csv"
,
width
:
nu
,
x
:
nu
,
y
:
nu
},
availableAnimAttrs
=
{
along
:
"along"
,
"clip-rect"
:
"csv"
,
cx
:
nu
,
cy
:
nu
,
fill
:
"colour"
,
"fill-opacity"
:
nu
,
"font-size"
:
nu
,
height
:
nu
,
opacity
:
nu
,
path
:
"path"
,
r
:
nu
,
rotation
:
"csv"
,
rx
:
nu
,
ry
:
nu
,
scale
:
"csv"
,
stroke
:
"colour"
,
"stroke-opacity"
:
nu
,
"stroke-width"
:
nu
,
translation
:
"csv"
,
width
:
nu
,
x
:
nu
,
y
:
nu
},
rp
=
"replace"
;
rp
=
"replace"
;
R
.
version
=
"1.3.0dev"
;
R
.
version
=
"1.3.0dev"
;
...
@@ -2354,7 +2354,7 @@ window.Raphael = (function () {
...
@@ -2354,7 +2354,7 @@ window.Raphael = (function () {
res
.
coordsize
=
"1000 1000"
;
res
.
coordsize
=
"1000 1000"
;
res
.
coordorigin
=
"0 0"
;
res
.
coordorigin
=
"0 0"
;
res
.
span
=
doc
.
createElement
(
"span"
);
res
.
span
=
doc
.
createElement
(
"span"
);
res
.
span
.
style
.
cssText
=
"position:absolute;left:-9999
px;top:-9999px
;padding:0;margin:0;line-height:1;display:inline;"
;
res
.
span
.
style
.
cssText
=
"position:absolute;left:-9999
em;top:-9999em
;padding:0;margin:0;line-height:1;display:inline;"
;
c
[
appendChild
](
res
.
span
);
c
[
appendChild
](
res
.
span
);
cs
.
cssText
=
R
.
format
(
"width:{0};height:{1};position:absolute;clip:rect(0 {0} {1} 0);overflow:hidden"
,
width
,
height
);
cs
.
cssText
=
R
.
format
(
"width:{0};height:{1};position:absolute;clip:rect(0 {0} {1} 0);overflow:hidden"
,
width
,
height
);
if
(
container
==
1
)
{
if
(
container
==
1
)
{
...
@@ -2376,7 +2376,7 @@ window.Raphael = (function () {
...
@@ -2376,7 +2376,7 @@ window.Raphael = (function () {
Paper
[
proto
].
clear
=
function
()
{
Paper
[
proto
].
clear
=
function
()
{
this
.
canvas
.
innerHTML
=
E
;
this
.
canvas
.
innerHTML
=
E
;
this
.
span
=
doc
.
createElement
(
"span"
);
this
.
span
=
doc
.
createElement
(
"span"
);
this
.
span
.
style
.
cssText
=
"position:absolute;left:-9999
px;top:-9999px
;padding:0;margin:0;line-height:1;display:inline;"
;
this
.
span
.
style
.
cssText
=
"position:absolute;left:-9999
em;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
;
};
};
...
@@ -2613,11 +2613,9 @@ window.Raphael = (function () {
...
@@ -2613,11 +2613,9 @@ window.Raphael = (function () {
return
this
.
paper
[
this
.
type
]().
attr
(
attr
);
return
this
.
paper
[
this
.
type
]().
attr
(
attr
);
};
};
var
getLengthFactory
=
function
(
istotal
,
subpath
)
{
var
getLengthFactory
=
function
(
istotal
,
subpath
)
{
return
function
(
length
)
{
return
function
(
path
,
length
,
onlystart
)
{
if
(
this
.
type
!=
"path"
)
{
path
=
path2curve
(
path
);
return
-
1
;
var
x
,
y
,
p
,
l
,
sp
=
""
,
subpaths
=
{},
point
,
}
var
path
=
path2curve
(
this
.
attrs
.
path
),
x
,
y
,
p
,
l
,
sp
=
""
,
subpaths
=
{},
point
,
len
=
0
;
len
=
0
;
for
(
var
i
=
0
,
ii
=
path
.
length
;
i
<
ii
;
i
++
)
{
for
(
var
i
=
0
,
ii
=
path
.
length
;
i
<
ii
;
i
++
)
{
p
=
path
[
i
];
p
=
path
[
i
];
...
@@ -2630,6 +2628,9 @@ window.Raphael = (function () {
...
@@ -2630,6 +2628,9 @@ window.Raphael = (function () {
if
(
subpath
&&
!
subpaths
.
start
)
{
if
(
subpath
&&
!
subpaths
.
start
)
{
point
=
R
.
findDotsAtSegment
(
x
,
y
,
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
],
p
[
5
],
p
[
6
],
(
length
-
len
)
/
l
);
point
=
R
.
findDotsAtSegment
(
x
,
y
,
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
],
p
[
5
],
p
[
6
],
(
length
-
len
)
/
l
);
sp
+=
[
"C"
,
point
.
start
.
x
,
point
.
start
.
y
,
point
.
m
.
x
,
point
.
m
.
y
,
point
.
x
,
point
.
y
];
sp
+=
[
"C"
,
point
.
start
.
x
,
point
.
start
.
y
,
point
.
m
.
x
,
point
.
m
.
y
,
point
.
x
,
point
.
y
];
if
(
onlystart
)
{
return
sp
;
}
subpaths
.
start
=
sp
;
subpaths
.
start
=
sp
;
sp
=
[
"M"
,
point
.
x
,
point
.
y
,
"C"
,
point
.
n
.
x
,
point
.
n
.
y
,
point
.
end
.
x
,
point
.
end
.
y
,
p
[
5
],
p
[
6
]][
join
]();
sp
=
[
"M"
,
point
.
x
,
point
.
y
,
"C"
,
point
.
n
.
x
,
point
.
n
.
y
,
point
.
end
.
x
,
point
.
end
.
y
,
p
[
5
],
p
[
6
]][
join
]();
len
+=
l
;
len
+=
l
;
...
@@ -2664,9 +2665,22 @@ window.Raphael = (function () {
...
@@ -2664,9 +2665,22 @@ window.Raphael = (function () {
}
}
return
len
;
return
len
;
});
});
Element
[
proto
].
getTotalLength
=
getLengthFactory
(
1
);
var
getTotalLength
=
getLengthFactory
(
1
),
Element
[
proto
].
getPointAtLength
=
getLengthFactory
();
getPointAtLength
=
getLengthFactory
(),
Element
[
proto
].
getSubpathsAtLength
=
getLengthFactory
(
0
,
1
);
getSubpathsAtLength
=
getLengthFactory
(
0
,
1
);
Element
[
proto
].
getTotalLength
=
function
()
{
if
(
this
.
type
!=
"path"
)
return
;
return
getTotalLength
(
this
.
attrs
.
path
);
};
Element
[
proto
].
getPointAtLength
=
function
(
length
)
{
if
(
this
.
type
!=
"path"
)
return
;
return
getPointAtLength
(
this
.
attrs
.
path
,
length
);
};
Element
[
proto
].
getSubpath
=
function
(
from
,
to
)
{
if
(
this
.
type
!=
"path"
)
return
;
var
a
=
getSubpathsAtLength
(
this
.
attrs
.
path
,
to
,
1
);
return
from
?
getSubpathsAtLength
(
a
,
from
).
end
:
a
;
};
// animation easing formulas
// animation easing formulas
R
.
easing_formulas
=
{
R
.
easing_formulas
=
{
...
@@ -2757,7 +2771,7 @@ window.Raphael = (function () {
...
@@ -2757,7 +2771,7 @@ window.Raphael = (function () {
case
"along"
:
case
"along"
:
now
=
pos
*
ms
*
diff
[
attr
];
now
=
pos
*
ms
*
diff
[
attr
];
to
.
back
&&
(
now
=
to
.
len
-
now
);
to
.
back
&&
(
now
=
to
.
len
-
now
);
var
point
=
to
[
attr
].
getPointAtLength
(
now
);
var
point
=
getPointAtLength
(
to
[
attr
],
now
);
that
.
translate
(
diff
.
sx
-
diff
.
x
||
0
,
diff
.
sy
-
diff
.
y
||
0
);
that
.
translate
(
diff
.
sx
-
diff
.
x
||
0
,
diff
.
sy
-
diff
.
y
||
0
);
diff
.
x
=
point
.
x
;
diff
.
x
=
point
.
x
;
diff
.
y
=
point
.
y
;
diff
.
y
=
point
.
y
;
...
@@ -2817,7 +2831,7 @@ window.Raphael = (function () {
...
@@ -2817,7 +2831,7 @@ window.Raphael = (function () {
that
.
_run
&&
that
.
_run
.
call
(
that
);
that
.
_run
&&
that
.
_run
.
call
(
that
);
}
else
{
}
else
{
if
(
to
.
along
)
{
if
(
to
.
along
)
{
var
point
=
to
.
along
.
getPointAtLength
(
to
.
len
*
!
to
.
back
);
var
point
=
getPointAtLength
(
to
.
along
,
to
.
len
*
!
to
.
back
);
that
.
translate
(
diff
.
sx
-
(
diff
.
x
||
0
)
+
point
.
x
-
diff
.
sx
,
diff
.
sy
-
(
diff
.
y
||
0
)
+
point
.
y
-
diff
.
sy
);
that
.
translate
(
diff
.
sx
-
(
diff
.
x
||
0
)
+
point
.
x
-
diff
.
sx
,
diff
.
sy
-
(
diff
.
y
||
0
)
+
point
.
y
-
diff
.
sy
);
to
.
rot
&&
that
.
rotate
(
diff
.
r
+
point
.
alpha
,
point
.
x
,
point
.
y
);
to
.
rot
&&
that
.
rotate
(
diff
.
r
+
point
.
alpha
,
point
.
x
,
point
.
y
);
}
}
...
@@ -2872,14 +2886,8 @@ window.Raphael = (function () {
...
@@ -2872,14 +2886,8 @@ window.Raphael = (function () {
return
function
(
path
,
ms
,
rotate
,
callback
)
{
return
function
(
path
,
ms
,
rotate
,
callback
)
{
var
params
=
{
back
:
isBack
};
var
params
=
{
back
:
isBack
};
R
.
is
(
rotate
,
"function"
)
?
(
callback
=
rotate
)
:
(
params
.
rot
=
rotate
);
R
.
is
(
rotate
,
"function"
)
?
(
callback
=
rotate
)
:
(
params
.
rot
=
rotate
);
if
(
R
.
is
(
path
,
"string"
)
&&
path
.
constructor
!=
Element
)
{
path
&&
path
.
constructor
==
Element
&&
(
path
=
path
.
attrs
.
path
);
path
=
r
.
path
(
path
).
attr
({
stroke
:
"none"
});
path
&&
(
params
.
along
=
path
);
var
f
=
function
()
{
path
.
remove
();
};
callback
=
R
.
is
(
callback
,
"function"
)
?
function
()
{
f
();
callback
.
call
(
this
);
}
:
f
;
}
path
.
constructor
==
Element
&&
(
params
.
along
=
path
);
return
this
.
animate
(
params
,
ms
,
callback
);
return
this
.
animate
(
params
,
ms
,
callback
);
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment