opal-raphael 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -3
- data/lib/opal-raphael.rb +1 -1
- data/opal/opal-raphael.rb +175 -6
- data/spec/raphael_spec.rb +20 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cd5f6f07271a8f0cd5d3179a60fe60164229717
|
4
|
+
data.tar.gz: fb29df5c40899c83c3f5b8e80fbb15b11ec9967f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5605248b1859647c346ead8ff858b49285260093048e4c9418d5000ea35fac210a8a9014b727440729bee6edc29d34f98d9b5399bd55fb7b15f050b3eedd8e93
|
7
|
+
data.tar.gz: bbb540640273008a9b8be861ca4d12ab1108d044bb01c01769cd8368ada52308c437d6e8ea1698ae56ba7fdc20c545bbe73325302ebed705da4cec610ad53e4e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -16,13 +16,23 @@ Example
|
|
16
16
|
background.attr("stroke", "#efefef")
|
17
17
|
```
|
18
18
|
|
19
|
-
See example/app/application.rb for full
|
19
|
+
See example/app/application.rb for full example.
|
20
20
|
|
21
21
|
Status
|
22
22
|
------
|
23
23
|
|
24
|
-
Early alpha
|
25
|
-
|
24
|
+
Early alpha
|
25
|
+
|
26
|
+
* Can render circle and rect
|
27
|
+
* `Animation`, `Matrix`, `Raphael.*`, `Set`, `eve` are not supported
|
28
|
+
(Waiting for your pull request!)
|
29
|
+
|
30
|
+
See opal/opal-raphael.rb for list of supported methods.
|
31
|
+
|
32
|
+
* (Note1: some of the methods may return raw JS object.
|
33
|
+
It should be wrapped with `Raphael::Element`, etc.)
|
34
|
+
* (Note2: method names are intentionally kept lowerCamelCase, so that
|
35
|
+
you can find corresponding Opal method easily)
|
26
36
|
|
27
37
|
Getting started
|
28
38
|
---------------
|
@@ -47,3 +57,11 @@ Caveats
|
|
47
57
|
-------
|
48
58
|
|
49
59
|
Currently does not work well with opal-jquery (see https://github.com/opal/opal/issues/547 )
|
60
|
+
|
61
|
+
History
|
62
|
+
-------
|
63
|
+
|
64
|
+
* v0.0.2 (2014/06/10)
|
65
|
+
* Add some methods
|
66
|
+
* v0.0.1 (2014/06/10)
|
67
|
+
* initial release
|
data/lib/opal-raphael.rb
CHANGED
data/opal/opal-raphael.rb
CHANGED
@@ -12,13 +12,182 @@ def Raphael(a, b, c, d)
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class Raphael
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
#Animation
|
16
|
+
#Animation.delay()
|
17
|
+
#Animation.repeat()
|
19
18
|
|
20
19
|
class Element < `Raphael.el.constructor`
|
21
|
-
alias_native :
|
20
|
+
alias_native :animate
|
21
|
+
alias_native :animateWith
|
22
|
+
alias_native :attr
|
23
|
+
alias_native :click
|
24
|
+
alias_native :clone
|
25
|
+
alias_native :data
|
26
|
+
alias_native :dblclick
|
27
|
+
alias_native :drag
|
28
|
+
alias_native :getBBox
|
29
|
+
alias_native :getPointAtLength
|
30
|
+
alias_native :getSubpath
|
31
|
+
alias_native :getTotalLength
|
32
|
+
alias_native :glow
|
33
|
+
alias_native :hide
|
34
|
+
alias_native :hover
|
35
|
+
def id; `self.id`; end
|
36
|
+
alias_native :insertAfter
|
37
|
+
alias_native :insertBefore
|
38
|
+
alias_native :isPointInside
|
39
|
+
def matrix; `self.matrix`; end
|
40
|
+
alias_native :mousedown
|
41
|
+
alias_native :mousemove
|
42
|
+
alias_native :mouseout
|
43
|
+
alias_native :mouseover
|
44
|
+
alias_native :mouseup
|
45
|
+
def next; `self.next`; end
|
46
|
+
def node; `self.node`; end
|
47
|
+
alias_native :onDragOver
|
48
|
+
def paper; `self.paper`; end
|
49
|
+
alias_native :pause
|
50
|
+
def prev; `self.prev`; end
|
51
|
+
def raphael; `self.raphael`; end
|
52
|
+
alias_native :remove
|
53
|
+
alias_native :removeData
|
54
|
+
alias_native :resume
|
55
|
+
alias_native :rotate
|
56
|
+
alias_native :scale
|
57
|
+
alias_native :setTime
|
58
|
+
alias_native :show
|
59
|
+
alias_native :status
|
60
|
+
alias_native :stop
|
61
|
+
alias_native :toBack
|
62
|
+
alias_native :toFront
|
63
|
+
alias_native :touchcancel
|
64
|
+
alias_native :touchend
|
65
|
+
alias_native :touchmove
|
66
|
+
alias_native :touchstart
|
67
|
+
alias_native :transform
|
68
|
+
alias_native :translate
|
69
|
+
alias_native :unclick
|
70
|
+
alias_native :undblclick
|
71
|
+
alias_native :undrag
|
72
|
+
alias_native :unhover
|
73
|
+
alias_native :unmousedown
|
74
|
+
alias_native :unmousemove
|
75
|
+
alias_native :unmouseout
|
76
|
+
alias_native :unmouseover
|
77
|
+
alias_native :unmouseup
|
78
|
+
alias_native :untouchcancel
|
79
|
+
alias_native :untouchend
|
80
|
+
alias_native :untouchmove
|
81
|
+
alias_native :untouchstart
|
22
82
|
end
|
23
|
-
end
|
24
83
|
|
84
|
+
#Matrix
|
85
|
+
#Matrix.add()
|
86
|
+
#Matrix.clone()
|
87
|
+
#Matrix.invert()
|
88
|
+
#Matrix.rotate()
|
89
|
+
#Matrix.scale()
|
90
|
+
#Matrix.split()
|
91
|
+
#Matrix.toTransformString()
|
92
|
+
#Matrix.translate()
|
93
|
+
#Matrix.x()
|
94
|
+
#Matrix.y()
|
95
|
+
|
96
|
+
class Paper < `Raphael`
|
97
|
+
alias_native :add
|
98
|
+
def bottom; `self.bottom`; end
|
99
|
+
def ca; `self.ca`; end
|
100
|
+
alias_native :circle
|
101
|
+
alias_native :clear
|
102
|
+
def customAttributes; `self.customAttributes`; end
|
103
|
+
alias_native :ellipse
|
104
|
+
alias_native :forEach
|
105
|
+
alias_native :getById
|
106
|
+
alias_native :getElementByPoint
|
107
|
+
alias_native :getElementsByPoint
|
108
|
+
alias_native :getFont
|
109
|
+
alias_native :image
|
110
|
+
alias_native :path
|
111
|
+
alias_native :print
|
112
|
+
def raphael; `self.raphael`; end
|
113
|
+
alias_native :rect
|
114
|
+
alias_native :remove
|
115
|
+
alias_native :renderfix
|
116
|
+
alias_native :safari
|
117
|
+
alias_native :set
|
118
|
+
alias_native :setFinish
|
119
|
+
alias_native :setSize
|
120
|
+
alias_native :setStart
|
121
|
+
alias_native :setViewBox
|
122
|
+
alias_native :text
|
123
|
+
def top; `self.top`; end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Raphael methods
|
127
|
+
#Raphael.angle()
|
128
|
+
#Raphael.animation()
|
129
|
+
#Raphael.bezierBBox()
|
130
|
+
#Raphael.color()
|
131
|
+
#Raphael.createUUID()
|
132
|
+
#Raphael.deg()
|
133
|
+
#Raphael.easing_formulas
|
134
|
+
#Raphael.el
|
135
|
+
#Raphael.findDotsAtSegment()
|
136
|
+
#Raphael.fn
|
137
|
+
#Raphael.format()
|
138
|
+
#Raphael.fullfill()
|
139
|
+
#Raphael.getColor()
|
140
|
+
#Raphael.getColor.reset()
|
141
|
+
#Raphael.getPointAtLength()
|
142
|
+
#Raphael.getRGB()
|
143
|
+
#Raphael.getSubpath()
|
144
|
+
#Raphael.getTotalLength()
|
145
|
+
#Raphael.hsb()
|
146
|
+
#Raphael.hsb2rgb()
|
147
|
+
#Raphael.hsl()
|
148
|
+
#Raphael.hsl2rgb()
|
149
|
+
#Raphael.is()
|
150
|
+
#Raphael.isBBoxIntersect()
|
151
|
+
#Raphael.isPointInsideBBox()
|
152
|
+
#Raphael.isPointInsidePath()
|
153
|
+
#Raphael.mapPath()
|
154
|
+
#Raphael.matrix()
|
155
|
+
#Raphael.ninja()
|
156
|
+
#Raphael.parsePathString()
|
157
|
+
#Raphael.parseTransformString()
|
158
|
+
#Raphael.path2curve()
|
159
|
+
#Raphael.pathBBox()
|
160
|
+
#Raphael.pathIntersection()
|
161
|
+
#Raphael.pathToRelative()
|
162
|
+
#Raphael.rad()
|
163
|
+
#Raphael.registerFont()
|
164
|
+
#Raphael.rgb()
|
165
|
+
#Raphael.rgb2hsb()
|
166
|
+
#Raphael.rgb2hsl()
|
167
|
+
#Raphael.setWindow()
|
168
|
+
#Raphael.snapTo()
|
169
|
+
#Raphael.st
|
170
|
+
#Raphael.svg
|
171
|
+
#Raphael.toMatrix()
|
172
|
+
#Raphael.transformPath()
|
173
|
+
#Raphael.type
|
174
|
+
#Raphael.vml
|
175
|
+
|
176
|
+
#Set
|
177
|
+
#Set.clear()
|
178
|
+
#Set.exclude()
|
179
|
+
#Set.forEach()
|
180
|
+
#Set.pop()
|
181
|
+
#Set.push()
|
182
|
+
#Set.splice()
|
183
|
+
|
184
|
+
#eve()
|
185
|
+
#eve.listeners()
|
186
|
+
#eve.nt()
|
187
|
+
#eve.off()
|
188
|
+
#eve.on()
|
189
|
+
#eve.once()
|
190
|
+
#eve.stop()
|
191
|
+
#eve.unbind()
|
192
|
+
#eve.version
|
193
|
+
end
|
data/spec/raphael_spec.rb
CHANGED
@@ -7,3 +7,23 @@ describe Raphael do
|
|
7
7
|
expect(paper).to be_an_instance_of(Raphael::Paper)
|
8
8
|
end
|
9
9
|
end
|
10
|
+
|
11
|
+
describe Raphael::Paper do
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
describe Raphael::Element do
|
16
|
+
before do
|
17
|
+
@paper = Raphael(0, 0, 5, 5)
|
18
|
+
@circle = @paper.circle(0, 0, 5)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "#attr" do
|
22
|
+
@circle.attr("fill", "red")
|
23
|
+
expect(@circle.attr("fill")).to eq("red")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "#id" do
|
27
|
+
expect(@circle.id).to be_an_instance_of(Integer)
|
28
|
+
end
|
29
|
+
end
|