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
0c935da0
authored
Mar 19, 2009
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some checks for right values and some small bug fixes. 0.7.1
parent
7bf58408
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
raphael.js
+17
-16
reference.html
+0
-0
No files found.
raphael.js
View file @
0c935da0
/*
/*
* Raphael 0.7 - JavaScript Vector Library
* Raphael 0.7
.1
- JavaScript Vector Library
*
*
* Copyright (c) 2008 – 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Copyright (c) 2008 – 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
...
@@ -14,15 +14,15 @@ var Raphael = (function () {
...
@@ -14,15 +14,15 @@ var Raphael = (function () {
R
=
function
()
{
R
=
function
()
{
return
create
.
apply
(
R
,
arguments
);
return
create
.
apply
(
R
,
arguments
);
};
};
R
.
version
=
"0.7"
;
R
.
version
=
"0.7
.1
"
;
R
.
type
=
(
win
.
SVGAngle
?
"SVG"
:
"VML"
);
R
.
type
=
(
win
.
SVGAngle
?
"SVG"
:
"VML"
);
R
.
svg
=
!
(
R
.
vml
=
R
.
type
==
"VML"
);
R
.
svg
=
!
(
R
.
vml
=
R
.
type
==
"VML"
);
R
.
idGenerator
=
0
;
R
.
idGenerator
=
0
;
var
paper
=
{};
var
paper
=
{};
R
.
fn
=
{};
R
.
fn
=
{};
var
availableAttrs
=
{
cx
:
0
,
cy
:
0
,
fill
:
"#fff"
,
"fill-opacity"
:
1
,
font
:
'10px "Arial"'
,
"font-family"
:
'"Arial"'
,
"font-size"
:
"10"
,
gradient
:
0
,
height
:
0
,
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
,
translation
:
"0 0"
,
width
:
0
,
x
:
0
,
y
:
0
},
var
availableAttrs
=
{
cx
:
0
,
cy
:
0
,
fill
:
"#fff"
,
"fill-opacity"
:
1
,
font
:
'10px "Arial"'
,
"font-family"
:
'"Arial"'
,
"font-size"
:
"10"
,
gradient
:
0
,
height
:
0
,
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
,
translation
:
"0 0"
,
width
:
0
,
x
:
0
,
y
:
0
},
availableAnimAttrs
=
{
cx
:
"number"
,
cy
:
"number"
,
fill
:
"colour"
,
"fill-opacity"
:
"number"
,
"font-size"
:
"number"
,
height
:
"number"
,
opacity
:
"number"
,
path
:
"path"
,
r
:
"number"
,
rotation
:
"csv"
,
rx
:
"number"
,
ry
:
"number"
,
scale
:
"csv"
,
stroke
:
"colour"
,
"stroke-opacity"
:
"number"
,
"stroke-width"
:
"number"
,
translation
:
"csv"
,
width
:
"number"
,
x
:
"number"
,
y
:
"number"
}
;
availableAnimAttrs
=
{
cx
:
"number"
,
cy
:
"number"
,
fill
:
"colour"
,
"fill-opacity"
:
"number"
,
"font-size"
:
"number"
,
height
:
"number"
,
opacity
:
"number"
,
path
:
"path"
,
r
:
"number"
,
rotation
:
"csv"
,
rx
:
"number"
,
ry
:
"number"
,
scale
:
"csv"
,
stroke
:
"colour"
,
"stroke-opacity"
:
"number"
,
"stroke-width"
:
"number"
,
translation
:
"csv"
,
width
:
"number"
,
x
:
"number"
,
y
:
"number"
}
,
events
=
[
"click"
,
"dblclick"
,
"mousedown"
,
"mousemove"
,
"mouseout"
,
"mouseover"
,
"mouseup"
];
R
.
toString
=
function
()
{
R
.
toString
=
function
()
{
return
"Your browser "
+
(
this
.
vml
?
"doesn't "
:
""
)
+
"support"
+
(
this
.
svg
?
"s"
:
""
)
+
return
"Your browser "
+
(
this
.
vml
?
"doesn't "
:
""
)
+
"support"
+
(
this
.
svg
?
"s"
:
""
)
+
" SVG.\nYou are running "
+
unescape
(
"Rapha%EBl%20"
)
+
this
.
version
;
" SVG.\nYou are running "
+
unescape
(
"Rapha%EBl%20"
)
+
this
.
version
;
...
@@ -833,12 +833,12 @@ var Raphael = (function () {
...
@@ -833,12 +833,12 @@ var Raphael = (function () {
o
.
rotate
(
value
,
true
);
o
.
rotate
(
value
,
true
);
break
;
break
;
case
"translation"
:
case
"translation"
:
var
xy
=
value
.
split
(
separator
);
var
xy
=
(
value
+
""
)
.
split
(
separator
);
o
.
translate
(
xy
[
0
],
xy
[
1
]
);
o
.
translate
(
(
+
xy
[
0
]
+
1
||
2
)
-
1
,
(
+
xy
[
1
]
+
1
||
2
)
-
1
);
break
;
break
;
case
"scale"
:
case
"scale"
:
var
xy
=
value
.
split
(
separator
);
var
xy
=
(
value
+
""
)
.
split
(
separator
);
o
.
scale
(
xy
[
0
],
xy
[
1
]
);
o
.
scale
(
+
xy
[
0
]
||
1
,
+
xy
[
1
]
||
+
xy
[
0
]
||
1
);
break
;
break
;
case
"fill"
:
case
"fill"
:
var
isURL
=
value
.
match
(
/^url
\(([^\)]
+
)\)
$/i
);
var
isURL
=
value
.
match
(
/^url
\(([^\)]
+
)\)
$/i
);
...
@@ -898,7 +898,7 @@ var Raphael = (function () {
...
@@ -898,7 +898,7 @@ var Raphael = (function () {
case
"opacity"
:
case
"opacity"
:
case
"fill-opacity"
:
case
"fill-opacity"
:
if
(
o
.
attrs
.
gradient
)
{
if
(
o
.
attrs
.
gradient
)
{
var
gradient
=
doc
ument
.
getElementById
(
o
.
node
.
getAttribute
(
"fill"
).
replace
(
/^url
\(
#|
\)
$/g
,
""
));
var
gradient
=
doc
.
getElementById
(
o
.
node
.
getAttribute
(
"fill"
).
replace
(
/^url
\(
#|
\)
$/g
,
""
));
if
(
gradient
)
{
if
(
gradient
)
{
var
stops
=
gradient
.
getElementsByTagName
(
"stop"
);
var
stops
=
gradient
.
getElementsByTagName
(
"stop"
);
stops
[
stops
.
length
-
1
].
setAttribute
(
"stop-opacity"
,
value
);
stops
[
stops
.
length
-
1
].
setAttribute
(
"stop-opacity"
,
value
);
...
@@ -1539,11 +1539,11 @@ var Raphael = (function () {
...
@@ -1539,11 +1539,11 @@ var Raphael = (function () {
o
.
rotate
(
params
.
rotation
,
true
);
o
.
rotate
(
params
.
rotation
,
true
);
}
}
if
(
params
.
translation
)
{
if
(
params
.
translation
)
{
var
xy
=
params
.
translation
.
split
(
separator
);
var
xy
=
(
params
.
translation
+
""
)
.
split
(
separator
);
o
.
translate
(
xy
[
0
],
xy
[
1
]);
o
.
translate
(
xy
[
0
],
xy
[
1
]);
}
}
if
(
params
.
scale
)
{
if
(
params
.
scale
)
{
var
xy
=
params
.
scale
.
split
(
separator
);
var
xy
=
(
params
.
scale
+
""
)
.
split
(
separator
);
o
.
scale
(
xy
[
0
],
xy
[
1
]);
o
.
scale
(
xy
[
0
],
xy
[
1
]);
}
}
if
(
o
.
type
==
"image"
&&
params
.
src
)
{
if
(
o
.
type
==
"image"
&&
params
.
src
)
{
...
@@ -1562,7 +1562,7 @@ var Raphael = (function () {
...
@@ -1562,7 +1562,7 @@ var Raphael = (function () {
o
=
o
.
shape
||
o
.
node
;
o
=
o
.
shape
||
o
.
node
;
var
fill
=
(
o
.
getElementsByTagName
(
"fill"
)
&&
o
.
getElementsByTagName
(
"fill"
)[
0
])
||
doc
.
createElement
(
"rvml:fill"
);
var
fill
=
(
o
.
getElementsByTagName
(
"fill"
)
&&
o
.
getElementsByTagName
(
"fill"
)[
0
])
||
doc
.
createElement
(
"rvml:fill"
);
if
(
"fill-opacity"
in
params
||
"opacity"
in
params
)
{
if
(
"fill-opacity"
in
params
||
"opacity"
in
params
)
{
fill
.
opacity
=
((
params
[
"fill-opacity"
]
+
1
||
2
)
-
1
)
*
((
params
.
opacity
+
1
||
2
)
-
1
);
fill
.
opacity
=
((
+
params
[
"fill-opacity"
]
+
1
||
2
)
-
1
)
*
((
+
params
.
opacity
+
1
||
2
)
-
1
);
}
}
if
(
params
.
fill
)
{
if
(
params
.
fill
)
{
fill
.
on
=
true
;
fill
.
on
=
true
;
...
@@ -1592,7 +1592,7 @@ var Raphael = (function () {
...
@@ -1592,7 +1592,7 @@ var Raphael = (function () {
if
(
stroke
.
on
&&
params
.
stroke
)
{
if
(
stroke
.
on
&&
params
.
stroke
)
{
stroke
.
color
=
getRGB
(
params
.
stroke
).
hex
;
stroke
.
color
=
getRGB
(
params
.
stroke
).
hex
;
}
}
stroke
.
opacity
=
((
params
[
"stroke-opacity"
]
+
1
||
2
)
-
1
)
*
((
params
.
opacity
+
1
||
2
)
-
1
);
stroke
.
opacity
=
((
+
params
[
"stroke-opacity"
]
+
1
||
2
)
-
1
)
*
((
+
params
.
opacity
+
1
||
2
)
-
1
);
params
[
"stroke-linejoin"
]
&&
(
stroke
.
joinstyle
=
params
[
"stroke-linejoin"
]
||
"miter"
);
params
[
"stroke-linejoin"
]
&&
(
stroke
.
joinstyle
=
params
[
"stroke-linejoin"
]
||
"miter"
);
stroke
.
miterlimit
=
params
[
"stroke-miterlimit"
]
||
8
;
stroke
.
miterlimit
=
params
[
"stroke-miterlimit"
]
||
8
;
params
[
"stroke-linecap"
]
&&
(
stroke
.
endcap
=
{
butt
:
"flat"
,
square
:
"square"
,
round
:
"round"
}[
params
[
"stroke-linecap"
]]
||
"miter"
);
params
[
"stroke-linecap"
]
&&
(
stroke
.
endcap
=
{
butt
:
"flat"
,
square
:
"square"
,
round
:
"round"
}[
params
[
"stroke-linecap"
]]
||
"miter"
);
...
@@ -2165,7 +2165,6 @@ var Raphael = (function () {
...
@@ -2165,7 +2165,6 @@ var Raphael = (function () {
};
};
}
}
})();
})();
var
events
=
[
"click"
,
"dblclick"
,
"mousedown"
,
"mousemove"
,
"mouseout"
,
"mouseover"
,
"mouseup"
];
for
(
var
i
=
events
.
length
;
i
--
;)
{
for
(
var
i
=
events
.
length
;
i
--
;)
{
(
function
(
eventName
)
{
(
function
(
eventName
)
{
Element
.
prototype
[
eventName
]
=
function
(
fn
)
{
Element
.
prototype
[
eventName
]
=
function
(
fn
)
{
...
@@ -2173,7 +2172,7 @@ var Raphael = (function () {
...
@@ -2173,7 +2172,7 @@ var Raphael = (function () {
this
.
events
=
this
.
events
||
{};
this
.
events
=
this
.
events
||
{};
this
.
events
[
eventName
]
=
this
.
events
[
eventName
]
||
{};
this
.
events
[
eventName
]
=
this
.
events
[
eventName
]
||
{};
this
.
events
[
eventName
][
fn
]
=
this
.
events
[
eventName
][
fn
]
||
[];
this
.
events
[
eventName
][
fn
]
=
this
.
events
[
eventName
][
fn
]
||
[];
this
.
events
[
eventName
][
fn
].
push
(
addEvent
(
this
.
node
,
eventName
,
fn
,
this
));
this
.
events
[
eventName
][
fn
].
push
(
addEvent
(
this
.
shape
||
this
.
node
,
eventName
,
fn
,
this
));
}
}
return
this
;
return
this
;
};
};
...
@@ -2276,6 +2275,8 @@ var Raphael = (function () {
...
@@ -2276,6 +2275,8 @@ var Raphael = (function () {
return
{
x
:
this
.
_
.
sx
,
y
:
this
.
_
.
sy
};
return
{
x
:
this
.
_
.
sx
,
y
:
this
.
_
.
sy
};
}
}
y
=
y
||
x
;
y
=
y
||
x
;
// following line is for IE, apparently NaN is not always falsy
isNaN
(
y
)
&&
(
y
=
x
);
var
dx
,
dy
,
cx
,
cy
;
var
dx
,
dy
,
cx
,
cy
;
if
(
x
!=
0
)
{
if
(
x
!=
0
)
{
var
dirx
=
Math
.
round
(
x
/
Math
.
abs
(
x
)),
var
dirx
=
Math
.
round
(
x
/
Math
.
abs
(
x
)),
...
@@ -2411,7 +2412,7 @@ var Raphael = (function () {
...
@@ -2411,7 +2412,7 @@ var Raphael = (function () {
from
[
attr
]
=
(
from2
[
1
]
==
values
[
1
]
&&
from2
[
2
]
==
values
[
2
])
?
from2
:
[
0
,
values
[
1
],
values
[
2
]];
from
[
attr
]
=
(
from2
[
1
]
==
values
[
1
]
&&
from2
[
2
]
==
values
[
2
])
?
from2
:
[
0
,
values
[
1
],
values
[
2
]];
diff
[
attr
]
=
[(
values
[
0
]
-
from
[
attr
][
0
])
/
ms
,
0
,
0
];
diff
[
attr
]
=
[(
values
[
0
]
-
from
[
attr
][
0
])
/
ms
,
0
,
0
];
}
else
{
}
else
{
from
[
attr
]
=
from
[
attr
]
.
split
(
separator
);
from
[
attr
]
=
(
from
[
attr
]
+
""
)
.
split
(
separator
);
diff
[
attr
]
=
[(
values
[
0
]
-
from
[
attr
][
0
])
/
ms
,
(
values
[
1
]
-
from
[
attr
][
0
])
/
ms
];
diff
[
attr
]
=
[(
values
[
0
]
-
from
[
attr
][
0
])
/
ms
,
(
values
[
1
]
-
from
[
attr
][
0
])
/
ms
];
}
}
to
[
attr
]
=
values
;
to
[
attr
]
=
values
;
...
...
reference.html
View file @
0c935da0
This diff is collapsed.
Click to expand it.
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