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
cf76de4f
Commit
cf76de4f
authored
Oct 21, 2008
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fix + added ability to get current transformation.
parent
099c4102
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
46 deletions
+70
-46
raphael-packed.js
raphael-packed.js
+1
-1
raphael.js
raphael.js
+69
-45
No files found.
raphael-packed.js
View file @
cf76de4f
This diff is collapsed.
Click to expand it.
raphael.js
View file @
cf76de4f
...
...
@@ -294,7 +294,12 @@ var Raphael = (function (type) {
if
(
"fill-opacity"
in
params
||
"opacity"
in
params
)
{
fill
.
opacity
=
((
params
[
"fill-opacity"
]
+
1
||
2
)
-
1
)
*
((
params
.
opacity
+
1
||
2
)
-
1
);
}
fill
.
on
=
(
params
.
fill
&&
params
.
fill
!=
"none"
);
if
(
params
.
fill
)
{
fill
.
on
=
true
;
}
if
(
params
.
fill
==
"none"
)
{
fill
.
on
=
false
;
}
if
(
fill
.
on
&&
params
.
fill
)
{
fill
.
color
=
params
.
fill
;
}
...
...
@@ -388,6 +393,14 @@ var Raphael = (function (type) {
this
.
attrs
=
{};
this
.
Group
=
group
;
this
.
vml
=
vml
;
this
.
rotate
=
function
(
deg
)
{
if
(
deg
==
undefined
)
{
return
Rotation
;
}
Rotation
+=
deg
;
this
.
Group
.
style
.
rotation
=
Rotation
;
return
this
;
};
};
Element
.
prototype
.
setBox
=
function
(
params
)
{
var
gs
=
this
.
Group
.
style
,
...
...
@@ -446,12 +459,10 @@ var Raphael = (function (type) {
this
.
Group
.
style
.
display
=
"block"
;
return
this
;
};
Element
.
prototype
.
rotate
=
function
(
deg
)
{
Rotation
+=
deg
;
this
.
Group
.
style
.
rotation
=
Rotation
;
return
this
;
};
Element
.
prototype
.
translate
=
function
(
x
,
y
)
{
if
(
x
==
undefined
&&
y
==
undefined
)
{
return
{
x
:
this
.
X
,
y
:
this
.
Y
};
}
this
.
X
+=
x
;
this
.
Y
+=
y
;
this
.
Group
.
style
.
left
=
this
.
X
+
"px"
;
...
...
@@ -465,6 +476,10 @@ var Raphael = (function (type) {
return
this
;
};
Element
.
prototype
.
scale
=
function
(
x
,
y
)
{
if
(
x
==
undefined
&&
y
==
undefined
)
{
return
;
// TODO
}
y
=
y
||
x
;
if
(
x
!=
0
&&
!
(
x
==
1
&&
y
==
1
))
{
var
dirx
=
Math
.
round
(
x
/
Math
.
abs
(
x
)),
...
...
@@ -1056,6 +1071,54 @@ var Raphael = (function (type) {
this
[
0
]
=
node
;
this
.
attrs
=
this
.
attrs
||
{};
this
.
transformations
=
[];
// rotate, translate, scale, matrix
this
.
rotate
=
function
(
deg
)
{
if
(
deg
==
undefined
)
{
return
Rotation
.
deg
;
}
var
bbox
=
this
.
getBBox
();
Rotation
.
deg
+=
deg
;
if
(
Rotation
.
deg
)
{
this
.
transformations
[
0
]
=
(
"rotate("
+
Rotation
.
deg
+
" "
+
(
bbox
.
x
+
bbox
.
width
/
2
)
+
" "
+
(
bbox
.
y
+
bbox
.
height
/
2
)
+
")"
);
}
else
{
this
.
transformations
[
0
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
return
this
;
};
this
.
translate
=
function
(
x
,
y
)
{
if
(
x
==
undefined
&&
y
==
undefined
)
{
return
{
x
:
X
,
y
:
Y
};
}
X
+=
x
;
Y
+=
y
;
if
(
X
&&
Y
)
{
this
.
transformations
[
1
]
=
"translate("
+
X
+
","
+
Y
+
")"
;
}
else
{
this
.
transformations
[
1
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
return
this
;
};
this
.
scale
=
function
(
x
,
y
)
{
if
(
x
==
undefined
&&
y
==
undefined
)
{
return
{
x
:
ScaleX
,
y
:
ScaleY
};
}
y
=
y
||
x
;
if
(
x
!=
0
&&
!
(
x
==
1
&&
y
==
1
))
{
ScaleX
*=
x
;
ScaleY
*=
y
;
if
(
!
(
ScaleX
==
1
&&
ScaleY
==
1
))
{
var
bbox
=
this
.
getBBox
(),
dx
=
bbox
.
x
*
(
1
-
ScaleX
)
+
(
bbox
.
width
/
2
-
bbox
.
width
*
ScaleX
/
2
),
dy
=
bbox
.
y
*
(
1
-
ScaleY
)
+
(
bbox
.
height
/
2
-
bbox
.
height
*
ScaleY
/
2
);
this
.
transformations
[
2
]
=
new
Matrix
(
ScaleX
,
0
,
0
,
ScaleY
,
dx
,
dy
);
}
else
{
this
.
transformations
[
2
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
}
return
this
;
};
};
Element
.
prototype
.
hide
=
function
()
{
this
[
0
].
style
.
display
=
"none"
;
...
...
@@ -1065,45 +1128,6 @@ var Raphael = (function (type) {
this
[
0
].
style
.
display
=
"block"
;
return
this
;
};
Element
.
prototype
.
rotate
=
function
(
deg
)
{
var
bbox
=
this
.
getBBox
();
Rotation
.
deg
+=
deg
;
if
(
Rotation
.
deg
)
{
this
.
transformations
[
0
]
=
(
"rotate("
+
Rotation
.
deg
+
" "
+
(
bbox
.
x
+
bbox
.
width
/
2
)
+
" "
+
(
bbox
.
y
+
bbox
.
height
/
2
)
+
")"
);
}
else
{
this
.
transformations
[
0
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
return
this
;
};
Element
.
prototype
.
translate
=
function
(
x
,
y
)
{
X
+=
x
;
Y
+=
y
;
if
(
X
&&
Y
)
{
this
.
transformations
[
1
]
=
"translate("
+
X
+
","
+
Y
+
")"
;
}
else
{
this
.
transformations
[
1
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
return
this
;
};
Element
.
prototype
.
scale
=
function
(
x
,
y
)
{
y
=
y
||
x
;
if
(
x
!=
0
&&
!
(
x
==
1
&&
y
==
1
))
{
ScaleX
*=
x
;
ScaleY
*=
y
;
if
(
!
(
ScaleX
==
1
&&
ScaleY
==
1
))
{
var
bbox
=
this
.
getBBox
(),
dx
=
bbox
.
x
*
(
1
-
ScaleX
)
+
(
bbox
.
width
/
2
-
bbox
.
width
*
ScaleX
/
2
),
dy
=
bbox
.
y
*
(
1
-
ScaleY
)
+
(
bbox
.
height
/
2
-
bbox
.
height
*
ScaleY
/
2
);
this
.
transformations
[
2
]
=
new
Matrix
(
ScaleX
,
0
,
0
,
ScaleY
,
dx
,
dy
);
}
else
{
this
.
transformations
[
2
]
=
""
;
}
this
[
0
].
setAttribute
(
"transform"
,
this
.
transformations
.
join
(
" "
));
}
return
this
;
};
// depricated
Element
.
prototype
.
matrix
=
function
(
xx
,
xy
,
yx
,
yy
,
dx
,
dy
)
{
this
.
transformations
[
3
]
=
new
Matrix
(
xx
,
xy
,
yx
,
yy
,
dx
,
dy
);
...
...
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