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
1bf5b16d
authored
Mar 08, 2010
by
Dmitry Baranovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix. Wrong files were commited last time
parent
d79aba6b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
221 deletions
+142
-221
plugins/colorwheel.js
+141
-172
plugins/jquery.colorwheel.js
+1
-7
plugins/raphael.blur.js
+0
-42
No files found.
plugins/colorwheel.js
View file @
1bf5b16d
/*!
* Color Wheel 0.1.0 - Raphael plugin
*
* Copyright (c) 2010 John Weir (http://famedriver.com) & Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
(
function
(
Raphael
)
{
(
function
(
Raphael
)
{
Raphael
.
color
picker
=
function
(
x
,
y
,
size
,
initcolor
,
element
)
{
Raphael
.
color
wheel
=
function
(
x
,
y
,
size
,
initcolor
,
element
)
{
return
new
Color
Picker
(
x
,
y
,
size
,
initcolor
,
element
);
return
new
Color
Wheel
(
x
,
y
,
size
,
initcolor
,
element
);
};
};
var
pi
=
Math
.
PI
;
var
pi
=
Math
.
PI
;
function
angle
(
x
,
y
)
{
function
angle
(
x
,
y
)
{
return
(
x
<
0
)
*
180
+
Math
.
atan
(
-
y
/
-
x
)
*
180
/
pi
;
return
(
x
<
0
)
*
180
+
Math
.
atan
(
-
y
/
-
x
)
*
180
/
pi
;
}
}
var
doc
=
document
,
win
=
window
,
var
doc
=
document
,
win
=
window
;
addEvent
=
(
function
()
{
var
addEvent
=
(
function
()
{
if
(
doc
.
addEventListener
)
{
if
(
doc
.
addEventListener
)
{
return
function
(
obj
,
type
,
fn
,
element
)
{
return
function
(
obj
,
type
,
fn
,
element
)
{
var
f
=
function
(
e
)
{
var
f
=
function
(
e
)
{
...
@@ -38,205 +32,181 @@
...
@@ -38,205 +32,181 @@
return
detacher
;
return
detacher
;
};
};
}
}
})(),
})();
ColorPicker
=
function
(
x
,
y
,
size
,
initcolor
,
element
)
{
var
ColorWheel
=
function
(
x
,
y
,
size
,
initcolor
,
element
)
{
size
=
size
||
200
;
size
=
size
||
200
;
var
w3
=
3
*
size
/
200
,
var
w3
=
3
*
size
/
200
,
w1
=
size
/
200
,
w1
=
size
/
200
,
fi
=
1.6180339887
,
fi
=
1.6180339887
,
segments
=
pi
*
size
/
4
,
segments
=
pi
*
size
/
5
,
size20
=
size
/
20
,
size20
=
size
/
20
,
size2
=
size
/
2
,
size2
=
size
/
2
,
padding
=
2
*
size
/
200
,
padding
=
2
*
size
/
200
,
height
=
size
+
size20
*
2
+
padding
*
3
,
t
=
this
;
t
=
this
,
H
=
1
,
S
=
1
,
B
=
1
,
s
=
size
-
(
size20
*
4
),
r
=
element
?
Raphael
(
element
,
size
,
height
)
:
Raphael
(
x
,
y
,
size
,
height
),
xy
=
s
/
6
+
size20
*
2
+
padding
,
wh
=
s
*
2
/
3
-
padding
*
2
;
w1
<
1
&&
(
w1
=
1
);
w3
<
1
&&
(
w3
=
1
);
var
H
=
1
,
S
=
1
,
B
=
1
,
s
=
size
-
(
size20
*
4
);
var
r
=
element
?
Raphael
(
element
,
size
,
size
)
:
Raphael
(
x
,
y
,
size
,
size
),
xy
=
s
/
6
+
size20
*
2
+
padding
,
wh
=
s
*
2
/
3
-
padding
*
2
;
w1
<
1
&&
(
w1
=
1
);
w3
<
1
&&
(
w3
=
1
);
// ring drawing
var
a
=
pi
/
2
-
pi
*
2
/
segments
*
1.3
,
R
=
size2
-
padding
,
R2
=
size2
-
padding
-
size20
*
2
,
path
=
[
"M"
,
size2
,
padding
,
"A"
,
R
,
R
,
0
,
0
,
1
,
R
*
Math
.
cos
(
a
)
+
R
+
padding
,
R
-
R
*
Math
.
sin
(
a
)
+
padding
,
"L"
,
size2
,
size2
,
"z"
].
join
();
for
(
var
i
=
0
;
i
<
segments
;
i
++
)
{
r
.
path
(
path
).
attr
({
stroke
:
"none"
,
fill
:
"hsb("
+
(
segments
-
i
)
*
(
255
/
segments
)
+
", 255, 200)"
,
rotation
:
[
90
+
(
360
/
segments
)
*
i
,
size2
,
size2
]
});
}
r
.
circle
(
size2
,
size2
,
R
).
attr
({
fill
:
"r#fff-#fff"
,
"fill-opacity"
:
0
,
"stroke-width"
:
3
,
stroke
:
"#fff"
});
t
.
cursor
=
r
.
set
();
// ring drawing
t
.
cursor
.
push
(
r
.
circle
(
size2
,
size2
,
size20
/
2
).
attr
({
var
a
=
pi
/
2
-
pi
*
2
/
segments
*
1.3
,
stroke
:
"#000"
,
R
=
size2
-
padding
,
opacity
:
.
5
,
R2
=
size2
-
padding
-
size20
*
2
,
"stroke-width"
:
w3
path
=
[
"M"
,
size2
,
padding
,
"A"
,
R
,
R
,
0
,
0
,
1
,
R
*
Math
.
cos
(
a
)
+
R
+
padding
,
R
-
R
*
Math
.
sin
(
a
)
+
padding
,
"L"
,
R2
*
Math
.
cos
(
a
)
+
R
+
padding
,
R
-
R2
*
Math
.
sin
(
a
)
+
padding
,
"A"
,
R2
,
R2
,
0
,
0
,
0
,
size2
,
padding
+
size20
*
2
,
"z"
].
join
();
}));
for
(
var
i
=
0
;
i
<
segments
;
i
++
)
{
t
.
cursor
.
push
(
t
.
cursor
[
0
].
clone
().
attr
({
r
.
path
(
path
).
attr
({
stroke
:
"#fff"
,
opacity
:
1
,
"stroke-width"
:
w1
}));
t
.
disc
=
r
.
circle
(
size2
,
size2
,
R
).
attr
({
fill
:
"#000"
,
"fill-opacity"
:
0
,
stroke
:
"none"
,
stroke
:
"none"
,
cursor
:
"crosshair"
fill
:
"hsb("
+
i
*
(
255
/
segments
)
+
", 255, 200)"
,
});
rotation
:
[(
360
/
segments
)
*
i
,
size2
,
size2
]
var
style
=
t
.
disc
.
node
.
style
;
style
.
unselectable
=
"on"
;
style
.
MozUserSelect
=
"none"
;
style
.
WebkitUserSelect
=
"none"
;
// brightness drawing
var
h
=
size20
*
2
+
2
;
t
.
brect
=
r
.
rect
(
padding
+
h
/
fi
/
2
,
size
+
padding
*
2
,
size
-
padding
*
2
-
h
/
fi
,
h
-
padding
*
2
).
attr
({
stroke
:
"#fff"
,
fill
:
"180-#fff-#000"
});
t
.
cursorb
=
r
.
set
();
t
.
cursorb
.
push
(
r
.
rect
(
size
-
padding
-
h
/
fi
,
size
+
padding
,
~~
(
h
/
fi
),
h
,
3
*
size
/
200
).
attr
({
stroke
:
"#000"
,
opacity
:
.
5
,
"stroke-width"
:
w3
}));
t
.
cursorb
.
push
(
t
.
cursorb
[
0
].
clone
().
attr
({
stroke
:
"#fff"
,
opacity
:
1
,
"stroke-width"
:
w1
}));
t
.
btop
=
t
.
brect
.
clone
().
attr
({
stroke
:
"#000"
,
fill
:
"#000"
,
opacity
:
0
});
});
style
=
t
.
btop
.
node
.
style
;
}
style
.
unselectable
=
"on"
;
r
.
path
([
"M"
,
size2
,
padding
,
"A"
,
R
,
R
,
0
,
1
,
1
,
size2
-
1
,
padding
,
"l1,0"
,
"M"
,
size2
,
padding
+
size20
*
2
,
"A"
,
R2
,
R2
,
0
,
1
,
1
,
size2
-
1
,
padding
+
size20
*
2
,
"l1,0"
]).
attr
({
style
.
MozUserSelect
=
"none"
;
"stroke-width"
:
w3
,
style
.
WebkitUserSelect
=
"none"
;
stroke
:
"#fff"
});
t
.
minx
=
padding
;
t
.
cursorhsb
=
r
.
set
();
t
.
maxx
=
size
-
h
/
fi
-
padding
;
var
h
=
size20
*
2
+
2
;
t
.
cursorhsb
.
push
(
r
.
rect
(
size2
-
h
/
fi
/
2
,
padding
-
1
,
h
/
fi
,
h
,
3
*
size
/
200
).
attr
({
t
.
H
=
t
.
S
=
t
.
B
=
1
;
stroke
:
"#000"
,
t
.
padding
=
padding
;
opacity
:
.
5
,
t
.
raphael
=
r
;
"stroke-width"
:
w3
t
.
size2
=
size2
;
}));
t
.
size20
=
size20
;
t
.
cursorhsb
.
push
(
t
.
cursorhsb
[
0
].
clone
().
attr
({
t
.
x
=
x
;
stroke
:
"#fff"
,
t
.
y
=
y
;
opacity
:
1
,
"stroke-width"
:
w1
}));
t
.
ring
=
r
.
path
([
"M"
,
size2
,
padding
,
"A"
,
R
,
R
,
0
,
1
,
1
,
size2
-
1
,
padding
,
"l1,0M"
,
size2
,
padding
+
size20
*
2
,
"A"
,
R2
,
R2
,
0
,
1
,
1
,
size2
-
1
,
padding
+
size20
*
2
,
"l1,0"
]).
attr
({
fill
:
"#000"
,
opacity
:
0
,
stroke
:
"none"
});
// events
// rect drawing
t
.
hson
=
addEvent
(
t
.
disc
.
node
,
"mousedown"
,
function
(
e
)
{
t
.
main
=
r
.
rect
(
xy
,
xy
,
wh
,
wh
).
attr
({
var
scrollY
=
doc
.
documentElement
.
scrollTop
||
doc
.
body
.
scrollTop
,
stroke
:
"none"
,
scrollX
=
doc
.
documentElement
.
scrollLeft
||
doc
.
body
.
scrollLeft
;
fill
:
"#f00"
,
this
.
hsOnTheMove
=
true
;
opacity
:
1
this
.
setHS
(
e
.
clientX
+
scrollX
-
this
.
x
,
e
.
clientY
+
scrollY
-
this
.
y
);
});
this
.
docmove
=
addEvent
(
doc
,
"mousemove"
,
this
.
docOnMove
,
this
);
t
.
main
.
clone
().
attr
({
this
.
docup
=
addEvent
(
doc
,
"mouseup"
,
this
.
docOnUp
,
this
);
stroke
:
"none"
,
},
t
);
fill
:
"0-#fff-#fff"
,
t
.
bon
=
addEvent
(
t
.
btop
.
node
,
"mousedown"
,
function
(
e
)
{
opacity
:
0
var
scrollX
=
doc
.
documentElement
.
scrollLeft
||
doc
.
body
.
scrollLeft
;
});
this
.
bOnTheMove
=
true
;
t
.
square
=
r
.
rect
(
xy
-
1
,
xy
-
1
,
wh
+
2
,
wh
+
2
).
attr
({
this
.
setB
(
e
.
clientX
+
scrollX
-
this
.
x
);
r
:
2
,
this
.
docmove
=
addEvent
(
doc
,
"mousemove"
,
this
.
docOnMove
,
this
);
stroke
:
"#fff"
,
this
.
docup
=
addEvent
(
doc
,
"mouseup"
,
this
.
docOnUp
,
this
);
"stroke-width"
:
w3
,
},
t
);
fill
:
"90-#000-#000"
,
t
.
winunload
=
addEvent
(
win
,
"unload"
,
function
()
{
opacity
:
0
,
this
.
hson
();
cursor
:
"crosshair"
this
.
bon
();
});
this
.
docmove
&&
this
.
docmove
();
t
.
cursor
=
r
.
set
();
this
.
docup
&&
this
.
docup
();
t
.
cursor
.
push
(
r
.
circle
(
size2
,
size2
,
size20
/
2
).
attr
({
this
.
winunload
();
stroke
:
"#000"
,
},
t
);
opacity
:
.
5
,
"stroke-width"
:
w3
}));
t
.
cursor
.
push
(
t
.
cursor
[
0
].
clone
().
attr
({
stroke
:
"#fff"
,
opacity
:
1
,
"stroke-width"
:
w1
}));
t
.
H
=
t
.
S
=
t
.
B
=
1
;
t
.
raphael
=
r
;
t
.
size2
=
size2
;
t
.
wh
=
wh
;
t
.
x
=
x
;
t
.
xy
=
xy
;
t
.
y
=
y
;
t
.
color
(
initcolor
||
"#fff"
);
// events
this
.
onchanged
&&
this
.
onchanged
(
this
.
color
());
t
.
hsbon
=
addEvent
(
t
.
ring
.
node
,
"mousedown"
,
function
(
e
)
{
};
this
.
hsbOnTheMove
=
true
;
ColorPicker
.
prototype
.
setB
=
function
(
x
)
{
this
.
setH
(
e
.
clientX
-
this
.
x
-
this
.
size2
,
e
.
clientY
-
this
.
y
-
this
.
size2
);
x
<
this
.
minx
&&
(
x
=
this
.
minx
);
this
.
docmove
=
addEvent
(
doc
,
"mousemove"
,
this
.
docOnMove
,
this
);
x
>
this
.
maxx
&&
(
x
=
this
.
maxx
);
this
.
docup
=
addEvent
(
doc
,
"mouseup"
,
this
.
docOnUp
,
this
);
this
.
cursorb
.
attr
({
x
:
x
});
},
t
);
this
.
B
=
(
x
-
this
.
minx
)
/
(
this
.
maxx
-
this
.
minx
);
t
.
clron
=
addEvent
(
t
.
square
.
node
,
"mousedown"
,
function
(
e
)
{
this
.
onchange
&&
this
.
onchange
(
this
.
color
());
this
.
clrOnTheMove
=
true
;
this
.
setSB
(
e
.
clientX
-
this
.
x
,
e
.
clientY
-
this
.
y
);
this
.
docmove
=
addEvent
(
doc
,
"mousemove"
,
this
.
docOnMove
,
this
);
this
.
docup
=
addEvent
(
doc
,
"mouseup"
,
this
.
docOnUp
,
this
);
},
t
);
t
.
winunload
=
addEvent
(
win
,
"unload"
,
function
()
{
this
.
hsbon
();
this
.
clron
();
this
.
docmove
&&
this
.
docmove
();
this
.
docup
&&
this
.
docup
();
this
.
winunload
();
},
t
);
t
.
color
(
initcolor
||
"#f00"
);
this
.
onchanged
&&
this
.
onchanged
(
this
.
color
());
};
};
ColorPicker
.
prototype
.
setHS
=
function
(
x
,
y
)
{
ColorWheel
.
prototype
.
setH
=
function
(
x
,
y
)
{
var
X
=
x
-
this
.
size2
,
var
d
=
angle
(
x
,
y
),
Y
=
y
-
this
.
size2
,
R
=
this
.
size2
-
this
.
size20
/
2
-
this
.
padding
,
d
=
angle
(
X
,
Y
),
rd
=
d
*
pi
/
180
;
rd
=
d
*
pi
/
180
;
isNaN
(
d
)
&&
(
d
=
0
);
this
.
cursorhsb
.
rotate
(
d
+
90
,
this
.
size2
,
this
.
size2
);
if
(
X
*
X
+
Y
*
Y
>
R
*
R
)
{
this
.
H
=
(
d
+
90
)
/
360
;
x
=
R
*
Math
.
cos
(
rd
)
+
this
.
size2
;
this
.
main
.
attr
({
fill
:
"hsb("
+
this
.
H
+
",1,1)"
});
y
=
R
*
Math
.
sin
(
rd
)
+
this
.
size2
;
this
.
onchange
&&
this
.
onchange
(
this
.
color
());
}
};
ColorWheel
.
prototype
.
setSB
=
function
(
x
,
y
)
{
x
<
this
.
size2
-
this
.
wh
/
2
&&
(
x
=
this
.
size2
-
this
.
wh
/
2
);
x
>
this
.
size2
+
this
.
wh
/
2
&&
(
x
=
this
.
size2
+
this
.
wh
/
2
);
y
<
this
.
size2
-
this
.
wh
/
2
&&
(
y
=
this
.
size2
-
this
.
wh
/
2
);
y
>
this
.
size2
+
this
.
wh
/
2
&&
(
y
=
this
.
size2
+
this
.
wh
/
2
);
this
.
cursor
.
attr
({
cx
:
x
,
cy
:
y
});
this
.
cursor
.
attr
({
cx
:
x
,
cy
:
y
});
this
.
H
=
(
1
-
d
/
360
)
%
1
;
this
.
B
=
1
-
(
y
-
this
.
xy
)
/
this
.
wh
;
this
.
S
=
Math
.
min
((
X
*
X
+
Y
*
Y
)
/
R
/
R
,
1
);
this
.
S
=
(
x
-
this
.
xy
)
/
this
.
wh
;
this
.
brect
.
attr
({
fill
:
"180-hsb("
+
[
this
.
H
,
this
.
S
]
+
",1)-#000"
});
this
.
onchange
&&
this
.
onchange
(
this
.
color
());
this
.
onchange
&&
this
.
onchange
(
this
.
color
());
};
};
ColorPicker
.
prototype
.
docOnMove
=
function
(
e
)
{
ColorWheel
.
prototype
.
docOnMove
=
function
(
e
)
{
var
scrollY
=
doc
.
documentElement
.
scrollTop
||
doc
.
body
.
scrollTop
,
if
(
this
.
hsbOnTheMove
)
{
scrollX
=
doc
.
documentElement
.
scrollLeft
||
doc
.
body
.
scrollLeft
;
this
.
setH
(
e
.
clientX
-
this
.
x
-
this
.
size2
,
e
.
clientY
-
this
.
y
-
this
.
size2
);
if
(
this
.
hsOnTheMove
)
{
this
.
setHS
(
e
.
clientX
+
scrollX
-
this
.
x
,
e
.
clientY
+
scrollY
-
this
.
y
);
}
}
if
(
this
.
b
OnTheMove
)
{
if
(
this
.
clr
OnTheMove
)
{
this
.
set
B
(
e
.
clientX
+
scrollX
-
this
.
x
);
this
.
set
SB
(
e
.
clientX
-
this
.
x
,
e
.
clientY
-
this
.
y
);
}
}
e
.
preventDefault
&&
e
.
preventDefault
();
e
.
preventDefault
&&
e
.
preventDefault
();
e
.
returnValue
=
false
;
e
.
returnValue
=
false
;
return
false
;
return
false
;
};
};
Color
Picker
.
prototype
.
docOnUp
=
function
(
e
)
{
Color
Wheel
.
prototype
.
docOnUp
=
function
(
e
)
{
this
.
hs
OnTheMove
=
this
.
b
OnTheMove
=
false
;
this
.
hs
bOnTheMove
=
this
.
clr
OnTheMove
=
false
;
this
.
docmove
();
this
.
docmove
();
delete
this
.
docmove
;
delete
this
.
docmove
;
this
.
docup
();
this
.
docup
();
delete
this
.
docup
;
delete
this
.
docup
;
this
.
onchanged
&&
this
.
onchanged
(
this
.
color
());
this
.
onchanged
&&
this
.
onchanged
(
this
.
color
());
};
};
Color
Picker
.
prototype
.
remove
=
function
()
{
Color
Wheel
.
prototype
.
remove
=
function
()
{
this
.
raphael
.
remove
();
this
.
raphael
.
remove
();
this
.
color
=
function
()
{
this
.
color
=
function
()
{
return
false
;
return
false
;
};
};
};
};
Color
Picker
.
prototype
.
color
=
function
(
color
)
{
Color
Wheel
.
prototype
.
color
=
function
(
color
)
{
if
(
color
)
{
if
(
color
)
{
color
=
Raphael
.
getRGB
(
color
);
color
=
Raphael
.
getRGB
(
color
);
var
hex
=
color
.
hex
;
color
=
Raphael
.
rgb2hsb
(
color
.
r
,
color
.
g
,
color
.
b
);
color
=
Raphael
.
rgb2hsb
(
color
.
r
,
color
.
g
,
color
.
b
);
d
=
color
.
h
*
360
;
var
d
=
color
.
h
*
360
;
this
.
H
=
color
.
h
;
this
.
H
=
color
.
h
;
this
.
S
=
color
.
s
;
this
.
S
=
color
.
s
;
this
.
B
=
color
.
b
;
this
.
B
=
color
.
b
;
this
.
cursorhsb
.
rotate
(
d
,
this
.
size2
,
this
.
size2
);
this
.
cursorb
.
attr
({
x
:
this
.
B
*
(
this
.
maxx
-
this
.
minx
)
+
this
.
minx
});
this
.
main
.
attr
({
fill
:
"hsb("
+
this
.
H
+
",1,1)"
});
this
.
brect
.
attr
({
fill
:
"180-hsb("
+
[
this
.
H
,
this
.
S
]
+
",1)-#000"
});
var
x
=
this
.
S
*
this
.
wh
+
this
.
xy
,
y
=
(
1
-
this
.
B
)
*
this
.
wh
+
this
.
xy
;
var
d
=
(
1
-
this
.
H
)
*
360
,
rd
=
d
*
pi
/
180
,
R
=
(
this
.
size2
-
this
.
size20
/
2
-
this
.
padding
)
*
this
.
S
,
x
=
Math
.
cos
(
rd
)
*
R
+
this
.
size2
,
y
=
Math
.
sin
(
rd
)
*
R
+
this
.
size2
;
this
.
cursor
.
attr
({
cx
:
x
,
cy
:
y
});
this
.
cursor
.
attr
({
cx
:
x
,
cy
:
y
});
return
this
;
return
this
;
}
else
{
}
else
{
return
Raphael
.
hsb2rgb
(
this
.
H
,
this
.
S
,
this
.
B
).
hex
;
return
Raphael
.
hsb2rgb
(
this
.
H
,
this
.
S
,
this
.
B
).
hex
;
}
}
};
};
})(
window
.
Raphael
);
})(
window
.
Raphael
);
\ No newline at end of file
plugins/jquery.colorwheel.js
View file @
1bf5b16d
/*!
* Color Wheel 0.1.0 - Raphael plugin
*
* Copyright (c) 2010 John Weir (http://famedriver.com) & Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
(
function
(
$
,
R
)
{
(
function
(
$
,
R
)
{
$
.
fn
.
colorwheel
=
function
(
size
,
initcolor
)
{
$
.
fn
.
colorwheel
=
function
(
size
,
initcolor
)
{
if
(
R
)
{
if
(
R
)
{
var
offset
=
this
.
offset
();
var
offset
=
this
.
offset
();
return
R
.
color
picker
(
offset
.
left
,
offset
.
top
,
size
,
initcolor
,
this
[
0
]);
return
R
.
color
wheel
(
offset
.
left
,
offset
.
top
,
size
,
initcolor
,
this
[
0
]);
}
}
return
null
;
return
null
;
};
};
...
...
plugins/raphael.blur.js
deleted
100644 → 0
View file @
d79aba6b
/*!
* Raphael Blur Plugin 0.1
*
* Copyright (c) 2009 Dmitry Baranovskiy (http://raphaeljs.com)
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
*/
if
(
Raphael
.
vml
)
{
Raphael
.
el
.
blur
=
function
(
size
)
{
var
s
=
this
.
node
.
style
,
f
=
s
.
filter
;
f
=
f
.
replace
(
/ progid:
\S
+Blur
\([^\)]
+
\)
/g
,
""
);
if
(
size
!=
"none"
)
{
s
.
filter
=
f
+
" progid:DXImageTransform.Microsoft.Blur(pixelradius="
+
(
+
size
||
1.5
)
+
")"
;
s
.
margin
=
Raphael
.
format
(
"-{0}px 0 0 -{0}px"
,
Math
.
round
(
+
size
||
1.5
));
}
else
{
s
.
filter
=
f
;
s
.
margin
=
0
;
}
};
}
else
{
Raphael
.
el
.
blur
=
function
(
size
)
{
// Experimental. No WebKit support.
if
(
size
!=
"none"
)
{
var
fltr
=
$
(
"filter"
),
blur
=
$
(
"feGaussianBlur"
);
fltr
.
id
=
"r"
+
(
Raphael
.
idGenerator
++
).
toString
(
36
);
$
(
blur
,
{
stdDeviation
:
+
size
||
1.5
});
fltr
.
appendChild
(
blur
);
this
.
paper
.
defs
.
appendChild
(
fltr
);
this
.
_blur
=
fltr
;
$
(
this
.
node
,
{
filter
:
"url(#"
+
fltr
.
id
+
")"
});
}
else
{
if
(
this
.
_blur
)
{
this
.
_blur
.
parentNode
.
removeChild
(
this
.
_blur
);
delete
this
.
_blur
;
}
this
.
node
.
removeAttribute
(
"filter"
);
}
};
}
\ 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