Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
殷洪(管理员)
/
raphael
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
951f8fb6
authored
Aug 16, 2011
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed VML, added Set.splice method
parent
e9f2c247
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
151 additions
and
48 deletions
+151
-48
raphael-min.js
+0
-0
raphael.core.js
+72
-10
raphael.js
+62
-24
raphael.vml.js
+17
-14
No files found.
raphael-min.js
View file @
951f8fb6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
raphael.core.js
View file @
951f8fb6
...
@@ -3509,17 +3509,12 @@
...
@@ -3509,17 +3509,12 @@
= (object) original element
= (object) original element
\*/
\*/
elproto
.
animateWith
=
function
(
element
,
params
,
ms
,
easing
,
callback
)
{
elproto
.
animateWith
=
function
(
element
,
params
,
ms
,
easing
,
callback
)
{
// var a = R.animation(params, ms, easing, callback);
// status = element.status(anim);
// this.animate(a);
// this.status(a, status);
this
.
animate
(
params
,
ms
,
easing
,
callback
);
this
.
animate
(
params
,
ms
,
easing
,
callback
);
var
start
,
el
;
return
this
;
for
(
var
i
=
0
,
ii
=
animationElements
.
length
;
i
<
ii
;
i
++
)
{
el
=
animationElements
[
i
];
if
(
el
.
el
.
id
==
element
.
id
)
{
start
=
el
.
timestamp
;
}
else
if
(
el
.
el
.
id
==
this
.
id
)
{
el
.
start
=
start
;
}
}
return
this
.
animate
(
params
,
ms
,
easing
,
callback
);
};
};
function
CubicBezierAtTime
(
t
,
p1x
,
p1y
,
p2x
,
p2y
,
duration
)
{
function
CubicBezierAtTime
(
t
,
p1x
,
p1y
,
p2x
,
p2y
,
duration
)
{
var
cx
=
3
*
p1x
,
var
cx
=
3
*
p1x
,
...
@@ -4119,11 +4114,78 @@
...
@@ -4119,11 +4114,78 @@
}
}
return
this
;
return
this
;
};
};
/*\
* Set.clear
[ method ]
**
* Removeds all elements from the set
\*/
setproto
.
clear
=
function
()
{
setproto
.
clear
=
function
()
{
while
(
this
.
length
)
{
while
(
this
.
length
)
{
this
.
pop
();
this
.
pop
();
}
}
};
};
/*\
* Set.splice
[ method ]
**
* Removes given element from the set
**
> Parameters
**
- index (number) position of the deletion
- count (number) number of element to remove
- insertion… (object) #optional elements to insert
= (object) set elements that were deleted
\*/
setproto
.
splice
=
function
(
index
,
count
,
insertion
)
{
index
=
index
<
0
?
mmax
(
this
.
length
+
index
,
0
)
:
index
;
count
=
mmax
(
0
,
mmin
(
this
.
length
-
index
,
count
));
var
tail
=
[],
todel
=
[],
args
=
[],
i
;
for
(
i
=
2
;
i
<
arguments
.
length
;
i
++
)
{
args
.
push
(
arguments
[
i
]);
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
todel
.
push
(
this
[
index
+
i
]);
}
for
(;
i
<
this
.
length
-
index
;
i
++
)
{
tail
.
push
(
this
[
index
+
i
]);
}
var
arglen
=
args
.
length
;
for
(
i
=
0
;
i
<
arglen
+
tail
.
length
;
i
++
)
{
this
.
items
[
index
+
i
]
=
this
[
index
+
i
]
=
i
<
arglen
?
args
[
i
]
:
tail
[
i
-
arglen
];
}
i
=
this
.
items
.
length
=
this
.
length
-=
count
-
arglen
;
while
(
this
[
i
])
{
delete
this
[
i
++
];
}
return
new
Set
(
todel
);
};
/*\
* Set.exclude
[ method ]
**
* Removes given element from the set
**
> Parameters
**
- element (object) element to remove
= (boolean) `true` if object was found & removed from the set
\*/
setproto
.
exclude
=
function
(
el
)
{
for
(
var
i
=
0
,
ii
=
this
.
length
,
found
;
i
<
ii
;
i
++
)
if
(
found
||
this
[
i
]
==
el
)
{
this
[
i
]
=
this
[
i
+
1
];
found
=
1
;
}
if
(
found
)
{
this
.
length
--
;
delete
this
[
i
];
return
true
;
}
};
setproto
.
animate
=
function
(
params
,
ms
,
easing
,
callback
)
{
setproto
.
animate
=
function
(
params
,
ms
,
easing
,
callback
)
{
(
R
.
is
(
easing
,
"function"
)
||
!
easing
)
&&
(
callback
=
easing
||
null
);
(
R
.
is
(
easing
,
"function"
)
||
!
easing
)
&&
(
callback
=
easing
||
null
);
var
len
=
this
.
items
.
length
,
var
len
=
this
.
items
.
length
,
...
...
raphael.js
View file @
951f8fb6
...
@@ -2560,17 +2560,12 @@
...
@@ -2560,17 +2560,12 @@
};
};
elproto
.
animateWith
=
function
(
element
,
params
,
ms
,
easing
,
callback
)
{
elproto
.
animateWith
=
function
(
element
,
params
,
ms
,
easing
,
callback
)
{
// var a = R.animation(params, ms, easing, callback);
// status = element.status(anim);
// this.animate(a);
// this.status(a, status);
this
.
animate
(
params
,
ms
,
easing
,
callback
);
this
.
animate
(
params
,
ms
,
easing
,
callback
);
var
start
,
el
;
return
this
;
for
(
var
i
=
0
,
ii
=
animationElements
.
length
;
i
<
ii
;
i
++
)
{
el
=
animationElements
[
i
];
if
(
el
.
el
.
id
==
element
.
id
)
{
start
=
el
.
timestamp
;
}
else
if
(
el
.
el
.
id
==
this
.
id
)
{
el
.
start
=
start
;
}
}
return
this
.
animate
(
params
,
ms
,
easing
,
callback
);
};
};
function
CubicBezierAtTime
(
t
,
p1x
,
p1y
,
p2x
,
p2y
,
duration
)
{
function
CubicBezierAtTime
(
t
,
p1x
,
p1y
,
p2x
,
p2y
,
duration
)
{
var
cx
=
3
*
p1x
,
var
cx
=
3
*
p1x
,
...
@@ -3024,11 +3019,51 @@
...
@@ -3024,11 +3019,51 @@
}
}
return
this
;
return
this
;
};
};
setproto
.
clear
=
function
()
{
setproto
.
clear
=
function
()
{
while
(
this
.
length
)
{
while
(
this
.
length
)
{
this
.
pop
();
this
.
pop
();
}
}
};
};
setproto
.
splice
=
function
(
index
,
count
,
insertion
)
{
index
=
index
<
0
?
mmax
(
this
.
length
+
index
,
0
)
:
index
;
count
=
mmax
(
0
,
mmin
(
this
.
length
-
index
,
count
));
var
tail
=
[],
todel
=
[],
args
=
[],
i
;
for
(
i
=
2
;
i
<
arguments
.
length
;
i
++
)
{
args
.
push
(
arguments
[
i
]);
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
todel
.
push
(
this
[
index
+
i
]);
}
for
(;
i
<
this
.
length
-
index
;
i
++
)
{
tail
.
push
(
this
[
index
+
i
]);
}
var
arglen
=
args
.
length
;
for
(
i
=
0
;
i
<
arglen
+
tail
.
length
;
i
++
)
{
this
.
items
[
index
+
i
]
=
this
[
index
+
i
]
=
i
<
arglen
?
args
[
i
]
:
tail
[
i
-
arglen
];
}
i
=
this
.
items
.
length
=
this
.
length
-=
count
-
arglen
;
while
(
this
[
i
])
{
delete
this
[
i
++
];
}
return
new
Set
(
todel
);
};
setproto
.
exclude
=
function
(
el
)
{
for
(
var
i
=
0
,
ii
=
this
.
length
,
found
;
i
<
ii
;
i
++
)
if
(
found
||
this
[
i
]
==
el
)
{
this
[
i
]
=
this
[
i
+
1
];
found
=
1
;
}
if
(
found
)
{
this
.
length
--
;
delete
this
[
i
];
return
true
;
}
};
setproto
.
animate
=
function
(
params
,
ms
,
easing
,
callback
)
{
setproto
.
animate
=
function
(
params
,
ms
,
easing
,
callback
)
{
(
R
.
is
(
easing
,
"function"
)
||
!
easing
)
&&
(
callback
=
easing
||
null
);
(
R
.
is
(
easing
,
"function"
)
||
!
easing
)
&&
(
callback
=
easing
||
null
);
var
len
=
this
.
items
.
length
,
var
len
=
this
.
items
.
length
,
...
@@ -4504,10 +4539,10 @@ window.Raphael.vml && function (R) {
...
@@ -4504,10 +4539,10 @@ window.Raphael.vml && function (R) {
node
.
path
=
path2vml
(
a
.
path
);
node
.
path
=
path2vml
(
a
.
path
);
}
}
if
(
isOval
)
{
if
(
isOval
)
{
var
cx
=
a
.
cx
,
var
cx
=
+
a
.
cx
,
cy
=
a
.
cy
,
cy
=
+
a
.
cy
,
rx
=
a
.
rx
||
a
.
r
||
0
,
rx
=
+
a
.
rx
||
+
a
.
r
||
0
,
ry
=
a
.
ry
||
a
.
r
||
0
;
ry
=
+
a
.
ry
||
+
a
.
r
||
0
;
node
.
path
=
R
.
format
(
"ar{0},{1},{2},{3},{4},{1},{4},{1}x"
,
round
((
cx
-
rx
)
*
zoom
),
round
((
cy
-
ry
)
*
zoom
),
round
((
cx
+
rx
)
*
zoom
),
round
((
cy
+
ry
)
*
zoom
),
round
(
cx
*
zoom
));
node
.
path
=
R
.
format
(
"ar{0},{1},{2},{3},{4},{1},{4},{1}x"
,
round
((
cx
-
rx
)
*
zoom
),
round
((
cy
-
ry
)
*
zoom
),
round
((
cx
+
rx
)
*
zoom
),
round
((
cy
+
ry
)
*
zoom
),
round
(
cx
*
zoom
));
}
}
if
(
"clip-rect"
in
params
)
{
if
(
"clip-rect"
in
params
)
{
...
@@ -4785,19 +4820,21 @@ window.Raphael.vml && function (R) {
...
@@ -4785,19 +4820,21 @@ window.Raphael.vml && function (R) {
if
(
tstr
==
null
)
{
if
(
tstr
==
null
)
{
return
this
.
_
.
transform
;
return
this
.
_
.
transform
;
}
}
R
.
_extractTransform
(
this
,
tstr
);
var
vbs
=
this
.
paper
.
_viewBoxShift
,
vbt
=
vbs
?
"s"
+
[
vbs
.
scale
,
vbs
.
scale
]
+
"-1-1t"
+
[
vbs
.
dx
,
vbs
.
dy
]
:
E
,
oldt
;
if
(
vbs
)
{
oldt
=
tstr
=
Str
(
tstr
).
replace
(
/
\.{3}
|
\u
2026/g
,
this
.
_
.
transform
||
E
);
}
R
.
_extractTransform
(
this
,
vbt
+
tstr
);
var
matrix
=
this
.
matrix
.
clone
(),
var
matrix
=
this
.
matrix
.
clone
(),
vbs
=
this
.
paper
.
_viewBoxShift
,
skew
=
this
.
skew
,
skew
=
this
.
skew
,
o
=
this
.
node
,
o
=
this
.
node
,
split
,
split
,
isGrad
=
Str
(
this
.
attrs
.
fill
).
indexOf
(
"-"
)
+
1
;
isGrad
=
~
Str
(
this
.
attrs
.
fill
).
indexOf
(
"-"
),
isPatt
=
!
Str
(
this
.
attrs
.
fill
).
indexOf
(
"url("
);
matrix
.
translate
(
-
.
5
,
-
.
5
);
matrix
.
translate
(
-
.
5
,
-
.
5
);
if
(
vbs
)
{
if
(
isPatt
||
isGrad
||
this
.
type
==
"image"
)
{
matrix
.
scale
(
vbs
.
scale
,
vbs
.
scale
,
-
1
,
-
1
);
matrix
.
translate
(
vbs
.
dx
,
vbs
.
dy
);
}
if
(
isGrad
||
this
.
type
==
"image"
)
{
skew
.
matrix
=
"1 0 0 1"
;
skew
.
matrix
=
"1 0 0 1"
;
skew
.
offset
=
"0 0"
;
skew
.
offset
=
"0 0"
;
split
=
matrix
.
split
();
split
=
matrix
.
split
();
...
@@ -4818,6 +4855,7 @@ window.Raphael.vml && function (R) {
...
@@ -4818,6 +4855,7 @@ window.Raphael.vml && function (R) {
skew
.
matrix
=
Str
(
matrix
);
skew
.
matrix
=
Str
(
matrix
);
skew
.
offset
=
matrix
.
offset
();
skew
.
offset
=
matrix
.
offset
();
}
}
oldt
&&
(
this
.
_
.
transform
=
oldt
);
return
this
;
return
this
;
};
};
elproto
.
rotate
=
function
(
deg
,
cx
,
cy
)
{
elproto
.
rotate
=
function
(
deg
,
cx
,
cy
)
{
...
@@ -5004,7 +5042,7 @@ window.Raphael.vml && function (R) {
...
@@ -5004,7 +5042,7 @@ window.Raphael.vml && function (R) {
if
(
this
.
removed
)
{
if
(
this
.
removed
)
{
return
this
;
return
this
;
}
}
if
(
element
.
constructor
==
Set
)
{
if
(
element
.
constructor
==
R
.
st
.
constructor
)
{
element
=
element
[
element
.
length
-
1
];
element
=
element
[
element
.
length
-
1
];
}
}
if
(
element
.
node
.
nextSibling
)
{
if
(
element
.
node
.
nextSibling
)
{
...
@@ -5019,7 +5057,7 @@ window.Raphael.vml && function (R) {
...
@@ -5019,7 +5057,7 @@ window.Raphael.vml && function (R) {
if
(
this
.
removed
)
{
if
(
this
.
removed
)
{
return
this
;
return
this
;
}
}
if
(
element
.
constructor
==
Set
)
{
if
(
element
.
constructor
==
R
.
st
.
constructor
)
{
element
=
element
[
0
];
element
=
element
[
0
];
}
}
element
.
node
.
parentNode
.
insertBefore
(
this
.
node
,
element
.
node
);
element
.
node
.
parentNode
.
insertBefore
(
this
.
node
,
element
.
node
);
...
...
raphael.vml.js
View file @
951f8fb6
...
@@ -173,10 +173,10 @@ window.Raphael.vml && function (R) {
...
@@ -173,10 +173,10 @@ window.Raphael.vml && function (R) {
node
.
path
=
path2vml
(
a
.
path
);
node
.
path
=
path2vml
(
a
.
path
);
}
}
if
(
isOval
)
{
if
(
isOval
)
{
var
cx
=
a
.
cx
,
var
cx
=
+
a
.
cx
,
cy
=
a
.
cy
,
cy
=
+
a
.
cy
,
rx
=
a
.
rx
||
a
.
r
||
0
,
rx
=
+
a
.
rx
||
+
a
.
r
||
0
,
ry
=
a
.
ry
||
a
.
r
||
0
;
ry
=
+
a
.
ry
||
+
a
.
r
||
0
;
node
.
path
=
R
.
format
(
"ar{0},{1},{2},{3},{4},{1},{4},{1}x"
,
round
((
cx
-
rx
)
*
zoom
),
round
((
cy
-
ry
)
*
zoom
),
round
((
cx
+
rx
)
*
zoom
),
round
((
cy
+
ry
)
*
zoom
),
round
(
cx
*
zoom
));
node
.
path
=
R
.
format
(
"ar{0},{1},{2},{3},{4},{1},{4},{1}x"
,
round
((
cx
-
rx
)
*
zoom
),
round
((
cy
-
ry
)
*
zoom
),
round
((
cx
+
rx
)
*
zoom
),
round
((
cy
+
ry
)
*
zoom
),
round
(
cx
*
zoom
));
}
}
if
(
"clip-rect"
in
params
)
{
if
(
"clip-rect"
in
params
)
{
...
@@ -454,19 +454,21 @@ window.Raphael.vml && function (R) {
...
@@ -454,19 +454,21 @@ window.Raphael.vml && function (R) {
if
(
tstr
==
null
)
{
if
(
tstr
==
null
)
{
return
this
.
_
.
transform
;
return
this
.
_
.
transform
;
}
}
R
.
_extractTransform
(
this
,
tstr
);
var
vbs
=
this
.
paper
.
_viewBoxShift
,
vbt
=
vbs
?
"s"
+
[
vbs
.
scale
,
vbs
.
scale
]
+
"-1-1t"
+
[
vbs
.
dx
,
vbs
.
dy
]
:
E
,
oldt
;
if
(
vbs
)
{
oldt
=
tstr
=
Str
(
tstr
).
replace
(
/
\.{3}
|
\u
2026/g
,
this
.
_
.
transform
||
E
);
}
R
.
_extractTransform
(
this
,
vbt
+
tstr
);
var
matrix
=
this
.
matrix
.
clone
(),
var
matrix
=
this
.
matrix
.
clone
(),
vbs
=
this
.
paper
.
_viewBoxShift
,
skew
=
this
.
skew
,
skew
=
this
.
skew
,
o
=
this
.
node
,
o
=
this
.
node
,
split
,
split
,
isGrad
=
Str
(
this
.
attrs
.
fill
).
indexOf
(
"-"
)
+
1
;
isGrad
=
~
Str
(
this
.
attrs
.
fill
).
indexOf
(
"-"
),
isPatt
=
!
Str
(
this
.
attrs
.
fill
).
indexOf
(
"url("
);
matrix
.
translate
(
-
.
5
,
-
.
5
);
matrix
.
translate
(
-
.
5
,
-
.
5
);
if
(
vbs
)
{
if
(
isPatt
||
isGrad
||
this
.
type
==
"image"
)
{
matrix
.
scale
(
vbs
.
scale
,
vbs
.
scale
,
-
1
,
-
1
);
matrix
.
translate
(
vbs
.
dx
,
vbs
.
dy
);
}
if
(
isGrad
||
this
.
type
==
"image"
)
{
skew
.
matrix
=
"1 0 0 1"
;
skew
.
matrix
=
"1 0 0 1"
;
skew
.
offset
=
"0 0"
;
skew
.
offset
=
"0 0"
;
split
=
matrix
.
split
();
split
=
matrix
.
split
();
...
@@ -487,6 +489,7 @@ window.Raphael.vml && function (R) {
...
@@ -487,6 +489,7 @@ window.Raphael.vml && function (R) {
skew
.
matrix
=
Str
(
matrix
);
skew
.
matrix
=
Str
(
matrix
);
skew
.
offset
=
matrix
.
offset
();
skew
.
offset
=
matrix
.
offset
();
}
}
oldt
&&
(
this
.
_
.
transform
=
oldt
);
return
this
;
return
this
;
};
};
elproto
.
rotate
=
function
(
deg
,
cx
,
cy
)
{
elproto
.
rotate
=
function
(
deg
,
cx
,
cy
)
{
...
@@ -673,7 +676,7 @@ window.Raphael.vml && function (R) {
...
@@ -673,7 +676,7 @@ window.Raphael.vml && function (R) {
if
(
this
.
removed
)
{
if
(
this
.
removed
)
{
return
this
;
return
this
;
}
}
if
(
element
.
constructor
==
Set
)
{
if
(
element
.
constructor
==
R
.
st
.
constructor
)
{
element
=
element
[
element
.
length
-
1
];
element
=
element
[
element
.
length
-
1
];
}
}
if
(
element
.
node
.
nextSibling
)
{
if
(
element
.
node
.
nextSibling
)
{
...
@@ -688,7 +691,7 @@ window.Raphael.vml && function (R) {
...
@@ -688,7 +691,7 @@ window.Raphael.vml && function (R) {
if
(
this
.
removed
)
{
if
(
this
.
removed
)
{
return
this
;
return
this
;
}
}
if
(
element
.
constructor
==
Set
)
{
if
(
element
.
constructor
==
R
.
st
.
constructor
)
{
element
=
element
[
0
];
element
=
element
[
0
];
}
}
element
.
node
.
parentNode
.
insertBefore
(
this
.
node
,
element
.
node
);
element
.
node
.
parentNode
.
insertBefore
(
this
.
node
,
element
.
node
);
...
...
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