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
0aaaf057
Commit
0aaaf057
authored
Aug 20, 2009
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plugins folder
parent
661af8c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
0 deletions
+140
-0
raphael.path.methods.js
plugins/raphael.path.methods.js
+91
-0
raphael.primitives.js
plugins/raphael.primitives.js
+49
-0
No files found.
plugins/raphael.path.methods.js
0 → 100644
View file @
0aaaf057
Raphael
.
el
.
isAbsolute
=
true
;
Raphael
.
el
.
absolutely
=
function
()
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
this
.
isAbsolute
=
true
;
return
this
;
};
Raphael
.
el
.
relatively
=
function
()
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
this
.
isAbsolute
=
false
;
return
this
;
};
Raphael
.
el
.
moveTo
=
function
(
x
,
y
)
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
d
=
this
.
isAbsolute
?
"M"
:
"m"
;
d
+=
+
parseFloat
(
x
).
toFixed
(
3
)
+
" "
+
(
+
parseFloat
(
y
).
toFixed
(
3
))
+
" "
;
this
.
attr
({
path
:
this
.
attrs
.
path
+
d
});
return
this
;
};
Raphael
.
el
.
lineTo
=
function
(
x
,
y
)
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
d
=
this
.
isAbsolute
?
"L"
:
"l"
;
d
+=
+
parseFloat
(
x
).
toFixed
(
3
)
+
" "
+
(
+
parseFloat
(
y
).
toFixed
(
3
))
+
" "
;
this
.
attr
({
path
:
this
.
attrs
.
path
+
d
});
return
this
;
};
Raphael
.
el
.
arcTo
=
function
(
rx
,
ry
,
large_arc_flag
,
sweep_flag
,
x
,
y
)
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
d
=
this
.
isAbsolute
?
"A"
:
"a"
;
d
+=
[
+
parseFloat
(
rx
).
toFixed
(
3
),
+
parseFloat
(
ry
).
toFixed
(
3
),
0
,
large_arc_flag
,
sweep_flag
,
+
parseFloat
(
x
).
toFixed
(
3
),
+
parseFloat
(
y
).
toFixed
(
3
)].
join
(
" "
);
this
.
attr
({
path
:
this
.
attrs
.
path
+
d
});
return
this
;
};
Raphael
.
el
.
curveTo
=
function
()
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
args
=
Array
.
prototype
.
splice
.
call
(
arguments
,
0
,
arguments
.
length
),
d
=
[
0
,
0
,
0
,
0
,
"s"
,
0
,
"c"
][
args
.
length
]
||
""
;
if
(
this
.
isAbsolute
)
{
d
=
d
.
toUpperCase
();
}
this
.
attr
({
path
:
this
.
attrs
.
path
+
d
+
args
});
return
this
;
};
Raphael
.
el
.
qcurveTo
=
function
()
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
d
=
[
0
,
1
,
"t"
,
3
,
"q"
][
arguments
.
length
],
args
=
Array
.
prototype
.
splice
.
call
(
arguments
,
0
,
arguments
.
length
);
if
(
this
.
isAbsolute
)
{
d
=
d
.
toUpperCase
();
}
this
.
attr
({
path
:
this
.
attrs
.
path
+
d
+
args
});
return
this
;
};
Raphael
.
el
.
addRoundedCorner
=
function
(
r
,
dir
)
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
var
rollback
=
this
.
isAbsolute
,
o
=
this
;
if
(
rollback
)
{
this
.
relatively
();
rollback
=
function
()
{
o
.
absolutely
();
};
}
else
{
rollback
=
function
()
{};
}
this
.
arcTo
(
r
,
r
,
0
,
{
"lu"
:
1
,
"rd"
:
1
,
"ur"
:
1
,
"dl"
:
1
}[
dir
]
||
0
,
r
*
(
!!
(
dir
.
indexOf
(
"r"
)
+
1
)
*
2
-
1
),
r
*
(
!!
(
dir
.
indexOf
(
"d"
)
+
1
)
*
2
-
1
));
rollback
();
return
this
;
};
Raphael
.
el
.
andClose
=
function
()
{
if
(
this
.
type
!=
"path"
)
{
return
this
;
}
this
.
attr
({
path
:
this
.
attrs
.
path
+
"z"
});
return
this
;
};
\ No newline at end of file
plugins/raphael.primitives.js
0 → 100644
View file @
0aaaf057
Raphael
.
fn
.
star
=
function
(
cx
,
cy
,
rout
,
rin
,
n
)
{
rin
=
rin
||
rout
*
.
5
;
n
=
+
n
<
3
||
!
n
?
5
:
n
;
var
points
=
[
"M"
,
cx
,
cy
+
rin
,
"L"
],
R
;
for
(
var
i
=
1
;
i
<
n
*
2
;
i
++
)
{
R
=
i
%
2
?
rout
:
rin
;
points
=
points
.
concat
([
+
(
cx
+
R
*
Math
.
sin
(
i
*
Math
.
PI
/
n
)).
toFixed
(
3
),
+
(
cy
+
R
*
Math
.
cos
(
i
*
Math
.
PI
/
n
)).
toFixed
(
3
)]);
}
points
.
push
(
"z"
);
return
this
.
path
(
points
);
};
Raphael
.
fn
.
flower
=
function
(
cx
,
cy
,
rout
,
rin
,
n
)
{
rin
=
rin
||
rout
*
.
5
;
n
=
+
n
<
3
||
!
n
?
5
:
n
;
var
points
=
[
"M"
,
cx
,
cy
+
rin
,
"Q"
],
R
;
for
(
var
i
=
1
;
i
<
n
*
2
+
1
;
i
++
)
{
R
=
i
%
2
?
rout
:
rin
;
points
=
points
.
concat
([
+
(
cx
+
R
*
Math
.
sin
(
i
*
Math
.
PI
/
n
)).
toFixed
(
3
),
+
(
cy
+
R
*
Math
.
cos
(
i
*
Math
.
PI
/
n
)).
toFixed
(
3
)]);
}
points
.
push
(
"z"
);
return
this
.
path
(
points
);
};
Raphael
.
fn
.
spike
=
function
(
cx
,
cy
,
rout
,
rin
,
n
)
{
rin
=
rin
||
rout
*
.
5
;
n
=
+
n
<
3
||
!
n
?
5
:
n
;
var
points
=
[
"M"
,
cx
,
cy
-
rout
,
"Q"
],
R
;
for
(
var
i
=
1
;
i
<
n
*
2
+
1
;
i
++
)
{
R
=
i
%
2
?
rin
:
rout
;
points
=
points
.
concat
([
cx
+
R
*
Math
.
sin
(
i
*
Math
.
PI
/
n
-
Math
.
PI
),
cy
+
R
*
Math
.
cos
(
i
*
Math
.
PI
/
n
-
Math
.
PI
)]);
}
points
.
push
(
"z"
);
return
this
.
path
(
points
);
};
Raphael
.
fn
.
polygon
=
function
(
cx
,
cy
,
r
,
n
)
{
n
=
+
n
<
3
||
!
n
?
5
:
n
;
var
points
=
[
"M"
,
cx
,
cy
-
r
,
"L"
],
R
;
for
(
var
i
=
1
;
i
<
n
;
i
++
)
{
points
=
points
.
concat
([
cx
+
r
*
Math
.
sin
(
i
*
Math
.
PI
*
2
/
n
-
Math
.
PI
),
cy
+
r
*
Math
.
cos
(
i
*
Math
.
PI
*
2
/
n
-
Math
.
PI
)]);
}
points
.
push
(
"z"
);
return
this
.
path
(
points
);
};
Raphael
.
fn
.
line
=
function
(
x1
,
y1
,
x2
,
y2
)
{
return
this
.
path
([
"M"
,
x1
,
y1
,
"L"
,
x2
,
y2
]);
};
\ No newline at end of file
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